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

Side by Side Diff: chrome/browser/component_updater/test/component_updater_service_unittest.cc

Issue 130543002: Added "os" attribute in the component updater update requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « chrome/browser/component_updater/component_updater_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium 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 "chrome/browser/component_updater/test/component_updater_service_unitte st.h" 5 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/component_updater/component_updater_utils.h" 13 #include "chrome/browser/component_updater/component_updater_utils.h"
13 #include "chrome/browser/component_updater/test/test_installer.h" 14 #include "chrome/browser/component_updater/test/test_installer.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/resource_controller.h" 17 #include "content/public/browser/resource_controller.h"
17 #include "content/public/browser/resource_request_info.h" 18 #include "content/public/browser/resource_request_info.h"
18 #include "content/public/browser/resource_throttle.h" 19 #include "content/public/browser/resource_throttle.h"
19 #include "libxml/globals.h" 20 #include "libxml/globals.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">" 465 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">"
465 "<updatecheck /></app>")) 466 "<updatecheck /></app>"))
466 << post_interceptor_->GetRequestsAsString(); 467 << post_interceptor_->GetRequestsAsString();
467 468
468 // Test the protocol version is correct and the extra request attributes 469 // Test the protocol version is correct and the extra request attributes
469 // are included in the request. 470 // are included in the request.
470 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( 471 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find(
471 "request protocol=\"3.0\" extra=\"foo\"")) 472 "request protocol=\"3.0\" extra=\"foo\""))
472 << post_interceptor_->GetRequestsAsString(); 473 << post_interceptor_->GetRequestsAsString();
473 474
475 // Tokenize the request string to look for specific attributes, which
476 // are important for backward compatibility with the version v2 of the update
477 // protocol. In this case, inspect the <request>, which is the first element
478 // after the xml declaration of the update request body.
479 // Expect to find the |os| and the |arch| attributes:
480 // <?xml version="1.0" encoding="UTF-8"?>
481 // <request...os=...arch=...>
482 // ...
483 // </request>
484 const std::string update_request(post_interceptor_->GetRequests()[0]);
485 std::vector<base::StringPiece> elements;
486 Tokenize(update_request, "<>", &elements);
487 EXPECT_NE(string::npos, elements[1].find("os="));
488 EXPECT_NE(string::npos, elements[1].find("arch="));
489
474 component_updater()->Stop(); 490 component_updater()->Stop();
475 } 491 }
476 492
477 // This test checks that the "prodversionmin" value is handled correctly. In 493 // This test checks that the "prodversionmin" value is handled correctly. In
478 // particular there should not be an install because the minimum product 494 // particular there should not be an install because the minimum product
479 // version is much higher than of chrome. 495 // version is much higher than of chrome.
480 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { 496 TEST_F(ComponentUpdaterTest, ProdVersionCheck) {
481 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( 497 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch(
482 "updatecheck"), test_file("updatecheck_reply_2.xml"))); 498 "updatecheck"), test_file("updatecheck_reply_2.xml")));
483 499
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 EXPECT_EQ(1, post_interceptor_->GetHitCount()); 1393 EXPECT_EQ(1, post_interceptor_->GetHitCount());
1378 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); 1394 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
1379 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); 1395 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
1380 1396
1381 component_updater()->Stop(); 1397 component_updater()->Stop();
1382 } 1398 }
1383 1399
1384 1400
1385 } // namespace component_updater 1401 } // namespace component_updater
1386 1402
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/component_updater_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698