| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/update_client/update_checker.h" | 5 #include "components/update_client/update_checker.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 post_interceptor_->GetRequests()[0].find(" dlpref=\"cacheable\"")); | 317 post_interceptor_->GetRequests()[0].find(" dlpref=\"cacheable\"")); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // This test is checking that an update check signed with CUP fails, since there | 320 // This test is checking that an update check signed with CUP fails, since there |
| 321 // is currently no entity that can respond with a valid signed response. | 321 // is currently no entity that can respond with a valid signed response. |
| 322 // A proper CUP test requires network mocks, which are not available now. | 322 // A proper CUP test requires network mocks, which are not available now. |
| 323 TEST_F(UpdateCheckerTest, UpdateCheckCupError) { | 323 TEST_F(UpdateCheckerTest, UpdateCheckCupError) { |
| 324 EXPECT_TRUE(post_interceptor_->ExpectRequest( | 324 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
| 325 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); | 325 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); |
| 326 | 326 |
| 327 config_->SetUseCupSigning(true); | 327 config_->SetEnabledCupSigning(true); |
| 328 update_checker_ = UpdateChecker::Create(config_, metadata_.get()); | 328 update_checker_ = UpdateChecker::Create(config_, metadata_.get()); |
| 329 | 329 |
| 330 CrxUpdateItem item(BuildCrxUpdateItem()); | 330 CrxUpdateItem item(BuildCrxUpdateItem()); |
| 331 std::vector<CrxUpdateItem*> items_to_check; | 331 std::vector<CrxUpdateItem*> items_to_check; |
| 332 items_to_check.push_back(&item); | 332 items_to_check.push_back(&item); |
| 333 | 333 |
| 334 update_checker_->CheckForUpdates( | 334 update_checker_->CheckForUpdates( |
| 335 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 335 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
| 336 base::Unretained(this))); | 336 base::Unretained(this))); |
| 337 | 337 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 << post_interceptor_->GetRequestsAsString(); | 409 << post_interceptor_->GetRequestsAsString(); |
| 410 ASSERT_EQ(2, post_interceptor_->GetCount()) | 410 ASSERT_EQ(2, post_interceptor_->GetCount()) |
| 411 << post_interceptor_->GetRequestsAsString(); | 411 << post_interceptor_->GetRequestsAsString(); |
| 412 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( | 412 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( |
| 413 "<ping rd=\"-2\" ping_freshness=")); | 413 "<ping rd=\"-2\" ping_freshness=")); |
| 414 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[1].find( | 414 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[1].find( |
| 415 "<ping rd=\"3383\" ping_freshness=")); | 415 "<ping rd=\"3383\" ping_freshness=")); |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace update_client | 418 } // namespace update_client |
| OLD | NEW |