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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 590 |
591 // Called when the result of checking a download hash is known. | 591 // Called when the result of checking a download hash is known. |
592 virtual void OnCheckDownloadHashResult(const std::string& hash, | 592 virtual void OnCheckDownloadHashResult(const std::string& hash, |
593 SBThreatType threat_type) OVERRIDE { | 593 SBThreatType threat_type) OVERRIDE { |
594 threat_type_ = threat_type; | 594 threat_type_ = threat_type; |
595 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 595 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
596 base::Bind(&TestSBClient::DownloadCheckDone, this)); | 596 base::Bind(&TestSBClient::DownloadCheckDone, this)); |
597 } | 597 } |
598 | 598 |
599 void DownloadCheckDone() { | 599 void DownloadCheckDone() { |
600 MessageLoopForUI::current()->Quit(); | 600 base::MessageLoopForUI::current()->Quit(); |
601 } | 601 } |
602 | 602 |
603 SBThreatType threat_type_; | 603 SBThreatType threat_type_; |
604 SafeBrowsingService* safe_browsing_service_; | 604 SafeBrowsingService* safe_browsing_service_; |
605 | 605 |
606 DISALLOW_COPY_AND_ASSIGN(TestSBClient); | 606 DISALLOW_COPY_AND_ASSIGN(TestSBClient); |
607 }; | 607 }; |
608 | 608 |
609 // These tests use SafeBrowsingService::Client to directly interact with | 609 // These tests use SafeBrowsingService::Client to directly interact with |
610 // SafeBrowsingService. | 610 // SafeBrowsingService. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 811 |
812 SafeBrowsingServiceTest::TearDown(); | 812 SafeBrowsingServiceTest::TearDown(); |
813 } | 813 } |
814 | 814 |
815 // An observer that returns back to test code after a new profile is | 815 // An observer that returns back to test code after a new profile is |
816 // initialized. | 816 // initialized. |
817 void OnUnblockOnProfileCreation(Profile* profile, | 817 void OnUnblockOnProfileCreation(Profile* profile, |
818 Profile::CreateStatus status) { | 818 Profile::CreateStatus status) { |
819 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 819 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
820 profile2_ = profile; | 820 profile2_ = profile; |
821 MessageLoop::current()->Quit(); | 821 base::MessageLoop::current()->Quit(); |
822 } | 822 } |
823 } | 823 } |
824 | 824 |
825 protected: | 825 protected: |
826 Profile* profile2_; | 826 Profile* profile2_; |
827 }; | 827 }; |
828 | 828 |
829 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceShutdownTest, | 829 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceShutdownTest, |
830 DontStartAfterShutdown) { | 830 DontStartAfterShutdown) { |
831 CreateCSDService(); | 831 CreateCSDService(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 TestSBUpdateCookies) { | 985 TestSBUpdateCookies) { |
986 content::WindowedNotificationObserver observer( | 986 content::WindowedNotificationObserver observer( |
987 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 987 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
988 content::Source<SafeBrowsingDatabaseManager>( | 988 content::Source<SafeBrowsingDatabaseManager>( |
989 sb_service_->database_manager())); | 989 sb_service_->database_manager())); |
990 BrowserThread::PostTask( | 990 BrowserThread::PostTask( |
991 BrowserThread::IO, FROM_HERE, | 991 BrowserThread::IO, FROM_HERE, |
992 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 992 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
993 observer.Wait(); | 993 observer.Wait(); |
994 } | 994 } |
OLD | NEW |