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

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

Issue 11970002: Added Client-Hints. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changed Client Hint names to match spec Created 7 years, 10 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/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/public/pref_member.h" 10 #include "base/prefs/public/pref_member.h"
(...skipping 20 matching lines...) Expand all
31 ChromeNetworkDelegate::g_never_throttle_requests_ = false; 31 ChromeNetworkDelegate::g_never_throttle_requests_ = false;
32 } 32 }
33 33
34 virtual void TearDown() OVERRIDE { 34 virtual void TearDown() OVERRIDE {
35 ChromeNetworkDelegate::g_never_throttle_requests_ = 35 ChromeNetworkDelegate::g_never_throttle_requests_ =
36 never_throttle_requests_original_value_; 36 never_throttle_requests_original_value_;
37 } 37 }
38 38
39 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { 39 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() {
40 return make_scoped_ptr( 40 return make_scoped_ptr(
41 new ChromeNetworkDelegate(forwarder_.get(), &pref_member_)); 41 new ChromeNetworkDelegate(forwarder_.get(), &pref_member_, false));
42 } 42 }
43 43
44 // Implementation moved here for access to private bits. 44 // Implementation moved here for access to private bits.
45 void NeverThrottleLogicImpl() { 45 void NeverThrottleLogicImpl() {
46 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate()); 46 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate());
47 47
48 net::TestURLRequestContext context; 48 net::TestURLRequestContext context;
49 net::TestURLRequest extension_request( 49 net::TestURLRequest extension_request(
50 GURL("http://example.com/"), NULL, &context); 50 GURL("http://example.com/"), NULL, &context);
51 extension_request.set_first_party_for_cookies( 51 extension_request.set_first_party_for_cookies(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 virtual void SetUp() OVERRIDE { 98 virtual void SetUp() OVERRIDE {
99 ChromeNetworkDelegate::InitializePrefsOnUIThread( 99 ChromeNetworkDelegate::InitializePrefsOnUIThread(
100 &enable_referrers_, NULL, &force_google_safe_search_, 100 &enable_referrers_, NULL, &force_google_safe_search_,
101 profile_.GetTestingPrefService()); 101 profile_.GetTestingPrefService());
102 } 102 }
103 103
104 protected: 104 protected:
105 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() { 105 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() {
106 scoped_ptr<ChromeNetworkDelegate> network_delegate( 106 scoped_ptr<ChromeNetworkDelegate> network_delegate(
107 new ChromeNetworkDelegate(forwarder_.get(), &enable_referrers_)); 107 new ChromeNetworkDelegate(forwarder_.get(), &enable_referrers_,
108 false));
108 network_delegate->set_force_google_safe_search(&force_google_safe_search_); 109 network_delegate->set_force_google_safe_search(&force_google_safe_search_);
109 return network_delegate.PassAs<net::NetworkDelegate>(); 110 return network_delegate.PassAs<net::NetworkDelegate>();
110 } 111 }
111 112
112 void SetSafeSearch(bool value) { 113 void SetSafeSearch(bool value) {
113 force_google_safe_search_.SetValue(value); 114 force_google_safe_search_.SetValue(value);
114 } 115 }
115 116
116 void SetDelegate(net::NetworkDelegate* delegate) { 117 void SetDelegate(net::NetworkDelegate* delegate) {
117 context_.set_network_delegate(delegate); 118 context_.set_network_delegate(delegate);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 "q=google"); 271 "q=google");
271 272
272 // Test the home page with parameters and safe set to off. 273 // Test the home page with parameters and safe set to off.
273 CheckAddedParameters("http://google.com/search?q=google&safe=off", 274 CheckAddedParameters("http://google.com/search?q=google&safe=off",
274 "q=google&safe=off"); 275 "q=google&safe=off");
275 276
276 // Test the home page with parameters and safe set to active. 277 // Test the home page with parameters and safe set to active.
277 CheckAddedParameters("http://google.com/search?q=google&safe=active", 278 CheckAddedParameters("http://google.com/search?q=google&safe=active",
278 "q=google&safe=active"); 279 "q=google&safe=active");
279 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698