| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 content::Source<SafeBrowsingService>(safe_browsing_service_)); | 233 content::Source<SafeBrowsingService>(safe_browsing_service_)); |
| 234 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 234 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 235 base::Bind(&SafeBrowsingServiceTest::ForceUpdateOnIOThread, | 235 base::Bind(&SafeBrowsingServiceTest::ForceUpdateOnIOThread, |
| 236 this)); | 236 this)); |
| 237 observer.Wait(); | 237 observer.Wait(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void ForceUpdateOnIOThread() { | 240 void ForceUpdateOnIOThread() { |
| 241 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 241 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 242 ASSERT_TRUE(safe_browsing_service_); | 242 ASSERT_TRUE(safe_browsing_service_); |
| 243 safe_browsing_service_->protocol_manager_->ForceScheduleNextUpdate(0); | 243 safe_browsing_service_->protocol_manager_->ForceScheduleNextUpdate( |
| 244 base::TimeDelta::FromSeconds(0)); |
| 244 } | 245 } |
| 245 | 246 |
| 246 void CheckIsDatabaseReady() { | 247 void CheckIsDatabaseReady() { |
| 247 base::AutoLock lock(update_status_mutex_); | 248 base::AutoLock lock(update_status_mutex_); |
| 248 is_database_ready_ = | 249 is_database_ready_ = |
| 249 !safe_browsing_service_->database_update_in_progress_; | 250 !safe_browsing_service_->database_update_in_progress_; |
| 250 } | 251 } |
| 251 | 252 |
| 252 void CheckUrl(SafeBrowsingService::Client* helper, const GURL& url) { | 253 void CheckUrl(SafeBrowsingService::Client* helper, const GURL& url) { |
| 253 ASSERT_TRUE(safe_browsing_service_); | 254 ASSERT_TRUE(safe_browsing_service_); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 633 } |
| 633 | 634 |
| 634 // Verifies with server if test is done and waits till server responses. | 635 // Verifies with server if test is done and waits till server responses. |
| 635 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 636 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 636 safe_browsing_helper->VerifyTestComplete(server_host, | 637 safe_browsing_helper->VerifyTestComplete(server_host, |
| 637 server_port, | 638 server_port, |
| 638 last_step)); | 639 last_step)); |
| 639 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 640 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 640 test_server.Stop(); | 641 test_server.Stop(); |
| 641 } | 642 } |
| OLD | NEW |