| 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 // This test uses the safebrowsing test server published at | 5 // This test uses the safebrowsing test server published at |
| 6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing | 6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing |
| 7 // protocol implemetation. Details of the safebrowsing testing flow is | 7 // protocol implemetation. Details of the safebrowsing testing flow is |
| 8 // documented at | 8 // documented at |
| 9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting | 9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting |
| 10 // | 10 // |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 public: | 343 public: |
| 344 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test, | 344 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test, |
| 345 net::URLRequestContextGetter* request_context) | 345 net::URLRequestContextGetter* request_context) |
| 346 : safe_browsing_test_(safe_browsing_test), | 346 : safe_browsing_test_(safe_browsing_test), |
| 347 response_status_(net::URLRequestStatus::FAILED), | 347 response_status_(net::URLRequestStatus::FAILED), |
| 348 request_context_(request_context) { | 348 request_context_(request_context) { |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Callbacks for SafeBrowsingDatabaseManager::Client. | 351 // Callbacks for SafeBrowsingDatabaseManager::Client. |
| 352 virtual void OnCheckBrowseUrlResult(const GURL& url, | 352 virtual void OnCheckBrowseUrlResult(const GURL& url, |
| 353 SBThreatType threat_type) OVERRIDE { | 353 SBThreatType threat_type, |
| 354 const std::string& metadata) OVERRIDE { |
| 354 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 355 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 355 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); | 356 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); |
| 356 safe_browsing_test_->set_is_checked_url_safe( | 357 safe_browsing_test_->set_is_checked_url_safe( |
| 357 threat_type == SB_THREAT_TYPE_SAFE); | 358 threat_type == SB_THREAT_TYPE_SAFE); |
| 358 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 359 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 359 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this)); | 360 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this)); |
| 360 } | 361 } |
| 361 | 362 |
| 362 virtual void OnBlockingPageComplete(bool proceed) { | 363 virtual void OnBlockingPageComplete(bool proceed) { |
| 363 NOTREACHED() << "Not implemented."; | 364 NOTREACHED() << "Not implemented."; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 573 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
| 573 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 574 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
| 574 last_step = step; | 575 last_step = step; |
| 575 } | 576 } |
| 576 | 577 |
| 577 // Verifies with server if test is done and waits till server responses. | 578 // Verifies with server if test is done and waits till server responses. |
| 578 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 579 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 579 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 580 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
| 580 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 581 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 581 } | 582 } |
| OLD | NEW |