-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_status_utils_unittest.cc
53 lines (46 loc) · 1.62 KB
/
update_status_utils_unittest.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "update_engine/update_status_utils.h"
#include <string>
#include <gtest/gtest.h>
using std::string;
namespace chromeos_update_engine {
TEST(UpdateStatusUtilsTest, UpdateEngineStatusToStringTest) {
// Keep field assignments in same order as they were declared,
// to prevent compiler warning, -Wreorder-init-fields.
update_engine::UpdateEngineStatus update_engine_status = {
.last_checked_time = 156000000,
.status = update_engine::UpdateStatus::CHECKING_FOR_UPDATE,
.progress = 0.5,
.new_size_bytes = 888,
.new_version = "12345.0.0",
.is_enterprise_rollback = true,
.is_install = true,
.will_powerwash_after_reboot = true,
};
string print =
R"(CURRENT_OP=UPDATE_STATUS_CHECKING_FOR_UPDATE
IS_ENTERPRISE_ROLLBACK=true
IS_INSTALL=true
LAST_CHECKED_TIME=156000000
NEW_SIZE=888
NEW_VERSION=12345.0.0
PROGRESS=0.5
WILL_POWERWASH_AFTER_REBOOT=true
)";
EXPECT_EQ(print, UpdateEngineStatusToString(update_engine_status));
}
} // namespace chromeos_update_engine