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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 is_checked_url_safe_ = true; | 163 is_checked_url_safe_ = true; |
164 } else { | 164 } else { |
165 // In this case, Safebrowsing service will fetch the full hash | 165 // In this case, Safebrowsing service will fetch the full hash |
166 // from the server and examine that. Once it is done, | 166 // from the server and examine that. Once it is done, |
167 // set_is_checked_url_safe() will be called via callback. | 167 // set_is_checked_url_safe() will be called via callback. |
168 is_checked_url_in_db_ = true; | 168 is_checked_url_in_db_ = true; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 SafeBrowsingDatabaseManager* database_manager() { | 172 SafeBrowsingDatabaseManager* database_manager() { |
173 return safe_browsing_service_->database_manager(); | 173 return safe_browsing_service_->database_manager().get(); |
174 } | 174 } |
175 | 175 |
176 bool is_checked_url_in_db() { | 176 bool is_checked_url_in_db() { |
177 base::AutoLock l(update_status_mutex_); | 177 base::AutoLock l(update_status_mutex_); |
178 return is_checked_url_in_db_; | 178 return is_checked_url_in_db_; |
179 } | 179 } |
180 | 180 |
181 void set_is_checked_url_safe(bool safe) { | 181 void set_is_checked_url_safe(bool safe) { |
182 base::AutoLock l(update_status_mutex_); | 182 base::AutoLock l(update_status_mutex_); |
183 is_checked_url_safe_ = safe; | 183 is_checked_url_safe_ = safe; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 524 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
525 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 525 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
526 last_step = step; | 526 last_step = step; |
527 } | 527 } |
528 | 528 |
529 // Verifies with server if test is done and waits till server responses. | 529 // Verifies with server if test is done and waits till server responses. |
530 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 530 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
531 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 531 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
532 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 532 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
533 } | 533 } |
OLD | NEW |