Darin Petkov | a4a8a8c | 2010-07-15 22:21:12 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <string> |
| 6 | #include <vector> |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 7 | |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 8 | #include <glib.h> |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 9 | |
| 10 | #include "base/string_util.h" |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 11 | #include "base/time.h" |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 12 | #include "gtest/gtest.h" |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 13 | #include "update_engine/action_pipe.h" |
| 14 | #include "update_engine/mock_http_fetcher.h" |
| 15 | #include "update_engine/omaha_hash_calculator.h" |
| 16 | #include "update_engine/omaha_request_action.h" |
Darin Petkov | a4a8a8c | 2010-07-15 22:21:12 -0700 | [diff] [blame] | 17 | #include "update_engine/omaha_request_params.h" |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 18 | #include "update_engine/prefs_mock.h" |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 19 | #include "update_engine/test_utils.h" |
| 20 | |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 21 | using base::Time; |
| 22 | using base::TimeDelta; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 23 | using std::string; |
| 24 | using std::vector; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 25 | using testing::_; |
| 26 | using testing::AllOf; |
| 27 | using testing::Ge; |
| 28 | using testing::Le; |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 29 | using testing::NiceMock; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 30 | using testing::Return; |
| 31 | using testing::SetArgumentPointee; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 32 | |
| 33 | namespace chromeos_update_engine { |
| 34 | |
| 35 | class OmahaRequestActionTest : public ::testing::Test { }; |
| 36 | |
| 37 | namespace { |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 38 | const OmahaRequestParams kDefaultTestParams( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 39 | OmahaRequestParams::kOsPlatform, |
| 40 | OmahaRequestParams::kOsVersion, |
| 41 | "service_pack", |
| 42 | "x86-generic", |
| 43 | OmahaRequestParams::kAppId, |
| 44 | "0.1.0.0", |
| 45 | "en-US", |
| 46 | "unittest", |
Darin Petkov | fbb4009 | 2010-07-29 17:05:50 -0700 | [diff] [blame] | 47 | "OEM MODEL 09235 7471", |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 48 | false, // delta okay |
| 49 | "http://url"); |
| 50 | |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 51 | string GetNoUpdateResponse(const string& app_id) { |
| 52 | return string( |
| 53 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 54 | "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app " |
| 55 | "appid=\"") + app_id + "\" status=\"ok\"><ping " |
| 56 | "status=\"ok\"/><updatecheck status=\"noupdate\"/></app></gupdate>"; |
| 57 | } |
| 58 | |
| 59 | string GetUpdateResponse(const string& app_id, |
| 60 | const string& display_version, |
| 61 | const string& more_info_url, |
| 62 | const string& prompt, |
| 63 | const string& codebase, |
| 64 | const string& hash, |
| 65 | const string& needsadmin, |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 66 | const string& size, |
| 67 | const string& deadline) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 68 | return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 69 | "xmlns=\"http://www.google.com/update2/response\" " |
| 70 | "protocol=\"2.0\"><app " |
| 71 | "appid=\"") + app_id + "\" status=\"ok\"><ping " |
| 72 | "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" " |
| 73 | "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" " |
Andrew de los Reyes | 3270f74 | 2010-07-15 22:28:14 -0700 | [diff] [blame] | 74 | "IsDelta=\"true\" " |
Darin Petkov | d22cb29 | 2010-09-29 10:02:29 -0700 | [diff] [blame] | 75 | "codebase=\"" + codebase + "\" hash=\"not-applicable\" " |
| 76 | "sha256=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" " |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 77 | "size=\"" + size + "\" deadline=\"" + deadline + |
| 78 | "\" status=\"ok\"/></app></gupdate>"; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate { |
| 82 | public: |
| 83 | OmahaRequestActionTestProcessorDelegate() |
| 84 | : loop_(NULL), |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 85 | expected_code_(kActionCodeSuccess) {} |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 86 | virtual ~OmahaRequestActionTestProcessorDelegate() { |
| 87 | } |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 88 | virtual void ProcessingDone(const ActionProcessor* processor, |
| 89 | ActionExitCode code) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 90 | ASSERT_TRUE(loop_); |
| 91 | g_main_loop_quit(loop_); |
| 92 | } |
| 93 | |
| 94 | virtual void ActionCompleted(ActionProcessor* processor, |
| 95 | AbstractAction* action, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 96 | ActionExitCode code) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 97 | // make sure actions always succeed |
| 98 | if (action->Type() == OmahaRequestAction::StaticType()) |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 99 | EXPECT_EQ(expected_code_, code); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 100 | else |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 101 | EXPECT_EQ(kActionCodeSuccess, code); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 102 | } |
| 103 | GMainLoop *loop_; |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 104 | ActionExitCode expected_code_; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | gboolean StartProcessorInRunLoop(gpointer data) { |
| 108 | ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data); |
| 109 | processor->StartProcessing(); |
| 110 | return FALSE; |
| 111 | } |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 112 | } // namespace {} |
| 113 | |
| 114 | class OutputObjectCollectorAction; |
| 115 | |
| 116 | template<> |
| 117 | class ActionTraits<OutputObjectCollectorAction> { |
| 118 | public: |
| 119 | // Does not take an object for input |
| 120 | typedef OmahaResponse InputObjectType; |
| 121 | // On success, puts the output path on output |
| 122 | typedef NoneType OutputObjectType; |
| 123 | }; |
| 124 | |
| 125 | class OutputObjectCollectorAction : public Action<OutputObjectCollectorAction> { |
| 126 | public: |
| 127 | OutputObjectCollectorAction() : has_input_object_(false) {} |
| 128 | void PerformAction() { |
| 129 | // copy input object |
| 130 | has_input_object_ = HasInputObject(); |
| 131 | if (has_input_object_) |
| 132 | omaha_response_ = GetInputObject(); |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 133 | processor_->ActionComplete(this, kActionCodeSuccess); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 134 | } |
| 135 | // Should never be called |
| 136 | void TerminateProcessing() { |
| 137 | CHECK(false); |
| 138 | } |
| 139 | // Debugging/logging |
| 140 | static std::string StaticType() { |
| 141 | return "OutputObjectCollectorAction"; |
| 142 | } |
| 143 | std::string Type() const { return StaticType(); } |
| 144 | bool has_input_object_; |
| 145 | OmahaResponse omaha_response_; |
| 146 | }; |
| 147 | |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 148 | // Returns true iff an output response was obtained from the |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 149 | // OmahaRequestAction. |prefs| may be NULL, in which case a local PrefsMock is |
| 150 | // used. out_response may be NULL. If |fail_http_response_code| is |
| 151 | // non-negative, the transfer will fail with that code. out_post_data may be |
| 152 | // null; if non-null, the post-data received by the mock HttpFetcher is |
| 153 | // returned. |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 154 | bool TestUpdateCheck(PrefsInterface* prefs, |
| 155 | const OmahaRequestParams& params, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 156 | const string& http_response, |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 157 | int fail_http_response_code, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 158 | ActionExitCode expected_code, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 159 | OmahaResponse* out_response, |
| 160 | vector<char>* out_post_data) { |
| 161 | GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); |
| 162 | MockHttpFetcher* fetcher = new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 163 | http_response.size(), |
| 164 | NULL); |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 165 | if (fail_http_response_code >= 0) { |
| 166 | fetcher->FailTransfer(fail_http_response_code); |
| 167 | } |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 168 | NiceMock<PrefsMock> local_prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 169 | OmahaRequestAction action(prefs ? prefs : &local_prefs, |
| 170 | params, |
| 171 | NULL, |
| 172 | fetcher); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 173 | OmahaRequestActionTestProcessorDelegate delegate; |
| 174 | delegate.loop_ = loop; |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 175 | delegate.expected_code_ = expected_code; |
Darin Petkov | a4a8a8c | 2010-07-15 22:21:12 -0700 | [diff] [blame] | 176 | |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 177 | ActionProcessor processor; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 178 | processor.set_delegate(&delegate); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 179 | processor.EnqueueAction(&action); |
| 180 | |
| 181 | OutputObjectCollectorAction collector_action; |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 182 | BondActions(&action, &collector_action); |
| 183 | processor.EnqueueAction(&collector_action); |
| 184 | |
| 185 | g_timeout_add(0, &StartProcessorInRunLoop, &processor); |
| 186 | g_main_loop_run(loop); |
| 187 | g_main_loop_unref(loop); |
| 188 | if (collector_action.has_input_object_ && out_response) |
| 189 | *out_response = collector_action.omaha_response_; |
| 190 | if (out_post_data) |
| 191 | *out_post_data = fetcher->post_data(); |
| 192 | return collector_action.has_input_object_; |
| 193 | } |
| 194 | |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 195 | // Tests Event requests -- they should always succeed. |out_post_data| |
| 196 | // may be null; if non-null, the post-data received by the mock |
| 197 | // HttpFetcher is returned. |
| 198 | void TestEvent(const OmahaRequestParams& params, |
| 199 | OmahaEvent* event, |
| 200 | const string& http_response, |
| 201 | vector<char>* out_post_data) { |
| 202 | GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); |
| 203 | MockHttpFetcher* fetcher = new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 204 | http_response.size(), |
| 205 | NULL); |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 206 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 207 | OmahaRequestAction action(&prefs, params, event, fetcher); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 208 | OmahaRequestActionTestProcessorDelegate delegate; |
| 209 | delegate.loop_ = loop; |
| 210 | ActionProcessor processor; |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 211 | processor.set_delegate(&delegate); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 212 | processor.EnqueueAction(&action); |
| 213 | |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 214 | g_timeout_add(0, &StartProcessorInRunLoop, &processor); |
| 215 | g_main_loop_run(loop); |
| 216 | g_main_loop_unref(loop); |
| 217 | if (out_post_data) |
| 218 | *out_post_data = fetcher->post_data(); |
| 219 | } |
| 220 | |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 221 | TEST(OmahaRequestActionTest, NoUpdateTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 222 | OmahaResponse response; |
| 223 | ASSERT_TRUE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 224 | TestUpdateCheck(NULL, // prefs |
| 225 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 226 | GetNoUpdateResponse(OmahaRequestParams::kAppId), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 227 | -1, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 228 | kActionCodeSuccess, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 229 | &response, |
| 230 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 231 | EXPECT_FALSE(response.update_exists); |
| 232 | } |
| 233 | |
| 234 | TEST(OmahaRequestActionTest, ValidUpdateTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 235 | OmahaResponse response; |
| 236 | ASSERT_TRUE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 237 | TestUpdateCheck(NULL, // prefs |
| 238 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 239 | GetUpdateResponse(OmahaRequestParams::kAppId, |
| 240 | "1.2.3.4", // version |
| 241 | "http://more/info", |
| 242 | "true", // prompt |
| 243 | "http://code/base", // dl url |
| 244 | "HASH1234=", // checksum |
| 245 | "false", // needs admin |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 246 | "123", // size |
| 247 | "20101020"), // deadline |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 248 | -1, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 249 | kActionCodeSuccess, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 250 | &response, |
| 251 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 252 | EXPECT_TRUE(response.update_exists); |
| 253 | EXPECT_EQ("1.2.3.4", response.display_version); |
| 254 | EXPECT_EQ("http://code/base", response.codebase); |
| 255 | EXPECT_EQ("http://more/info", response.more_info_url); |
Andrew de los Reyes | 3270f74 | 2010-07-15 22:28:14 -0700 | [diff] [blame] | 256 | EXPECT_TRUE(response.is_delta); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 257 | EXPECT_EQ("HASH1234=", response.hash); |
| 258 | EXPECT_EQ(123, response.size); |
| 259 | EXPECT_FALSE(response.needs_admin); |
| 260 | EXPECT_TRUE(response.prompt); |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 261 | EXPECT_EQ("20101020", response.deadline); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | TEST(OmahaRequestActionTest, NoOutputPipeTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 265 | const string http_response(GetNoUpdateResponse(OmahaRequestParams::kAppId)); |
| 266 | |
| 267 | GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE); |
| 268 | |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 269 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 270 | OmahaRequestAction action(&prefs, kDefaultTestParams, NULL, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 271 | new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 272 | http_response.size(), |
| 273 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 274 | OmahaRequestActionTestProcessorDelegate delegate; |
| 275 | delegate.loop_ = loop; |
| 276 | ActionProcessor processor; |
| 277 | processor.set_delegate(&delegate); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 278 | processor.EnqueueAction(&action); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 279 | |
| 280 | g_timeout_add(0, &StartProcessorInRunLoop, &processor); |
| 281 | g_main_loop_run(loop); |
| 282 | g_main_loop_unref(loop); |
| 283 | EXPECT_FALSE(processor.IsRunning()); |
| 284 | } |
| 285 | |
| 286 | TEST(OmahaRequestActionTest, InvalidXmlTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 287 | OmahaResponse response; |
| 288 | ASSERT_FALSE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 289 | TestUpdateCheck(NULL, // prefs |
| 290 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 291 | "invalid xml>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 292 | -1, |
| 293 | kActionCodeOmahaRequestXMLParseError, |
| 294 | &response, |
| 295 | NULL)); |
| 296 | EXPECT_FALSE(response.update_exists); |
| 297 | } |
| 298 | |
| 299 | TEST(OmahaRequestActionTest, EmptyResponseTest) { |
| 300 | OmahaResponse response; |
| 301 | ASSERT_FALSE( |
| 302 | TestUpdateCheck(NULL, // prefs |
| 303 | kDefaultTestParams, |
| 304 | "", |
| 305 | -1, |
| 306 | kActionCodeOmahaRequestEmptyResponseError, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 307 | &response, |
| 308 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 309 | EXPECT_FALSE(response.update_exists); |
| 310 | } |
| 311 | |
| 312 | TEST(OmahaRequestActionTest, MissingStatusTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 313 | OmahaResponse response; |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 314 | ASSERT_FALSE(TestUpdateCheck( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 315 | NULL, // prefs |
| 316 | kDefaultTestParams, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 317 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 318 | "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app " |
| 319 | "appid=\"foo\" status=\"ok\"><ping " |
| 320 | "status=\"ok\"/><updatecheck/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 321 | -1, |
| 322 | kActionCodeOmahaRequestNoUpdateCheckStatus, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 323 | &response, |
| 324 | NULL)); |
| 325 | EXPECT_FALSE(response.update_exists); |
| 326 | } |
| 327 | |
| 328 | TEST(OmahaRequestActionTest, InvalidStatusTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 329 | OmahaResponse response; |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 330 | ASSERT_FALSE(TestUpdateCheck( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 331 | NULL, // prefs |
| 332 | kDefaultTestParams, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 333 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 334 | "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app " |
| 335 | "appid=\"foo\" status=\"ok\"><ping " |
| 336 | "status=\"ok\"/><updatecheck status=\"foo\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 337 | -1, |
| 338 | kActionCodeOmahaRequestBadUpdateCheckStatus, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 339 | &response, |
| 340 | NULL)); |
| 341 | EXPECT_FALSE(response.update_exists); |
| 342 | } |
| 343 | |
| 344 | TEST(OmahaRequestActionTest, MissingNodesetTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 345 | OmahaResponse response; |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 346 | ASSERT_FALSE(TestUpdateCheck( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 347 | NULL, // prefs |
| 348 | kDefaultTestParams, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 349 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 350 | "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app " |
| 351 | "appid=\"foo\" status=\"ok\"><ping " |
| 352 | "status=\"ok\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 353 | -1, |
| 354 | kActionCodeOmahaRequestNoUpdateCheckNode, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 355 | &response, |
| 356 | NULL)); |
| 357 | EXPECT_FALSE(response.update_exists); |
| 358 | } |
| 359 | |
| 360 | TEST(OmahaRequestActionTest, MissingFieldTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 361 | OmahaResponse response; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 362 | ASSERT_TRUE(TestUpdateCheck(NULL, // prefs |
| 363 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 364 | string("<?xml version=\"1.0\" " |
| 365 | "encoding=\"UTF-8\"?><gupdate " |
| 366 | "xmlns=\"http://www.google.com/" |
| 367 | "update2/response\" " |
| 368 | "protocol=\"2.0\"><app appid=\"") + |
| 369 | OmahaRequestParams::kAppId |
| 370 | + "\" status=\"ok\"><ping " |
| 371 | "status=\"ok\"/><updatecheck " |
| 372 | "DisplayVersion=\"1.2.3.4\" " |
| 373 | "Prompt=\"false\" " |
Darin Petkov | d22cb29 | 2010-09-29 10:02:29 -0700 | [diff] [blame] | 374 | "codebase=\"http://code/base\" hash=\"foo\" " |
| 375 | "sha256=\"HASH1234=\" needsadmin=\"true\" " |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 376 | "size=\"123\" " |
| 377 | "status=\"ok\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 378 | -1, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 379 | kActionCodeSuccess, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 380 | &response, |
| 381 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 382 | EXPECT_TRUE(response.update_exists); |
| 383 | EXPECT_EQ("1.2.3.4", response.display_version); |
| 384 | EXPECT_EQ("http://code/base", response.codebase); |
| 385 | EXPECT_EQ("", response.more_info_url); |
Andrew de los Reyes | 3270f74 | 2010-07-15 22:28:14 -0700 | [diff] [blame] | 386 | EXPECT_FALSE(response.is_delta); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 387 | EXPECT_EQ("HASH1234=", response.hash); |
| 388 | EXPECT_EQ(123, response.size); |
| 389 | EXPECT_TRUE(response.needs_admin); |
| 390 | EXPECT_FALSE(response.prompt); |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 391 | EXPECT_TRUE(response.deadline.empty()); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | namespace { |
| 395 | class TerminateEarlyTestProcessorDelegate : public ActionProcessorDelegate { |
| 396 | public: |
| 397 | void ProcessingStopped(const ActionProcessor* processor) { |
| 398 | ASSERT_TRUE(loop_); |
| 399 | g_main_loop_quit(loop_); |
| 400 | } |
| 401 | GMainLoop *loop_; |
| 402 | }; |
| 403 | |
| 404 | gboolean TerminateTransferTestStarter(gpointer data) { |
| 405 | ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data); |
| 406 | processor->StartProcessing(); |
| 407 | CHECK(processor->IsRunning()); |
| 408 | processor->StopProcessing(); |
| 409 | return FALSE; |
| 410 | } |
| 411 | } // namespace {} |
| 412 | |
| 413 | TEST(OmahaRequestActionTest, TerminateTransferTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 414 | string http_response("doesn't matter"); |
| 415 | GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE); |
| 416 | |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 417 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 418 | OmahaRequestAction action(&prefs, kDefaultTestParams, NULL, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 419 | new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 420 | http_response.size(), |
| 421 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 422 | TerminateEarlyTestProcessorDelegate delegate; |
| 423 | delegate.loop_ = loop; |
| 424 | ActionProcessor processor; |
| 425 | processor.set_delegate(&delegate); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 426 | processor.EnqueueAction(&action); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 427 | |
| 428 | g_timeout_add(0, &TerminateTransferTestStarter, &processor); |
| 429 | g_main_loop_run(loop); |
| 430 | g_main_loop_unref(loop); |
| 431 | } |
| 432 | |
| 433 | TEST(OmahaRequestActionTest, XmlEncodeTest) { |
| 434 | EXPECT_EQ("ab", XmlEncode("ab")); |
| 435 | EXPECT_EQ("a<b", XmlEncode("a<b")); |
| 436 | EXPECT_EQ("foo-Ω", XmlEncode("foo-\xce\xa9")); |
| 437 | EXPECT_EQ("<&>", XmlEncode("<&>")); |
| 438 | EXPECT_EQ("&lt;&amp;&gt;", XmlEncode("<&>")); |
| 439 | |
| 440 | vector<char> post_data; |
| 441 | |
| 442 | // Make sure XML Encode is being called on the params |
Darin Petkov | 84c763c | 2010-07-29 16:27:58 -0700 | [diff] [blame] | 443 | OmahaRequestParams params(OmahaRequestParams::kOsPlatform, |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 444 | OmahaRequestParams::kOsVersion, |
| 445 | "testtheservice_pack>", |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 446 | "x86 generic<id", |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 447 | OmahaRequestParams::kAppId, |
| 448 | "0.1.0.0", |
| 449 | "en-US", |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 450 | "unittest_track<", |
Darin Petkov | fbb4009 | 2010-07-29 17:05:50 -0700 | [diff] [blame] | 451 | "<OEM MODEL>", |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 452 | false, // delta okay |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 453 | "http://url"); |
| 454 | OmahaResponse response; |
| 455 | ASSERT_FALSE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 456 | TestUpdateCheck(NULL, // prefs |
| 457 | params, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 458 | "invalid xml>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 459 | -1, |
| 460 | kActionCodeOmahaRequestXMLParseError, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 461 | &response, |
| 462 | &post_data)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 463 | // convert post_data to string |
| 464 | string post_str(&post_data[0], post_data.size()); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 465 | EXPECT_NE(post_str.find("testtheservice_pack>"), string::npos); |
| 466 | EXPECT_EQ(post_str.find("testtheservice_pack>"), string::npos); |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 467 | EXPECT_NE(post_str.find("x86 generic<id"), string::npos); |
| 468 | EXPECT_EQ(post_str.find("x86 generic<id"), string::npos); |
| 469 | EXPECT_NE(post_str.find("unittest_track&lt;"), string::npos); |
| 470 | EXPECT_EQ(post_str.find("unittest_track<"), string::npos); |
Darin Petkov | fbb4009 | 2010-07-29 17:05:50 -0700 | [diff] [blame] | 471 | EXPECT_NE(post_str.find("<OEM MODEL>"), string::npos); |
| 472 | EXPECT_EQ(post_str.find("<OEM MODEL>"), string::npos); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | TEST(OmahaRequestActionTest, XmlDecodeTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 476 | OmahaResponse response; |
| 477 | ASSERT_TRUE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 478 | TestUpdateCheck(NULL, // prefs |
| 479 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 480 | GetUpdateResponse(OmahaRequestParams::kAppId, |
| 481 | "1.2.3.4", // version |
| 482 | "testthe<url", // more info |
| 483 | "true", // prompt |
| 484 | "testthe&codebase", // dl url |
| 485 | "HASH1234=", // checksum |
| 486 | "false", // needs admin |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 487 | "123", // size |
| 488 | "<20110101"), // deadline |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 489 | -1, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 490 | kActionCodeSuccess, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 491 | &response, |
| 492 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 493 | |
| 494 | EXPECT_EQ(response.more_info_url, "testthe<url"); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 495 | EXPECT_EQ(response.codebase, "testthe&codebase"); |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 496 | EXPECT_EQ(response.deadline, "<20110101"); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | TEST(OmahaRequestActionTest, ParseIntTest) { |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 500 | OmahaResponse response; |
| 501 | ASSERT_TRUE( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 502 | TestUpdateCheck(NULL, // prefs |
| 503 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 504 | GetUpdateResponse(OmahaRequestParams::kAppId, |
| 505 | "1.2.3.4", // version |
| 506 | "theurl", // more info |
| 507 | "true", // prompt |
| 508 | "thecodebase", // dl url |
| 509 | "HASH1234=", // checksum |
| 510 | "false", // needs admin |
| 511 | // overflows int32: |
Darin Petkov | 6c11864 | 2010-10-21 12:06:30 -0700 | [diff] [blame] | 512 | "123123123123123", // size |
| 513 | "deadline"), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 514 | -1, |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 515 | kActionCodeSuccess, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 516 | &response, |
| 517 | NULL)); |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 518 | |
| 519 | EXPECT_EQ(response.size, 123123123123123ll); |
| 520 | } |
| 521 | |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 522 | TEST(OmahaRequestActionTest, FormatUpdateCheckOutputTest) { |
| 523 | vector<char> post_data; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 524 | ASSERT_FALSE(TestUpdateCheck(NULL, // prefs |
| 525 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 526 | "invalid xml>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 527 | -1, |
| 528 | kActionCodeOmahaRequestXMLParseError, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 529 | NULL, // response |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 530 | &post_data)); |
| 531 | // convert post_data to string |
| 532 | string post_str(&post_data[0], post_data.size()); |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 533 | EXPECT_NE(post_str.find(" <o:ping a=\"-1\" r=\"-1\"></o:ping>\n" |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 534 | " <o:updatecheck></o:updatecheck>\n"), |
| 535 | string::npos); |
Darin Petkov | fbb4009 | 2010-07-29 17:05:50 -0700 | [diff] [blame] | 536 | EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""), |
| 537 | string::npos); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 538 | EXPECT_EQ(post_str.find("o:event"), string::npos); |
| 539 | } |
| 540 | |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 541 | TEST(OmahaRequestActionTest, FormatSuccessEventOutputTest) { |
| 542 | vector<char> post_data; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 543 | TestEvent(kDefaultTestParams, |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 544 | new OmahaEvent(OmahaEvent::kTypeUpdateDownloadStarted), |
| 545 | "invalid xml>", |
| 546 | &post_data); |
| 547 | // convert post_data to string |
| 548 | string post_str(&post_data[0], post_data.size()); |
| 549 | string expected_event = StringPrintf( |
| 550 | " <o:event eventtype=\"%d\" eventresult=\"%d\"></o:event>\n", |
| 551 | OmahaEvent::kTypeUpdateDownloadStarted, |
| 552 | OmahaEvent::kResultSuccess); |
| 553 | EXPECT_NE(post_str.find(expected_event), string::npos); |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 554 | EXPECT_EQ(post_str.find("o:ping"), string::npos); |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 555 | EXPECT_EQ(post_str.find("o:updatecheck"), string::npos); |
| 556 | } |
| 557 | |
| 558 | TEST(OmahaRequestActionTest, FormatErrorEventOutputTest) { |
| 559 | vector<char> post_data; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 560 | TestEvent(kDefaultTestParams, |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 561 | new OmahaEvent(OmahaEvent::kTypeDownloadComplete, |
| 562 | OmahaEvent::kResultError, |
| 563 | kActionCodeError), |
| 564 | "invalid xml>", |
| 565 | &post_data); |
| 566 | // convert post_data to string |
| 567 | string post_str(&post_data[0], post_data.size()); |
| 568 | string expected_event = StringPrintf( |
| 569 | " <o:event eventtype=\"%d\" eventresult=\"%d\" " |
| 570 | "errorcode=\"%d\"></o:event>\n", |
| 571 | OmahaEvent::kTypeDownloadComplete, |
| 572 | OmahaEvent::kResultError, |
| 573 | kActionCodeError); |
| 574 | EXPECT_NE(post_str.find(expected_event), string::npos); |
| 575 | EXPECT_EQ(post_str.find("o:updatecheck"), string::npos); |
| 576 | } |
| 577 | |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 578 | TEST(OmahaRequestActionTest, FormatEventOutputTest) { |
| 579 | vector<char> post_data; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 580 | TestEvent(kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 581 | new OmahaEvent(OmahaEvent::kTypeDownloadComplete, |
| 582 | OmahaEvent::kResultError, |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 583 | kActionCodeError), |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 584 | "invalid xml>", |
| 585 | &post_data); |
| 586 | // convert post_data to string |
| 587 | string post_str(&post_data[0], post_data.size()); |
| 588 | string expected_event = StringPrintf( |
| 589 | " <o:event eventtype=\"%d\" eventresult=\"%d\" " |
| 590 | "errorcode=\"%d\"></o:event>\n", |
| 591 | OmahaEvent::kTypeDownloadComplete, |
| 592 | OmahaEvent::kResultError, |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 593 | kActionCodeError); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 594 | EXPECT_NE(post_str.find(expected_event), string::npos); |
| 595 | EXPECT_EQ(post_str.find("o:updatecheck"), string::npos); |
| 596 | } |
| 597 | |
| 598 | TEST(OmahaRequestActionTest, IsEventTest) { |
| 599 | string http_response("doesn't matter"); |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 600 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 601 | OmahaRequestAction update_check_action( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 602 | &prefs, |
| 603 | kDefaultTestParams, |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 604 | NULL, |
| 605 | new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 606 | http_response.size(), |
| 607 | NULL)); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 608 | EXPECT_FALSE(update_check_action.IsEvent()); |
| 609 | |
| 610 | OmahaRequestAction event_action( |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 611 | &prefs, |
| 612 | kDefaultTestParams, |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 613 | new OmahaEvent(OmahaEvent::kTypeUpdateComplete), |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 614 | new MockHttpFetcher(http_response.data(), |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame^] | 615 | http_response.size(), |
| 616 | NULL)); |
Darin Petkov | 0dc8e9a | 2010-07-14 14:51:57 -0700 | [diff] [blame] | 617 | EXPECT_TRUE(event_action.IsEvent()); |
| 618 | } |
| 619 | |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 620 | TEST(OmahaRequestActionTest, FormatDeltaOkayOutputTest) { |
| 621 | for (int i = 0; i < 2; i++) { |
| 622 | bool delta_okay = i == 1; |
| 623 | const char* delta_okay_str = delta_okay ? "true" : "false"; |
| 624 | vector<char> post_data; |
Darin Petkov | 84c763c | 2010-07-29 16:27:58 -0700 | [diff] [blame] | 625 | OmahaRequestParams params(OmahaRequestParams::kOsPlatform, |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 626 | OmahaRequestParams::kOsVersion, |
| 627 | "service_pack", |
| 628 | "x86-generic", |
| 629 | OmahaRequestParams::kAppId, |
| 630 | "0.1.0.0", |
| 631 | "en-US", |
| 632 | "unittest_track", |
Darin Petkov | fbb4009 | 2010-07-29 17:05:50 -0700 | [diff] [blame] | 633 | "OEM MODEL REV 1234", |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 634 | delta_okay, |
| 635 | "http://url"); |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 636 | ASSERT_FALSE(TestUpdateCheck(NULL, // prefs |
| 637 | params, |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 638 | "invalid xml>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 639 | -1, |
| 640 | kActionCodeOmahaRequestXMLParseError, |
Andrew de los Reyes | 3f0303a | 2010-07-15 22:35:35 -0700 | [diff] [blame] | 641 | NULL, |
| 642 | &post_data)); |
| 643 | // convert post_data to string |
| 644 | string post_str(&post_data[0], post_data.size()); |
| 645 | EXPECT_NE(post_str.find(StringPrintf(" delta_okay=\"%s\"", delta_okay_str)), |
| 646 | string::npos) |
| 647 | << "i = " << i; |
| 648 | } |
| 649 | } |
| 650 | |
Darin Petkov | e17f86b | 2010-07-20 09:12:01 -0700 | [diff] [blame] | 651 | TEST(OmahaRequestActionTest, OmahaEventTest) { |
| 652 | OmahaEvent default_event; |
| 653 | EXPECT_EQ(OmahaEvent::kTypeUnknown, default_event.type); |
| 654 | EXPECT_EQ(OmahaEvent::kResultError, default_event.result); |
| 655 | EXPECT_EQ(kActionCodeError, default_event.error_code); |
| 656 | |
| 657 | OmahaEvent success_event(OmahaEvent::kTypeUpdateDownloadStarted); |
| 658 | EXPECT_EQ(OmahaEvent::kTypeUpdateDownloadStarted, success_event.type); |
| 659 | EXPECT_EQ(OmahaEvent::kResultSuccess, success_event.result); |
| 660 | EXPECT_EQ(kActionCodeSuccess, success_event.error_code); |
| 661 | |
| 662 | OmahaEvent error_event(OmahaEvent::kTypeUpdateDownloadFinished, |
| 663 | OmahaEvent::kResultError, |
| 664 | kActionCodeError); |
| 665 | EXPECT_EQ(OmahaEvent::kTypeUpdateDownloadFinished, error_event.type); |
| 666 | EXPECT_EQ(OmahaEvent::kResultError, error_event.result); |
| 667 | EXPECT_EQ(kActionCodeError, error_event.error_code); |
| 668 | } |
| 669 | |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 670 | TEST(OmahaRequestActionTest, PingTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 671 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 672 | // Add a few hours to the day difference to test no rounding, etc. |
| 673 | int64_t five_days_ago = |
| 674 | (Time::Now() - TimeDelta::FromHours(5 * 24 + 13)).ToInternalValue(); |
| 675 | int64_t six_days_ago = |
| 676 | (Time::Now() - TimeDelta::FromHours(6 * 24 + 11)).ToInternalValue(); |
| 677 | EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _)) |
| 678 | .WillOnce(DoAll(SetArgumentPointee<1>(six_days_ago), Return(true))); |
| 679 | EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _)) |
| 680 | .WillOnce(DoAll(SetArgumentPointee<1>(five_days_ago), Return(true))); |
| 681 | vector<char> post_data; |
| 682 | ASSERT_TRUE( |
| 683 | TestUpdateCheck(&prefs, |
| 684 | kDefaultTestParams, |
| 685 | GetNoUpdateResponse(OmahaRequestParams::kAppId), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 686 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 687 | kActionCodeSuccess, |
| 688 | NULL, |
| 689 | &post_data)); |
| 690 | string post_str(&post_data[0], post_data.size()); |
| 691 | EXPECT_NE(post_str.find("<o:ping a=\"6\" r=\"5\"></o:ping>"), string::npos); |
| 692 | } |
| 693 | |
| 694 | TEST(OmahaRequestActionTest, ActivePingTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 695 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 696 | int64_t three_days_ago = |
| 697 | (Time::Now() - TimeDelta::FromHours(3 * 24 + 12)).ToInternalValue(); |
| 698 | int64_t now = Time::Now().ToInternalValue(); |
| 699 | EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _)) |
| 700 | .WillOnce(DoAll(SetArgumentPointee<1>(three_days_ago), Return(true))); |
| 701 | EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _)) |
| 702 | .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true))); |
| 703 | vector<char> post_data; |
| 704 | ASSERT_TRUE( |
| 705 | TestUpdateCheck(&prefs, |
| 706 | kDefaultTestParams, |
| 707 | GetNoUpdateResponse(OmahaRequestParams::kAppId), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 708 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 709 | kActionCodeSuccess, |
| 710 | NULL, |
| 711 | &post_data)); |
| 712 | string post_str(&post_data[0], post_data.size()); |
| 713 | EXPECT_NE(post_str.find("<o:ping a=\"3\"></o:ping>"), string::npos); |
| 714 | } |
| 715 | |
| 716 | TEST(OmahaRequestActionTest, RollCallPingTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 717 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 718 | int64_t four_days_ago = |
| 719 | (Time::Now() - TimeDelta::FromHours(4 * 24)).ToInternalValue(); |
| 720 | int64_t now = Time::Now().ToInternalValue(); |
| 721 | EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _)) |
| 722 | .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true))); |
| 723 | EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _)) |
| 724 | .WillOnce(DoAll(SetArgumentPointee<1>(four_days_ago), Return(true))); |
| 725 | vector<char> post_data; |
| 726 | ASSERT_TRUE( |
| 727 | TestUpdateCheck(&prefs, |
| 728 | kDefaultTestParams, |
| 729 | GetNoUpdateResponse(OmahaRequestParams::kAppId), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 730 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 731 | kActionCodeSuccess, |
| 732 | NULL, |
| 733 | &post_data)); |
| 734 | string post_str(&post_data[0], post_data.size()); |
| 735 | EXPECT_NE(post_str.find("<o:ping r=\"4\"></o:ping>\n"), string::npos); |
| 736 | } |
| 737 | |
| 738 | TEST(OmahaRequestActionTest, NoPingTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 739 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 740 | int64_t one_hour_ago = |
| 741 | (Time::Now() - TimeDelta::FromHours(1)).ToInternalValue(); |
| 742 | EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _)) |
| 743 | .WillOnce(DoAll(SetArgumentPointee<1>(one_hour_ago), Return(true))); |
| 744 | EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _)) |
| 745 | .WillOnce(DoAll(SetArgumentPointee<1>(one_hour_ago), Return(true))); |
| 746 | EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _)).Times(0); |
| 747 | EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _)).Times(0); |
| 748 | vector<char> post_data; |
| 749 | ASSERT_TRUE( |
| 750 | TestUpdateCheck(&prefs, |
| 751 | kDefaultTestParams, |
| 752 | GetNoUpdateResponse(OmahaRequestParams::kAppId), |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 753 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 754 | kActionCodeSuccess, |
| 755 | NULL, |
| 756 | &post_data)); |
| 757 | string post_str(&post_data[0], post_data.size()); |
| 758 | EXPECT_EQ(post_str.find("o:ping"), string::npos); |
| 759 | } |
| 760 | |
| 761 | TEST(OmahaRequestActionTest, BackInTimePingTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 762 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 763 | int64_t future = |
| 764 | (Time::Now() + TimeDelta::FromHours(3 * 24 + 4)).ToInternalValue(); |
| 765 | EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _)) |
| 766 | .WillOnce(DoAll(SetArgumentPointee<1>(future), Return(true))); |
| 767 | EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _)) |
| 768 | .WillOnce(DoAll(SetArgumentPointee<1>(future), Return(true))); |
| 769 | EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _)) |
| 770 | .WillOnce(Return(true)); |
| 771 | EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _)) |
| 772 | .WillOnce(Return(true)); |
| 773 | vector<char> post_data; |
| 774 | ASSERT_TRUE( |
| 775 | TestUpdateCheck(&prefs, |
| 776 | kDefaultTestParams, |
| 777 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 778 | "xmlns=\"http://www.google.com/update2/response\" " |
| 779 | "protocol=\"2.0\"><daystart elapsed_seconds=\"100\"/>" |
| 780 | "<app appid=\"foo\" status=\"ok\"><ping status=\"ok\"/>" |
| 781 | "<updatecheck status=\"noupdate\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 782 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 783 | kActionCodeSuccess, |
| 784 | NULL, |
| 785 | &post_data)); |
| 786 | string post_str(&post_data[0], post_data.size()); |
| 787 | EXPECT_EQ(post_str.find("o:ping"), string::npos); |
| 788 | } |
| 789 | |
| 790 | TEST(OmahaRequestActionTest, LastPingDayUpdateTest) { |
| 791 | // This test checks that the action updates the last ping day to now |
Darin Petkov | 84c763c | 2010-07-29 16:27:58 -0700 | [diff] [blame] | 792 | // minus 200 seconds with a slack of 5 seconds. Therefore, the test |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 793 | // may fail if it runs for longer than 5 seconds. It shouldn't run |
| 794 | // that long though. |
| 795 | int64_t midnight = |
| 796 | (Time::Now() - TimeDelta::FromSeconds(200)).ToInternalValue(); |
| 797 | int64_t midnight_slack = |
| 798 | (Time::Now() - TimeDelta::FromSeconds(195)).ToInternalValue(); |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 799 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 800 | EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, |
| 801 | AllOf(Ge(midnight), Le(midnight_slack)))) |
| 802 | .WillOnce(Return(true)); |
| 803 | EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, |
| 804 | AllOf(Ge(midnight), Le(midnight_slack)))) |
| 805 | .WillOnce(Return(true)); |
| 806 | ASSERT_TRUE( |
| 807 | TestUpdateCheck(&prefs, |
| 808 | kDefaultTestParams, |
| 809 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 810 | "xmlns=\"http://www.google.com/update2/response\" " |
| 811 | "protocol=\"2.0\"><daystart elapsed_seconds=\"200\"/>" |
| 812 | "<app appid=\"foo\" status=\"ok\"><ping status=\"ok\"/>" |
| 813 | "<updatecheck status=\"noupdate\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 814 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 815 | kActionCodeSuccess, |
| 816 | NULL, |
| 817 | NULL)); |
| 818 | } |
| 819 | |
| 820 | TEST(OmahaRequestActionTest, NoElapsedSecondsTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 821 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 822 | EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _)).Times(0); |
| 823 | EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _)).Times(0); |
| 824 | ASSERT_TRUE( |
| 825 | TestUpdateCheck(&prefs, |
| 826 | kDefaultTestParams, |
| 827 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 828 | "xmlns=\"http://www.google.com/update2/response\" " |
| 829 | "protocol=\"2.0\"><daystart blah=\"200\"/>" |
| 830 | "<app appid=\"foo\" status=\"ok\"><ping status=\"ok\"/>" |
| 831 | "<updatecheck status=\"noupdate\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 832 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 833 | kActionCodeSuccess, |
| 834 | NULL, |
| 835 | NULL)); |
| 836 | } |
| 837 | |
| 838 | TEST(OmahaRequestActionTest, BadElapsedSecondsTest) { |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 839 | NiceMock<PrefsMock> prefs; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 840 | EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _)).Times(0); |
| 841 | EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _)).Times(0); |
| 842 | ASSERT_TRUE( |
| 843 | TestUpdateCheck(&prefs, |
| 844 | kDefaultTestParams, |
| 845 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " |
| 846 | "xmlns=\"http://www.google.com/update2/response\" " |
| 847 | "protocol=\"2.0\"><daystart elapsed_seconds=\"x\"/>" |
| 848 | "<app appid=\"foo\" status=\"ok\"><ping status=\"ok\"/>" |
| 849 | "<updatecheck status=\"noupdate\"/></app></gupdate>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 850 | -1, |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 851 | kActionCodeSuccess, |
| 852 | NULL, |
| 853 | NULL)); |
| 854 | } |
| 855 | |
Darin Petkov | 84c763c | 2010-07-29 16:27:58 -0700 | [diff] [blame] | 856 | TEST(OmahaRequestActionTest, NoUniqueIDTest) { |
| 857 | vector<char> post_data; |
| 858 | ASSERT_FALSE(TestUpdateCheck(NULL, // prefs |
| 859 | kDefaultTestParams, |
| 860 | "invalid xml>", |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 861 | -1, |
| 862 | kActionCodeOmahaRequestXMLParseError, |
Darin Petkov | 84c763c | 2010-07-29 16:27:58 -0700 | [diff] [blame] | 863 | NULL, // response |
| 864 | &post_data)); |
| 865 | // convert post_data to string |
| 866 | string post_str(&post_data[0], post_data.size()); |
| 867 | EXPECT_EQ(post_str.find("machineid="), string::npos); |
| 868 | EXPECT_EQ(post_str.find("userid="), string::npos); |
| 869 | } |
| 870 | |
Darin Petkov | edc522e | 2010-11-05 09:35:17 -0700 | [diff] [blame] | 871 | TEST(OmahaRequestActionTest, NetworkFailureTest) { |
| 872 | OmahaResponse response; |
| 873 | ASSERT_FALSE( |
| 874 | TestUpdateCheck(NULL, // prefs |
| 875 | kDefaultTestParams, |
| 876 | "", |
| 877 | 501, |
| 878 | static_cast<ActionExitCode>( |
| 879 | kActionCodeOmahaRequestHTTPResponseBase + 501), |
| 880 | &response, |
| 881 | NULL)); |
| 882 | EXPECT_FALSE(response.update_exists); |
| 883 | } |
| 884 | |
| 885 | TEST(OmahaRequestActionTest, NetworkFailureBadHTTPCodeTest) { |
| 886 | OmahaResponse response; |
| 887 | ASSERT_FALSE( |
| 888 | TestUpdateCheck(NULL, // prefs |
| 889 | kDefaultTestParams, |
| 890 | "", |
| 891 | 1500, |
| 892 | static_cast<ActionExitCode>( |
| 893 | kActionCodeOmahaRequestHTTPResponseBase + 999), |
| 894 | &response, |
| 895 | NULL)); |
| 896 | EXPECT_FALSE(response.update_exists); |
| 897 | } |
| 898 | |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 899 | } // namespace chromeos_update_engine |