summaryrefslogtreecommitdiff
path: root/aosp/update_attempter_android_unittest.cc
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-06-04 18:02:47 +0000
committerScott Lobdell <slobdell@google.com>2021-06-04 18:02:47 +0000
commit308f26179c8dba125b44d22160ba264cf17deed4 (patch)
treeeaf5efaa52859f5cc863de675b8436763e033c22 /aosp/update_attempter_android_unittest.cc
parentf79cb91b4218a68642c94a01defc0594e742b3f4 (diff)
parent0c4dd756622ddb0a48bfb0dd2b62761d8193d89a (diff)
Merge SP1A.210604.001
Change-Id: Ic0b06785e559f2b316762ba170d60370f83f7cf3
Diffstat (limited to 'aosp/update_attempter_android_unittest.cc')
-rw-r--r--aosp/update_attempter_android_unittest.cc15
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) {