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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // owned by the SafeBrowsingServiceTest object so that it will not get | 438 // owned by the SafeBrowsingServiceTest object so that it will not get |
439 // destructed until after the test Browser has been torn down, since the | 439 // destructed until after the test Browser has been torn down, since the |
440 // ImportantFileWriter may still be modifying it after the Profile object has | 440 // ImportantFileWriter may still be modifying it after the Profile object has |
441 // been destroyed. | 441 // been destroyed. |
442 base::ScopedTempDir temp_profile_dir_; | 442 base::ScopedTempDir temp_profile_dir_; |
443 | 443 |
444 // Waits for pending tasks on the IO thread to complete. This is useful | 444 // Waits for pending tasks on the IO thread to complete. This is useful |
445 // to wait for the SafeBrowsingService to finish loading/stopping. | 445 // to wait for the SafeBrowsingService to finish loading/stopping. |
446 void WaitForIOThread() { | 446 void WaitForIOThread() { |
447 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper( | 447 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper( |
448 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 448 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); |
449 ASSERT_TRUE(io_helper->Run()); | 449 ASSERT_TRUE(io_helper->Run()); |
450 } | 450 } |
451 | 451 |
452 private: | 452 private: |
453 TestSafeBrowsingDatabaseFactory db_factory_; | 453 TestSafeBrowsingDatabaseFactory db_factory_; |
454 TestSBProtocolManagerFactory pm_factory_; | 454 TestSBProtocolManagerFactory pm_factory_; |
455 | 455 |
456 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTest); | 456 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTest); |
457 }; | 457 }; |
458 | 458 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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().get())); | 989 sb_service_->database_manager().get())); |
990 BrowserThread::PostTask( | 990 BrowserThread::PostTask( |
991 BrowserThread::IO, | 991 BrowserThread::IO, |
992 FROM_HERE, | 992 FROM_HERE, |
993 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 993 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
994 observer.Wait(); | 994 observer.Wait(); |
995 } | 995 } |
OLD | NEW |