Always update target version prefix
When UpdateAttempter::Update is called, the cached target version
prefix in its |omaha_request_params_| should always be updated with
the one passed in.
Also fix the target version LOG lines in kiosk app pin policy code.
BUG=chromium:695133
TEST=UpdateAttempterTest.TargetVersionPrefixSetAndReset
Reviewed-on: https://chromium-review.googlesource.com/446657
Commit-Ready: Xiyuan Xia <[email protected]>
Tested-by: Xiyuan Xia <[email protected]>
Reviewed-by: Alex Deymo <[email protected]>
Reviewed-by: Ben Chan <[email protected]>
(cherry picked from commit 4d34c18e5ce29d138c7946cc817dee8b3fce7cf0)
Change-Id: I712b169505f4566aac3a0b2c9746dfcb9466ef8d
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 94a1b3c..5224870 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -978,4 +978,14 @@
EXPECT_EQ(constants::kOmahaDefaultAUTestURL, attempter_.forced_omaha_url());
}
+TEST_F(UpdateAttempterTest, TargetVersionPrefixSetAndReset) {
+ attempter_.CalculateUpdateParams("", "", "", "1234", false, false);
+ EXPECT_EQ("1234",
+ fake_system_state_.request_params()->target_version_prefix());
+
+ attempter_.CalculateUpdateParams("", "", "", "", false, false);
+ EXPECT_TRUE(
+ fake_system_state_.request_params()->target_version_prefix().empty());
+}
+
} // namespace chromeos_update_engine