Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: omaha_request_action_unittest.cc

Issue 2805027: AU: Changes for deltas on traditional bios machines. (Closed) Base URL: ssh://git@chromiumos-git/update_engine.git
Patch Set: fixes for review and merging in petkov's recent changes Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « omaha_request_action.cc ('k') | omaha_response_handler_action.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include <glib.h> 8 #include <glib.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 27 matching lines...) Expand all
38 const string& codebase, 38 const string& codebase,
39 const string& hash, 39 const string& hash,
40 const string& needsadmin, 40 const string& needsadmin,
41 const string& size) { 41 const string& size) {
42 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " 42 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
43 "xmlns=\"http://www.google.com/update2/response\" " 43 "xmlns=\"http://www.google.com/update2/response\" "
44 "protocol=\"2.0\"><app " 44 "protocol=\"2.0\"><app "
45 "appid=\"") + app_id + "\" status=\"ok\"><ping " 45 "appid=\"") + app_id + "\" status=\"ok\"><ping "
46 "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" " 46 "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" "
47 "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" " 47 "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" "
48 "IsDelta=\"true\" "
48 "codebase=\"" + codebase + "\" " 49 "codebase=\"" + codebase + "\" "
49 "hash=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" " 50 "hash=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" "
50 "size=\"" + size + "\" status=\"ok\"/></app></gupdate>"; 51 "size=\"" + size + "\" status=\"ok\"/></app></gupdate>";
51 } 52 }
52 53
53 class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate { 54 class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate {
54 public: 55 public:
55 OmahaRequestActionTestProcessorDelegate() 56 OmahaRequestActionTestProcessorDelegate()
56 : loop_(NULL), 57 : loop_(NULL),
57 expected_success_(true) {} 58 expected_success_(true) {}
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 "HASH1234=", // checksum 231 "HASH1234=", // checksum
231 "false", // needs admin 232 "false", // needs admin
232 "123"), // size 233 "123"), // size
233 true, 234 true,
234 &response, 235 &response,
235 NULL)); 236 NULL));
236 EXPECT_TRUE(response.update_exists); 237 EXPECT_TRUE(response.update_exists);
237 EXPECT_EQ("1.2.3.4", response.display_version); 238 EXPECT_EQ("1.2.3.4", response.display_version);
238 EXPECT_EQ("http://code/base", response.codebase); 239 EXPECT_EQ("http://code/base", response.codebase);
239 EXPECT_EQ("http://more/info", response.more_info_url); 240 EXPECT_EQ("http://more/info", response.more_info_url);
241 EXPECT_TRUE(response.is_delta);
240 EXPECT_EQ("HASH1234=", response.hash); 242 EXPECT_EQ("HASH1234=", response.hash);
241 EXPECT_EQ(123, response.size); 243 EXPECT_EQ(123, response.size);
242 EXPECT_FALSE(response.needs_admin); 244 EXPECT_FALSE(response.needs_admin);
243 EXPECT_TRUE(response.prompt); 245 EXPECT_TRUE(response.prompt);
244 } 246 }
245 247
246 TEST(OmahaRequestActionTest, NoOutputPipeTest) { 248 TEST(OmahaRequestActionTest, NoOutputPipeTest) {
247 OmahaRequestParams params("", // machine_id 249 OmahaRequestParams params("", // machine_id
248 "", // usr_id 250 "", // usr_id
249 OmahaRequestParams::kOsPlatform, 251 OmahaRequestParams::kOsPlatform,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 "hash=\"HASH1234=\" needsadmin=\"true\" " 405 "hash=\"HASH1234=\" needsadmin=\"true\" "
404 "size=\"123\" " 406 "size=\"123\" "
405 "status=\"ok\"/></app></gupdate>", 407 "status=\"ok\"/></app></gupdate>",
406 true, 408 true,
407 &response, 409 &response,
408 NULL)); 410 NULL));
409 EXPECT_TRUE(response.update_exists); 411 EXPECT_TRUE(response.update_exists);
410 EXPECT_EQ("1.2.3.4", response.display_version); 412 EXPECT_EQ("1.2.3.4", response.display_version);
411 EXPECT_EQ("http://code/base", response.codebase); 413 EXPECT_EQ("http://code/base", response.codebase);
412 EXPECT_EQ("", response.more_info_url); 414 EXPECT_EQ("", response.more_info_url);
415 EXPECT_FALSE(response.is_delta);
413 EXPECT_EQ("HASH1234=", response.hash); 416 EXPECT_EQ("HASH1234=", response.hash);
414 EXPECT_EQ(123, response.size); 417 EXPECT_EQ(123, response.size);
415 EXPECT_TRUE(response.needs_admin); 418 EXPECT_TRUE(response.needs_admin);
416 EXPECT_FALSE(response.prompt); 419 EXPECT_FALSE(response.prompt);
417 } 420 }
418 421
419 namespace { 422 namespace {
420 class TerminateEarlyTestProcessorDelegate : public ActionProcessorDelegate { 423 class TerminateEarlyTestProcessorDelegate : public ActionProcessorDelegate {
421 public: 424 public:
422 void ProcessingStopped(const ActionProcessor* processor) { 425 void ProcessingStopped(const ActionProcessor* processor) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 OmahaRequestAction event_action( 642 OmahaRequestAction event_action(
640 new OmahaEvent(OmahaEvent::kTypeInstallComplete, 643 new OmahaEvent(OmahaEvent::kTypeInstallComplete,
641 OmahaEvent::kResultError, 644 OmahaEvent::kResultError,
642 0), 645 0),
643 new MockHttpFetcher(http_response.data(), 646 new MockHttpFetcher(http_response.data(),
644 http_response.size())); 647 http_response.size()));
645 EXPECT_TRUE(event_action.IsEvent()); 648 EXPECT_TRUE(event_action.IsEvent());
646 } 649 }
647 650
648 } // namespace chromeos_update_engine 651 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_action.cc ('k') | omaha_response_handler_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698