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 #include "chrome/browser/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/extensions/event_router_forwarder.h" | 24 #include "chrome/browser/extensions/event_router_forwarder.h" |
25 #endif | 25 #endif |
26 | 26 |
27 #if defined(ENABLE_EXTENSIONS) | 27 #if defined(ENABLE_EXTENSIONS) |
28 class ChromeNetworkDelegateTest : public testing::Test { | 28 class ChromeNetworkDelegateTest : public testing::Test { |
29 protected: | 29 protected: |
30 ChromeNetworkDelegateTest() | 30 ChromeNetworkDelegateTest() |
31 : forwarder_(new extensions::EventRouterForwarder()) { | 31 : forwarder_(new extensions::EventRouterForwarder()) { |
32 } | 32 } |
33 | 33 |
34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() override { |
35 never_throttle_requests_original_value_ = | 35 never_throttle_requests_original_value_ = |
36 ChromeNetworkDelegate::g_never_throttle_requests_; | 36 ChromeNetworkDelegate::g_never_throttle_requests_; |
37 ChromeNetworkDelegate::g_never_throttle_requests_ = false; | 37 ChromeNetworkDelegate::g_never_throttle_requests_ = false; |
38 } | 38 } |
39 | 39 |
40 virtual void TearDown() OVERRIDE { | 40 virtual void TearDown() override { |
41 ChromeNetworkDelegate::g_never_throttle_requests_ = | 41 ChromeNetworkDelegate::g_never_throttle_requests_ = |
42 never_throttle_requests_original_value_; | 42 never_throttle_requests_original_value_; |
43 } | 43 } |
44 | 44 |
45 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { | 45 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { |
46 return make_scoped_ptr( | 46 return make_scoped_ptr( |
47 new ChromeNetworkDelegate(forwarder_.get(), &pref_member_)); | 47 new ChromeNetworkDelegate(forwarder_.get(), &pref_member_)); |
48 } | 48 } |
49 | 49 |
50 // Implementation moved here for access to private bits. | 50 // Implementation moved here for access to private bits. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 class ChromeNetworkDelegateSafeSearchTest : public testing::Test { | 97 class ChromeNetworkDelegateSafeSearchTest : public testing::Test { |
98 public: | 98 public: |
99 ChromeNetworkDelegateSafeSearchTest() | 99 ChromeNetworkDelegateSafeSearchTest() |
100 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 100 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
101 #if defined(ENABLE_EXTENSIONS) | 101 #if defined(ENABLE_EXTENSIONS) |
102 forwarder_ = new extensions::EventRouterForwarder(); | 102 forwarder_ = new extensions::EventRouterForwarder(); |
103 #endif | 103 #endif |
104 } | 104 } |
105 | 105 |
106 virtual void SetUp() OVERRIDE { | 106 virtual void SetUp() override { |
107 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 107 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
108 &enable_referrers_, NULL, &force_google_safe_search_, | 108 &enable_referrers_, NULL, &force_google_safe_search_, |
109 profile_.GetTestingPrefService()); | 109 profile_.GetTestingPrefService()); |
110 } | 110 } |
111 | 111 |
112 protected: | 112 protected: |
113 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() { | 113 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() { |
114 scoped_ptr<ChromeNetworkDelegate> network_delegate( | 114 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
115 new ChromeNetworkDelegate(forwarder(), &enable_referrers_)); | 115 new ChromeNetworkDelegate(forwarder(), &enable_referrers_)); |
116 network_delegate->set_force_google_safe_search(&force_google_safe_search_); | 116 network_delegate->set_force_google_safe_search(&force_google_safe_search_); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 #if defined(ENABLE_EXTENSIONS) | 305 #if defined(ENABLE_EXTENSIONS) |
306 forwarder_(new extensions::EventRouterForwarder()), | 306 forwarder_(new extensions::EventRouterForwarder()), |
307 #endif | 307 #endif |
308 cookie_settings_(CookieSettings::Factory::GetForProfile(&profile_) | 308 cookie_settings_(CookieSettings::Factory::GetForProfile(&profile_) |
309 .get()), | 309 .get()), |
310 kBlockedSite("http://ads.thirdparty.com"), | 310 kBlockedSite("http://ads.thirdparty.com"), |
311 kAllowedSite("http://good.allays.com"), | 311 kAllowedSite("http://good.allays.com"), |
312 kFirstPartySite("http://cool.things.com"), | 312 kFirstPartySite("http://cool.things.com"), |
313 kBlockedFirstPartySite("http://no.thirdparties.com") {} | 313 kBlockedFirstPartySite("http://no.thirdparties.com") {} |
314 | 314 |
315 virtual void SetUp() OVERRIDE { | 315 virtual void SetUp() override { |
316 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 316 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
317 &enable_referrers_, NULL, NULL, | 317 &enable_referrers_, NULL, NULL, |
318 profile_.GetTestingPrefService()); | 318 profile_.GetTestingPrefService()); |
319 } | 319 } |
320 | 320 |
321 protected: | 321 protected: |
322 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { | 322 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { |
323 scoped_ptr<ChromeNetworkDelegate> network_delegate( | 323 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
324 new ChromeNetworkDelegate(forwarder(), &enable_referrers_)); | 324 new ChromeNetworkDelegate(forwarder(), &enable_referrers_)); |
325 network_delegate->set_cookie_settings(cookie_settings_); | 325 network_delegate->set_cookie_settings(cookie_settings_); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 cookie_settings_->SetCookieSetting( | 408 cookie_settings_->SetCookieSetting( |
409 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), | 409 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), |
410 ContentSettingsPattern::Wildcard(), | 410 ContentSettingsPattern::Wildcard(), |
411 CONTENT_SETTING_BLOCK); | 411 CONTENT_SETTING_BLOCK); |
412 // Privacy mode is disabled as kAllowedSite is still getting cookies | 412 // Privacy mode is disabled as kAllowedSite is still getting cookies |
413 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, | 413 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, |
414 kBlockedFirstPartySite)); | 414 kBlockedFirstPartySite)); |
415 } | 415 } |
416 | 416 |
OLD | NEW |