OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 | 84 |
85 GURL TestConfigurator::UpdateUrl() { | 85 GURL TestConfigurator::UpdateUrl() { |
86 return GURL(POST_INTERCEPT_SCHEME "://" | 86 return GURL(POST_INTERCEPT_SCHEME "://" |
87 POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH); | 87 POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH); |
88 } | 88 } |
89 | 89 |
90 GURL TestConfigurator::PingUrl() { | 90 GURL TestConfigurator::PingUrl() { |
91 return UpdateUrl(); | 91 return UpdateUrl(); |
92 } | 92 } |
93 | 93 |
94 const char* TestConfigurator::ExtraRequestParams() { return "extra=foo"; } | 94 std::string TestConfigurator::ExtraRequestParams() { return "extra=\"foo\""; } |
95 | 95 |
96 size_t TestConfigurator::UrlSizeLimit() { return 256; } | 96 size_t TestConfigurator::UrlSizeLimit() { return 256; } |
97 | 97 |
98 net::URLRequestContextGetter* TestConfigurator::RequestContext() { | 98 net::URLRequestContextGetter* TestConfigurator::RequestContext() { |
99 return context_.get(); | 99 return context_.get(); |
100 } | 100 } |
101 | 101 |
102 // Don't use the utility process to run code out-of-process. | 102 // Don't use the utility process to run code out-of-process. |
103 bool TestConfigurator::InProcess() { return true; } | 103 bool TestConfigurator::InProcess() { return true; } |
104 | 104 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 << post_interceptor_->GetRequestsAsString(); | 466 << post_interceptor_->GetRequestsAsString(); |
467 | 467 |
468 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[2].find( | 468 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[2].find( |
469 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">" | 469 "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"1.0\">" |
470 "<updatecheck /></app>")); | 470 "<updatecheck /></app>")); |
471 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[2].find( | 471 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[2].find( |
472 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">" | 472 "<app appid=\"abagagagagagagagagagagagagagagag\" version=\"2.2\">" |
473 "<updatecheck /></app>")) | 473 "<updatecheck /></app>")) |
474 << post_interceptor_->GetRequestsAsString(); | 474 << post_interceptor_->GetRequestsAsString(); |
475 | 475 |
476 // Test the protocol version is correct and the extra request attributes | |
477 // are included in the request. | |
478 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( | |
479 "request protocol=\"3.0\" extra=\"foo\"")) | |
480 << post_interceptor_->GetRequestsAsString(); | |
cpu_(ooo_6.6-7.5)
2013/12/17 00:51:05
nice
| |
481 | |
476 component_updater()->Stop(); | 482 component_updater()->Stop(); |
477 } | 483 } |
478 | 484 |
479 // This test checks that the "prodversionmin" value is handled correctly. In | 485 // This test checks that the "prodversionmin" value is handled correctly. In |
480 // particular there should not be an install because the minimum product | 486 // particular there should not be an install because the minimum product |
481 // version is much higher than of chrome. | 487 // version is much higher than of chrome. |
482 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { | 488 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { |
483 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( | 489 EXPECT_TRUE(post_interceptor_->ExpectRequest(new PartialMatch( |
484 "updatecheck"), test_file("updatecheck_reply_2.xml"))); | 490 "updatecheck"), test_file("updatecheck_reply_2.xml"))); |
485 | 491 |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1373 EXPECT_EQ(1, post_interceptor_->GetHitCount()); | 1379 EXPECT_EQ(1, post_interceptor_->GetHitCount()); |
1374 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 1380 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
1375 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); | 1381 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); |
1376 | 1382 |
1377 component_updater()->Stop(); | 1383 component_updater()->Stop(); |
1378 } | 1384 } |
1379 | 1385 |
1380 | 1386 |
1381 } // namespace component_updater | 1387 } // namespace component_updater |
1382 | 1388 |
OLD | NEW |