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 #include <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 protected: | 230 protected: |
231 scoped_ptr<ClientSideDetectionService> csd_service_; | 231 scoped_ptr<ClientSideDetectionService> csd_service_; |
232 scoped_ptr<net::FakeURLFetcherFactory> factory_; | 232 scoped_ptr<net::FakeURLFetcherFactory> factory_; |
233 base::MessageLoop msg_loop_; | 233 base::MessageLoop msg_loop_; |
234 | 234 |
235 private: | 235 private: |
236 void SendRequestDone(GURL phishing_url, bool is_phishing) { | 236 void SendRequestDone(GURL phishing_url, bool is_phishing) { |
237 ASSERT_EQ(phishing_url, phishing_url_); | 237 ASSERT_EQ(phishing_url, phishing_url_); |
238 is_phishing_ = is_phishing; | 238 is_phishing_ = is_phishing; |
239 msg_loop_.Quit(); | 239 msg_loop_.QuitWhenIdle(); |
240 } | 240 } |
241 | 241 |
242 void SendMalwareRequestDone(GURL original_url, GURL malware_url, | 242 void SendMalwareRequestDone(GURL original_url, GURL malware_url, |
243 bool is_malware) { | 243 bool is_malware) { |
244 ASSERT_EQ(phishing_url_, original_url); | 244 ASSERT_EQ(phishing_url_, original_url); |
245 confirmed_malware_url_ = malware_url; | 245 confirmed_malware_url_ = malware_url; |
246 is_malware_ = is_malware; | 246 is_malware_ = is_malware; |
247 msg_loop_.Quit(); | 247 msg_loop_.QuitWhenIdle(); |
248 } | 248 } |
249 | 249 |
250 scoped_ptr<content::TestBrowserThread> browser_thread_; | 250 scoped_ptr<content::TestBrowserThread> browser_thread_; |
251 scoped_ptr<content::TestBrowserThread> file_thread_; | 251 scoped_ptr<content::TestBrowserThread> file_thread_; |
252 scoped_ptr<base::FieldTrialList> field_trials_; | 252 scoped_ptr<base::FieldTrialList> field_trials_; |
253 | 253 |
254 GURL phishing_url_; | 254 GURL phishing_url_; |
255 GURL confirmed_malware_url_; | 255 GURL confirmed_malware_url_; |
256 bool is_phishing_; | 256 bool is_phishing_; |
257 bool is_malware_; | 257 bool is_malware_; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 477 |
478 // Check that disabling again doesn't request the model. | 478 // Check that disabling again doesn't request the model. |
479 csd_service_->SetEnabledAndRefreshState(false); | 479 csd_service_->SetEnabledAndRefreshState(false); |
480 // No calls expected. | 480 // No calls expected. |
481 msg_loop_.RunUntilIdle(); | 481 msg_loop_.RunUntilIdle(); |
482 Mock::VerifyAndClearExpectations(service); | 482 Mock::VerifyAndClearExpectations(service); |
483 Mock::VerifyAndClearExpectations(loader_1); | 483 Mock::VerifyAndClearExpectations(loader_1); |
484 Mock::VerifyAndClearExpectations(loader_2); | 484 Mock::VerifyAndClearExpectations(loader_2); |
485 } | 485 } |
486 } // namespace safe_browsing | 486 } // namespace safe_browsing |
OLD | NEW |