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