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

Side by Side Diff: omaha_request_action_unittest.cc

Issue 3419018: AU: Switch from SHA-1 to SHA-256 hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: update unit test Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « omaha_request_action.cc ('k') | payload_signer.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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const string& hash, 63 const string& hash,
64 const string& needsadmin, 64 const string& needsadmin,
65 const string& size) { 65 const string& size) {
66 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate " 66 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
67 "xmlns=\"http://www.google.com/update2/response\" " 67 "xmlns=\"http://www.google.com/update2/response\" "
68 "protocol=\"2.0\"><app " 68 "protocol=\"2.0\"><app "
69 "appid=\"") + app_id + "\" status=\"ok\"><ping " 69 "appid=\"") + app_id + "\" status=\"ok\"><ping "
70 "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" " 70 "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" "
71 "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" " 71 "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" "
72 "IsDelta=\"true\" " 72 "IsDelta=\"true\" "
73 "codebase=\"" + codebase + "\" " 73 "codebase=\"" + codebase + "\" hash=\"not-applicable\" "
74 "hash=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" " 74 "sha256=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" "
75 "size=\"" + size + "\" status=\"ok\"/></app></gupdate>"; 75 "size=\"" + size + "\" status=\"ok\"/></app></gupdate>";
76 } 76 }
77 77
78 class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate { 78 class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate {
79 public: 79 public:
80 OmahaRequestActionTestProcessorDelegate() 80 OmahaRequestActionTestProcessorDelegate()
81 : loop_(NULL), 81 : loop_(NULL),
82 expected_code_(kActionCodeSuccess) {} 82 expected_code_(kActionCodeSuccess) {}
83 virtual ~OmahaRequestActionTestProcessorDelegate() { 83 virtual ~OmahaRequestActionTestProcessorDelegate() {
84 } 84 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 string("<?xml version=\"1.0\" " 332 string("<?xml version=\"1.0\" "
333 "encoding=\"UTF-8\"?><gupdate " 333 "encoding=\"UTF-8\"?><gupdate "
334 "xmlns=\"http://www.google.com/" 334 "xmlns=\"http://www.google.com/"
335 "update2/response\" " 335 "update2/response\" "
336 "protocol=\"2.0\"><app appid=\"") + 336 "protocol=\"2.0\"><app appid=\"") +
337 OmahaRequestParams::kAppId 337 OmahaRequestParams::kAppId
338 + "\" status=\"ok\"><ping " 338 + "\" status=\"ok\"><ping "
339 "status=\"ok\"/><updatecheck " 339 "status=\"ok\"/><updatecheck "
340 "DisplayVersion=\"1.2.3.4\" " 340 "DisplayVersion=\"1.2.3.4\" "
341 "Prompt=\"false\" " 341 "Prompt=\"false\" "
342 "codebase=\"http://code/base\" " 342 "codebase=\"http://code/base\" hash=\"foo\" "
343 "hash=\"HASH1234=\" needsadmin=\"true\" " 343 "sha256=\"HASH1234=\" needsadmin=\"true\" "
344 "size=\"123\" " 344 "size=\"123\" "
345 "status=\"ok\"/></app></gupdate>", 345 "status=\"ok\"/></app></gupdate>",
346 kActionCodeSuccess, 346 kActionCodeSuccess,
347 &response, 347 &response,
348 NULL)); 348 NULL));
349 EXPECT_TRUE(response.update_exists); 349 EXPECT_TRUE(response.update_exists);
350 EXPECT_EQ("1.2.3.4", response.display_version); 350 EXPECT_EQ("1.2.3.4", response.display_version);
351 EXPECT_EQ("http://code/base", response.codebase); 351 EXPECT_EQ("http://code/base", response.codebase);
352 EXPECT_EQ("", response.more_info_url); 352 EXPECT_EQ("", response.more_info_url);
353 EXPECT_FALSE(response.is_delta); 353 EXPECT_FALSE(response.is_delta);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 kActionCodeError, 808 kActionCodeError,
809 NULL, // response 809 NULL, // response
810 &post_data)); 810 &post_data));
811 // convert post_data to string 811 // convert post_data to string
812 string post_str(&post_data[0], post_data.size()); 812 string post_str(&post_data[0], post_data.size());
813 EXPECT_EQ(post_str.find("machineid="), string::npos); 813 EXPECT_EQ(post_str.find("machineid="), string::npos);
814 EXPECT_EQ(post_str.find("userid="), string::npos); 814 EXPECT_EQ(post_str.find("userid="), string::npos);
815 } 815 }
816 816
817 } // namespace chromeos_update_engine 817 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_action.cc ('k') | payload_signer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698