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.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 CheckAddedParameters("http://google.com/search?q=google&safe=active", | 278 CheckAddedParameters("http://google.com/search?q=google&safe=active", |
279 "q=google&safe=active"); | 279 "q=google&safe=active"); |
280 } | 280 } |
281 | 281 |
282 // Privacy Mode disables Channel Id if cookies are blocked (cr223191) | 282 // Privacy Mode disables Channel Id if cookies are blocked (cr223191) |
283 class ChromeNetworkDelegatePrivacyModeTest : public testing::Test { | 283 class ChromeNetworkDelegatePrivacyModeTest : public testing::Test { |
284 public: | 284 public: |
285 ChromeNetworkDelegatePrivacyModeTest() | 285 ChromeNetworkDelegatePrivacyModeTest() |
286 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 286 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
287 forwarder_(new extensions::EventRouterForwarder()), | 287 forwarder_(new extensions::EventRouterForwarder()), |
288 cookie_settings_(CookieSettings::Factory::GetForProfile(&profile_)), | 288 cookie_settings_(CookieSettings::Factory::GetForProfile(&profile_) |
| 289 .get()), |
289 kBlockedSite("http://ads.thirdparty.com"), | 290 kBlockedSite("http://ads.thirdparty.com"), |
290 kAllowedSite("http://good.allays.com"), | 291 kAllowedSite("http://good.allays.com"), |
291 kFirstPartySite("http://cool.things.com"), | 292 kFirstPartySite("http://cool.things.com"), |
292 kBlockedFirstPartySite("http://no.thirdparties.com") { | 293 kBlockedFirstPartySite("http://no.thirdparties.com") {} |
293 } | |
294 | 294 |
295 virtual void SetUp() OVERRIDE { | 295 virtual void SetUp() OVERRIDE { |
296 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 296 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
297 &enable_referrers_, NULL, NULL, | 297 &enable_referrers_, NULL, NULL, |
298 profile_.GetTestingPrefService()); | 298 profile_.GetTestingPrefService()); |
299 } | 299 } |
300 | 300 |
301 protected: | 301 protected: |
302 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { | 302 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { |
303 scoped_ptr<ChromeNetworkDelegate> network_delegate( | 303 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 cookie_settings_->SetCookieSetting( | 378 cookie_settings_->SetCookieSetting( |
379 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), | 379 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), |
380 ContentSettingsPattern::Wildcard(), | 380 ContentSettingsPattern::Wildcard(), |
381 CONTENT_SETTING_BLOCK); | 381 CONTENT_SETTING_BLOCK); |
382 // Privacy mode is disabled as kAllowedSite is still getting cookies | 382 // Privacy mode is disabled as kAllowedSite is still getting cookies |
383 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, | 383 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, |
384 kBlockedFirstPartySite)); | 384 kBlockedFirstPartySite)); |
385 } | 385 } |
386 | 386 |
OLD | NEW |