| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 virtual void SetUpOnMainThread() { | 856 virtual void SetUpOnMainThread() { |
| 857 sb_service_ = g_browser_process->safe_browsing_service(); | 857 sb_service_ = g_browser_process->safe_browsing_service(); |
| 858 ASSERT_TRUE(sb_service_ != NULL); | 858 ASSERT_TRUE(sb_service_ != NULL); |
| 859 } | 859 } |
| 860 | 860 |
| 861 virtual void CleanUpOnMainThread() { | 861 virtual void CleanUpOnMainThread() { |
| 862 sb_service_ = NULL; | 862 sb_service_ = NULL; |
| 863 } | 863 } |
| 864 | 864 |
| 865 void ForceUpdate() { | 865 void ForceUpdate() { |
| 866 sb_service_->protocol_manager_->ForceScheduleNextUpdate(0); | 866 sb_service_->protocol_manager_->ForceScheduleNextUpdate( |
| 867 base::TimeDelta::FromSeconds(0)); |
| 867 } | 868 } |
| 868 | 869 |
| 869 scoped_refptr<SafeBrowsingService> sb_service_; | 870 scoped_refptr<SafeBrowsingService> sb_service_; |
| 870 | 871 |
| 871 private: | 872 private: |
| 872 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceCookieTest); | 873 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceCookieTest); |
| 873 }; | 874 }; |
| 874 | 875 |
| 875 // Test that a Safe Browsing database update request both sends cookies and can | 876 // Test that a Safe Browsing database update request both sends cookies and can |
| 876 // save cookies. | 877 // save cookies. |
| 877 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceCookieTest, TestSBUpdateCookies) { | 878 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceCookieTest, TestSBUpdateCookies) { |
| 878 content::WindowedNotificationObserver observer( | 879 content::WindowedNotificationObserver observer( |
| 879 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 880 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
| 880 content::Source<SafeBrowsingService>(sb_service_.get())); | 881 content::Source<SafeBrowsingService>(sb_service_.get())); |
| 881 BrowserThread::PostTask( | 882 BrowserThread::PostTask( |
| 882 BrowserThread::IO, FROM_HERE, | 883 BrowserThread::IO, FROM_HERE, |
| 883 base::Bind(&SafeBrowsingServiceCookieTest::ForceUpdate, this)); | 884 base::Bind(&SafeBrowsingServiceCookieTest::ForceUpdate, this)); |
| 884 observer.Wait(); | 885 observer.Wait(); |
| 885 } | 886 } |
| OLD | NEW |