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 creates a safebrowsing service using test safebrowsing database | 5 // This test creates a safebrowsing service using test safebrowsing database |
6 // and a test protocol manager. It is used to test logics in safebrowsing | 6 // and a test protocol manager. It is used to test logics in safebrowsing |
7 // service. | 7 // service. |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 515 |
516 int GetResult() { | 516 int GetResult() { |
517 return result_; | 517 return result_; |
518 } | 518 } |
519 | 519 |
520 void CheckDownloadUrl(const std::vector<GURL>& url_chain) { | 520 void CheckDownloadUrl(const std::vector<GURL>& url_chain) { |
521 BrowserThread::PostTask( | 521 BrowserThread::PostTask( |
522 BrowserThread::IO, FROM_HERE, | 522 BrowserThread::IO, FROM_HERE, |
523 base::Bind(&TestSBClient::CheckDownloadUrlOnIOThread, | 523 base::Bind(&TestSBClient::CheckDownloadUrlOnIOThread, |
524 this, url_chain)); | 524 this, url_chain)); |
525 ui_test_utils::RunMessageLoop(); // Will stop in OnDownloadUrlCheckResult. | 525 content::RunMessageLoop(); // Will stop in OnDownloadUrlCheckResult. |
526 } | 526 } |
527 | 527 |
528 void CheckDownloadHash(const std::string& full_hash) { | 528 void CheckDownloadHash(const std::string& full_hash) { |
529 BrowserThread::PostTask( | 529 BrowserThread::PostTask( |
530 BrowserThread::IO, FROM_HERE, | 530 BrowserThread::IO, FROM_HERE, |
531 base::Bind(&TestSBClient::CheckDownloadHashOnIOThread, | 531 base::Bind(&TestSBClient::CheckDownloadHashOnIOThread, |
532 this, full_hash)); | 532 this, full_hash)); |
533 ui_test_utils::RunMessageLoop(); // Will stop in OnDownloadHashCheckResult. | 533 content::RunMessageLoop(); // Will stop in OnDownloadHashCheckResult. |
534 } | 534 } |
535 | 535 |
536 private: | 536 private: |
537 friend class base::RefCountedThreadSafe<TestSBClient>; | 537 friend class base::RefCountedThreadSafe<TestSBClient>; |
538 virtual ~TestSBClient() {} | 538 virtual ~TestSBClient() {} |
539 | 539 |
540 void CheckDownloadUrlOnIOThread(const std::vector<GURL>& url_chain) { | 540 void CheckDownloadUrlOnIOThread(const std::vector<GURL>& url_chain) { |
541 safe_browsing_service_->CheckDownloadUrl(url_chain, this); | 541 safe_browsing_service_->CheckDownloadUrl(url_chain, this); |
542 } | 542 } |
543 | 543 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 // save cookies. | 876 // save cookies. |
877 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceCookieTest, TestSBUpdateCookies) { | 877 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceCookieTest, TestSBUpdateCookies) { |
878 content::WindowedNotificationObserver observer( | 878 content::WindowedNotificationObserver observer( |
879 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 879 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
880 content::Source<SafeBrowsingService>(sb_service_.get())); | 880 content::Source<SafeBrowsingService>(sb_service_.get())); |
881 BrowserThread::PostTask( | 881 BrowserThread::PostTask( |
882 BrowserThread::IO, FROM_HERE, | 882 BrowserThread::IO, FROM_HERE, |
883 base::Bind(&SafeBrowsingServiceCookieTest::ForceUpdate, this)); | 883 base::Bind(&SafeBrowsingServiceCookieTest::ForceUpdate, this)); |
884 observer.Wait(); | 884 observer.Wait(); |
885 } | 885 } |
OLD | NEW |