Fix OmahaRequestAction unittest.
The unittest OmahaRequestActionTest.FormatUpdateCheckOutputTest was
incorrectly expecting the previous version to be set even if it wasn't
an update to a new update.
Bug: 24867646
Test: FEATURES=test emerge-link update_engine
Change-Id: I90d7d1cb24929f1c7d9d581dcccdd53a3a315ab5
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 268e4c2..1ee2151 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -1145,7 +1145,9 @@
EXPECT_CALL(prefs, GetString(kPrefsPreviousVersion, _))
.WillOnce(DoAll(SetArgumentPointee<1>(string("")), Return(true)));
- EXPECT_CALL(prefs, SetString(kPrefsPreviousVersion, _)).Times(1);
+ // An existing but empty previous version means that we didn't reboot to a new
+ // update, therefore, no need to update the previous version.
+ EXPECT_CALL(prefs, SetString(kPrefsPreviousVersion, _)).Times(0);
ASSERT_FALSE(TestUpdateCheck(nullptr, // request_params
"invalid xml>",
-1,
@@ -1168,6 +1170,8 @@
string::npos);
EXPECT_NE(post_str.find("ec_version=\"0X0A1\""),
string::npos);
+ // No <event> tag should be sent if we didn't reboot to an update.
+ EXPECT_EQ(post_str.find("<event"), string::npos);
}