diff options
author | Tianjie Xu <xunchang@google.com> | 2020-07-06 21:23:45 +0000 |
---|---|---|
committer | Tianjie Xu <xunchang@google.com> | 2020-07-06 21:23:45 +0000 |
commit | 242e33af30f7aa74531d436e1609100aae3b4394 (patch) | |
tree | 048c16c3935bac60f150f676ad8f8d8493248ce1 /update_status_utils_unittest.cc | |
parent | 33d180914ef2cb9286595fb1fdcc3511c5fb1c34 (diff) | |
parent | 55abd3cbae6bd150b3534728a63befd1cadd6c5e (diff) |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'update_status_utils_unittest.cc')
-rw-r--r-- | update_status_utils_unittest.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/update_status_utils_unittest.cc b/update_status_utils_unittest.cc new file mode 100644 index 00000000..228201c8 --- /dev/null +++ b/update_status_utils_unittest.cc @@ -0,0 +1,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 |