Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: chrome/browser/net/chrome_network_delegate_unittest.cc

Issue 1393193005: Implement $Secure- cookie prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add another test Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 "DataUse.TrafficSize.System.Downstream.Foreground.NotCellular", 0); 275 "DataUse.TrafficSize.System.Downstream.Foreground.NotCellular", 0);
276 histogram_tester.ExpectTotalCount( 276 histogram_tester.ExpectTotalCount(
277 "DataUse.TrafficSize.System.Upstream.Foreground.NotCellular", 0); 277 "DataUse.TrafficSize.System.Upstream.Foreground.NotCellular", 0);
278 histogram_tester.ExpectTotalCount("DataUse.MessageSize.Suggestions", 0); 278 histogram_tester.ExpectTotalCount("DataUse.MessageSize.Suggestions", 0);
279 } 279 }
280 280
281 #endif 281 #endif
282 282
283 TEST_F(ChromeNetworkDelegateTest, DisableFirstPartyOnlyCookiesIffFlagDisabled) { 283 TEST_F(ChromeNetworkDelegateTest, DisableFirstPartyOnlyCookiesIffFlagDisabled) {
284 Initialize(); 284 Initialize();
285 EXPECT_FALSE(network_delegate()->FirstPartyOnlyCookieExperimentEnabled()); 285 EXPECT_FALSE(network_delegate()->ExperimentalFeaturesEnabled());
286 } 286 }
287 287
288 TEST_F(ChromeNetworkDelegateTest, EnableFirstPartyOnlyCookiesIffFlagEnabled) { 288 TEST_F(ChromeNetworkDelegateTest, EnableFirstPartyOnlyCookiesIffFlagEnabled) {
289 base::CommandLine::ForCurrentProcess()->AppendSwitch( 289 base::CommandLine::ForCurrentProcess()->AppendSwitch(
290 switches::kEnableExperimentalWebPlatformFeatures); 290 switches::kEnableExperimentalWebPlatformFeatures);
291 Initialize(); 291 Initialize();
292 EXPECT_TRUE(network_delegate()->FirstPartyOnlyCookieExperimentEnabled()); 292 EXPECT_TRUE(network_delegate()->ExperimentalFeaturesEnabled());
293 } 293 }
294 294
295 TEST_F(ChromeNetworkDelegateTest, ReportDataUseToAggregator) { 295 TEST_F(ChromeNetworkDelegateTest, ReportDataUseToAggregator) {
296 FakeDataUseAggregator fake_aggregator; 296 FakeDataUseAggregator fake_aggregator;
297 Initialize(); 297 Initialize();
298 298
299 chrome_network_delegate()->set_data_use_aggregator( 299 chrome_network_delegate()->set_data_use_aggregator(
300 &fake_aggregator, false /* is_data_usage_off_the_record */); 300 &fake_aggregator, false /* is_data_usage_off_the_record */);
301 301
302 scoped_ptr<net::URLRequest> request = 302 scoped_ptr<net::URLRequest> request =
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 kBlockedFirstPartySite)); 530 kBlockedFirstPartySite));
531 531
532 cookie_settings_->SetCookieSetting( 532 cookie_settings_->SetCookieSetting(
533 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), 533 ContentSettingsPattern::FromURL(kBlockedFirstPartySite),
534 ContentSettingsPattern::Wildcard(), 534 ContentSettingsPattern::Wildcard(),
535 CONTENT_SETTING_BLOCK); 535 CONTENT_SETTING_BLOCK);
536 // Privacy mode is disabled as kAllowedSite is still getting cookies 536 // Privacy mode is disabled as kAllowedSite is still getting cookies
537 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, 537 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite,
538 kBlockedFirstPartySite)); 538 kBlockedFirstPartySite));
539 } 539 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698