| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/safe_browsing/download_protection_service.h" | 9 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 std::vector<SafeBrowsingNavigationObserver*> observer_list_; | 156 std::vector<SafeBrowsingNavigationObserver*> observer_list_; |
| 157 | 157 |
| 158 content::NotificationRegistrar registrar_; | 158 content::NotificationRegistrar registrar_; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 class SBNavigationObserverBrowserTest : public InProcessBrowserTest { | 161 class SBNavigationObserverBrowserTest : public InProcessBrowserTest { |
| 162 public: | 162 public: |
| 163 SBNavigationObserverBrowserTest() {} | 163 SBNavigationObserverBrowserTest() {} |
| 164 | 164 |
| 165 void SetUpOnMainThread() override { | 165 void SetUpOnMainThread() override { |
| 166 // Disable Safe Browsing service since it is irrelevant to this test. | 166 // Disable Safe Browsing service so we can directly control when |
| 167 // SafeBrowsingNavigationObserverManager and SafeBrowsingNavigationObserver |
| 168 // are instantiated. |
| 167 browser()->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, | 169 browser()->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, |
| 168 false); | 170 false); |
| 169 ASSERT_TRUE(embedded_test_server()->Start()); | 171 ASSERT_TRUE(embedded_test_server()->Start()); |
| 170 host_resolver()->AddRule("*", "127.0.0.1"); | 172 host_resolver()->AddRule("*", "127.0.0.1"); |
| 171 observer_manager_ = new TestNavigationObserverManager(); | 173 observer_manager_ = new TestNavigationObserverManager(); |
| 172 observer_ = new SafeBrowsingNavigationObserver( | 174 observer_ = new SafeBrowsingNavigationObserver( |
| 173 browser()->tab_strip_model()->GetActiveWebContents(), | 175 browser()->tab_strip_model()->GetActiveWebContents(), |
| 174 observer_manager_); | 176 observer_manager_); |
| 175 ASSERT_TRUE(observer_); | 177 ASSERT_TRUE(observer_); |
| 176 ASSERT_TRUE(InitialSetup()); | 178 ASSERT_TRUE(InitialSetup()); |
| (...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 GURL(), // main_frame_url | 1961 GURL(), // main_frame_url |
| 1960 ReferrerChainEntry::CLIENT_REDIRECT, // type | 1962 ReferrerChainEntry::CLIENT_REDIRECT, // type |
| 1961 test_server_ip, // ip_address | 1963 test_server_ip, // ip_address |
| 1962 GURL(), // referrer_url | 1964 GURL(), // referrer_url |
| 1963 GURL(), // referrer_main_frame_url | 1965 GURL(), // referrer_main_frame_url |
| 1964 false, // is_retargeting | 1966 false, // is_retargeting |
| 1965 std::vector<GURL>(), // server redirects | 1967 std::vector<GURL>(), // server redirects |
| 1966 referrer_chain.Get(0)); | 1968 referrer_chain.Get(0)); |
| 1967 } | 1969 } |
| 1968 } // namespace safe_browsing | 1970 } // namespace safe_browsing |
| OLD | NEW |