diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-14 01:09:55 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-14 01:09:55 +0000 |
commit | a6c543c64b135f521cae645c2f882d78bf7307e8 (patch) | |
tree | 3e0ef8551a610e593102d8ff0f0a2d8c9b682581 /aosp/update_attempter_android_unittest.cc | |
parent | 3d4e6e0d7ed2b609e0fe2b4d0fcb250808f97476 (diff) | |
parent | 422e893875d4d1c8cf73db5d39a0eac19bce3065 (diff) |
Snap for 7360053 from 422e893875d4d1c8cf73db5d39a0eac19bce3065 to sc-release
Change-Id: I9d292ff0b5cbdc3e0ab778bcb3f9eca70d8a0277
Diffstat (limited to 'aosp/update_attempter_android_unittest.cc')
-rw-r--r-- | aosp/update_attempter_android_unittest.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/aosp/update_attempter_android_unittest.cc b/aosp/update_attempter_android_unittest.cc index f799df3e..f73df168 100644 --- a/aosp/update_attempter_android_unittest.cc +++ b/aosp/update_attempter_android_unittest.cc @@ -24,6 +24,7 @@ #include <base/time/time.h> #include <gtest/gtest.h> +#include "common/constants.h" #include "update_engine/aosp/daemon_state_android.h" #include "update_engine/common/fake_boot_control.h" #include "update_engine/common/fake_clock.h" @@ -81,6 +82,8 @@ TEST_F(UpdateAttempterAndroidTest, UpdatePrefsSameBuildVersionOnInit) { prefs_.SetString(kPrefsPreviousVersion, build_version); prefs_.SetString(kPrefsBootId, "oldboot"); prefs_.SetInt64(kPrefsNumReboots, 1); + prefs_.SetInt64(kPrefsPreviousSlot, 1); + boot_control_.SetCurrentSlot(1); EXPECT_CALL(*metrics_reporter_, ReportTimeToReboot(_)).Times(0); update_attempter_android_.Init(); @@ -88,15 +91,15 @@ TEST_F(UpdateAttempterAndroidTest, UpdatePrefsSameBuildVersionOnInit) { // Check that the boot_id and reboot_count are updated. std::string boot_id; utils::GetBootId(&boot_id); - EXPECT_TRUE(prefs_.Exists(kPrefsBootId)); + ASSERT_TRUE(prefs_.Exists(kPrefsBootId)); std::string prefs_boot_id; - EXPECT_TRUE(prefs_.GetString(kPrefsBootId, &prefs_boot_id)); - EXPECT_EQ(boot_id, prefs_boot_id); + ASSERT_TRUE(prefs_.GetString(kPrefsBootId, &prefs_boot_id)); + ASSERT_EQ(boot_id, prefs_boot_id); - EXPECT_TRUE(prefs_.Exists(kPrefsNumReboots)); + ASSERT_TRUE(prefs_.Exists(kPrefsNumReboots)); int64_t reboot_count; - EXPECT_TRUE(prefs_.GetInt64(kPrefsNumReboots, &reboot_count)); - EXPECT_EQ(2, reboot_count); + ASSERT_TRUE(prefs_.GetInt64(kPrefsNumReboots, &reboot_count)); + ASSERT_EQ(2, reboot_count); } TEST_F(UpdateAttempterAndroidTest, UpdatePrefsBuildVersionChangeOnInit) { |