| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test, | 348 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test, |
| 349 net::URLRequestContextGetter* request_context) | 349 net::URLRequestContextGetter* request_context) |
| 350 : safe_browsing_test_(safe_browsing_test), | 350 : safe_browsing_test_(safe_browsing_test), |
| 351 response_status_(net::URLRequestStatus::FAILED), | 351 response_status_(net::URLRequestStatus::FAILED), |
| 352 request_context_(request_context) { | 352 request_context_(request_context) { |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Callbacks for SafeBrowsingDatabaseManager::Client. | 355 // Callbacks for SafeBrowsingDatabaseManager::Client. |
| 356 void OnCheckBrowseUrlResult(const GURL& url, | 356 void OnCheckBrowseUrlResult(const GURL& url, |
| 357 SBThreatType threat_type, | 357 SBThreatType threat_type, |
| 358 const std::string& metadata) override { | 358 const ThreatMetadata& metadata) override { |
| 359 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 359 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 360 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); | 360 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); |
| 361 safe_browsing_test_->set_is_checked_url_safe( | 361 safe_browsing_test_->set_is_checked_url_safe( |
| 362 threat_type == SB_THREAT_TYPE_SAFE); | 362 threat_type == SB_THREAT_TYPE_SAFE); |
| 363 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 363 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 364 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this)); | 364 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this)); |
| 365 } | 365 } |
| 366 | 366 |
| 367 virtual void OnBlockingPageComplete(bool proceed) { | 367 virtual void OnBlockingPageComplete(bool proceed) { |
| 368 NOTREACHED() << "Not implemented."; | 368 NOTREACHED() << "Not implemented."; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 582 } |
| 583 | 583 |
| 584 // Verifies with server if test is done and waits till server responses. | 584 // Verifies with server if test is done and waits till server responses. |
| 585 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 585 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 586 safe_browsing_helper->VerifyTestComplete(spawned_test_server(), | 586 safe_browsing_helper->VerifyTestComplete(spawned_test_server(), |
| 587 last_step)); | 587 last_step)); |
| 588 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 588 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace safe_browsing | 591 } // namespace safe_browsing |
| OLD | NEW |