Add support to update_engine to poke Omaha after an update has been applied
successfully and is awaiting reboot to help ensure the number of actives
remains accurate.
BUG=chromium-os:12026
TEST=Manual test, unit tests
Change-Id: Ie3397264b0b34e8d423fb9748970f7d330122180
Review URL: http://codereview.chromium.org/6836025
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 409e947..3bf02e2 100755
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -169,7 +169,8 @@
OmahaRequestAction action(prefs ? prefs : &local_prefs,
params,
NULL,
- fetcher);
+ fetcher,
+ false);
OmahaRequestActionTestProcessorDelegate delegate;
delegate.loop_ = loop;
delegate.expected_code_ = expected_code;
@@ -204,7 +205,7 @@
http_response.size(),
NULL);
NiceMock<PrefsMock> prefs;
- OmahaRequestAction action(&prefs, params, event, fetcher);
+ OmahaRequestAction action(&prefs, params, event, fetcher, false);
OmahaRequestActionTestProcessorDelegate delegate;
delegate.loop_ = loop;
ActionProcessor processor;
@@ -270,7 +271,8 @@
OmahaRequestAction action(&prefs, kDefaultTestParams, NULL,
new MockHttpFetcher(http_response.data(),
http_response.size(),
- NULL));
+ NULL),
+ false);
OmahaRequestActionTestProcessorDelegate delegate;
delegate.loop_ = loop;
ActionProcessor processor;
@@ -295,7 +297,8 @@
fetcher->set_never_use(true);
OmahaRequestAction action(&prefs, kDefaultTestParams,
new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
- fetcher); // Passes fetcher ownership
+ fetcher, // Passes fetcher ownership
+ false);
action.set_should_skip(true);
OmahaRequestActionTestProcessorDelegate delegate;
delegate.loop_ = loop;
@@ -444,7 +447,8 @@
OmahaRequestAction action(&prefs, kDefaultTestParams, NULL,
new MockHttpFetcher(http_response.data(),
http_response.size(),
- NULL));
+ NULL),
+ false);
TerminateEarlyTestProcessorDelegate delegate;
delegate.loop_ = loop;
ActionProcessor processor;
@@ -560,8 +564,9 @@
&post_data));
// convert post_data to string
string post_str(&post_data[0], post_data.size());
- EXPECT_NE(post_str.find(" <o:ping a=\"-1\" r=\"-1\"></o:ping>\n"
- " <o:updatecheck></o:updatecheck>\n"),
+ EXPECT_NE(post_str.find(
+ " <o:ping active=\"1\" a=\"-1\" r=\"-1\"></o:ping>\n"
+ " <o:updatecheck></o:updatecheck>\n"),
string::npos);
EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""),
string::npos);
@@ -584,8 +589,9 @@
&post_data));
// convert post_data to string
string post_str(&post_data[0], post_data.size());
- EXPECT_NE(post_str.find(" <o:ping a=\"-1\" r=\"-1\"></o:ping>\n"
- " <o:updatecheck></o:updatecheck>\n"),
+ EXPECT_NE(post_str.find(
+ " <o:ping active=\"1\" a=\"-1\" r=\"-1\"></o:ping>\n"
+ " <o:updatecheck></o:updatecheck>\n"),
string::npos);
EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""),
string::npos);
@@ -643,7 +649,8 @@
NULL,
new MockHttpFetcher(http_response.data(),
http_response.size(),
- NULL));
+ NULL),
+ false);
EXPECT_FALSE(update_check_action.IsEvent());
OmahaRequestAction event_action(
@@ -652,7 +659,8 @@
new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
new MockHttpFetcher(http_response.data(),
http_response.size(),
- NULL));
+ NULL),
+ false);
EXPECT_TRUE(event_action.IsEvent());
}
@@ -727,7 +735,8 @@
NULL,
&post_data));
string post_str(&post_data[0], post_data.size());
- EXPECT_NE(post_str.find("<o:ping a=\"6\" r=\"5\"></o:ping>"), string::npos);
+ EXPECT_NE(post_str.find("<o:ping active=\"1\" a=\"6\" r=\"5\"></o:ping>"),
+ string::npos);
}
TEST(OmahaRequestActionTest, ActivePingTest) {
@@ -749,7 +758,8 @@
NULL,
&post_data));
string post_str(&post_data[0], post_data.size());
- EXPECT_NE(post_str.find("<o:ping a=\"3\"></o:ping>"), string::npos);
+ EXPECT_NE(post_str.find("<o:ping active=\"1\" a=\"3\"></o:ping>"),
+ string::npos);
}
TEST(OmahaRequestActionTest, RollCallPingTest) {
@@ -771,7 +781,8 @@
NULL,
&post_data));
string post_str(&post_data[0], post_data.size());
- EXPECT_NE(post_str.find("<o:ping r=\"4\"></o:ping>\n"), string::npos);
+ EXPECT_NE(post_str.find("<o:ping active=\"1\" r=\"4\"></o:ping>\n"),
+ string::npos);
}
TEST(OmahaRequestActionTest, NoPingTest) {