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

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

Issue 1003953008: Remove prerender cookie store, part 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prerender-revert-cookie-store-3
Patch Set: rebase (just in case since this is so huge) Created 5 years, 9 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return make_scoped_ptr( 76 return make_scoped_ptr(
77 new ChromeNetworkDelegate(forwarder(), &pref_member_)); 77 new ChromeNetworkDelegate(forwarder(), &pref_member_));
78 } 78 }
79 79
80 // Implementation moved here for access to private bits. 80 // Implementation moved here for access to private bits.
81 void NeverThrottleLogicImpl() { 81 void NeverThrottleLogicImpl() {
82 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate()); 82 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate());
83 83
84 net::TestURLRequestContext context; 84 net::TestURLRequestContext context;
85 scoped_ptr<net::URLRequest> extension_request(context.CreateRequest( 85 scoped_ptr<net::URLRequest> extension_request(context.CreateRequest(
86 GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, NULL)); 86 GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL));
87 extension_request->set_first_party_for_cookies( 87 extension_request->set_first_party_for_cookies(
88 GURL("chrome-extension://abcdef/bingo.html")); 88 GURL("chrome-extension://abcdef/bingo.html"));
89 scoped_ptr<net::URLRequest> web_page_request(context.CreateRequest( 89 scoped_ptr<net::URLRequest> web_page_request(context.CreateRequest(
90 GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, NULL)); 90 GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL));
91 web_page_request->set_first_party_for_cookies( 91 web_page_request->set_first_party_for_cookies(
92 GURL("http://example.com/helloworld.html")); 92 GURL("http://example.com/helloworld.html"));
93 93
94 ASSERT_TRUE(delegate->OnCanThrottleRequest(*extension_request)); 94 ASSERT_TRUE(delegate->OnCanThrottleRequest(*extension_request));
95 ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request)); 95 ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request));
96 96
97 delegate->NeverThrottleRequests(); 97 delegate->NeverThrottleRequests();
98 ASSERT_TRUE(ChromeNetworkDelegate::g_never_throttle_requests_); 98 ASSERT_TRUE(ChromeNetworkDelegate::g_never_throttle_requests_);
99 ASSERT_FALSE(delegate->OnCanThrottleRequest(*extension_request)); 99 ASSERT_FALSE(delegate->OnCanThrottleRequest(*extension_request));
100 ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request)); 100 ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 // Does a request to an arbitrary URL and verifies that the SafeSearch 172 // Does a request to an arbitrary URL and verifies that the SafeSearch
173 // enforcement utility functions were called/not called as expected. 173 // enforcement utility functions were called/not called as expected.
174 void QueryURL(bool expect_google_safe_search, 174 void QueryURL(bool expect_google_safe_search,
175 bool expect_youtube_safety_mode) { 175 bool expect_youtube_safety_mode) {
176 safe_search_util::ClearForceGoogleSafeSearchCountForTesting(); 176 safe_search_util::ClearForceGoogleSafeSearchCountForTesting();
177 safe_search_util::ClearForceYouTubeSafetyModeCountForTesting(); 177 safe_search_util::ClearForceYouTubeSafetyModeCountForTesting();
178 178
179 scoped_ptr<net::URLRequest> request(context_.CreateRequest( 179 scoped_ptr<net::URLRequest> request(context_.CreateRequest(
180 GURL("http://anyurl.com"), net::DEFAULT_PRIORITY, &delegate_, NULL)); 180 GURL("http://anyurl.com"), net::DEFAULT_PRIORITY, &delegate_));
181 181
182 request->Start(); 182 request->Start();
183 base::MessageLoop::current()->RunUntilIdle(); 183 base::MessageLoop::current()->RunUntilIdle();
184 184
185 EXPECT_EQ(expect_google_safe_search ? 1 : 0, 185 EXPECT_EQ(expect_google_safe_search ? 1 : 0,
186 safe_search_util::GetForceGoogleSafeSearchCountForTesting()); 186 safe_search_util::GetForceGoogleSafeSearchCountForTesting());
187 EXPECT_EQ(expect_youtube_safety_mode ? 1 : 0, 187 EXPECT_EQ(expect_youtube_safety_mode ? 1 : 0,
188 safe_search_util::GetForceYouTubeSafetyModeCountForTesting()); 188 safe_search_util::GetForceYouTubeSafetyModeCountForTesting());
189 } 189 }
190 190
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 kBlockedFirstPartySite)); 339 kBlockedFirstPartySite));
340 340
341 cookie_settings_->SetCookieSetting( 341 cookie_settings_->SetCookieSetting(
342 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), 342 ContentSettingsPattern::FromURL(kBlockedFirstPartySite),
343 ContentSettingsPattern::Wildcard(), 343 ContentSettingsPattern::Wildcard(),
344 CONTENT_SETTING_BLOCK); 344 CONTENT_SETTING_BLOCK);
345 // Privacy mode is disabled as kAllowedSite is still getting cookies 345 // Privacy mode is disabled as kAllowedSite is still getting cookies
346 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, 346 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite,
347 kBlockedFirstPartySite)); 347 kBlockedFirstPartySite));
348 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc ('k') | chrome/browser/net/connection_tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698