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

Side by Side Diff: chrome/browser/io_thread_unittest.cc

Issue 1547273003: Set trusted SPDY proxy dynamically on per-profile basis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/prefs/testing_pref_service.h" 13 #include "base/prefs/testing_pref_service.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/test/mock_entropy_provider.h" 15 #include "base/test/mock_entropy_provider.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/io_thread.h" 17 #include "chrome/browser/io_thread.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
21 #include "components/policy/core/common/mock_policy_service.h" 21 #include "components/policy/core/common/mock_policy_service.h"
22 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" 22 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
23 #include "components/proxy_config/proxy_config_pref_names.h" 23 #include "components/proxy_config/proxy_config_pref_names.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 25 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "net/base/host_port_pair.h"
27 #include "net/base/trusted_spdy_proxy_provider.h"
26 #include "net/http/http_auth_preferences.h" 28 #include "net/http/http_auth_preferences.h"
27 #include "net/http/http_auth_scheme.h" 29 #include "net/http/http_auth_scheme.h"
28 #include "net/http/http_network_session.h" 30 #include "net/http/http_network_session.h"
29 #include "net/http/http_server_properties_impl.h" 31 #include "net/http/http_server_properties_impl.h"
32 #include "net/proxy/proxy_server.h"
30 #include "net/quic/quic_protocol.h" 33 #include "net/quic/quic_protocol.h"
31 #include "net/quic/quic_stream_factory.h" 34 #include "net/quic/quic_stream_factory.h"
32 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
33 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
34 37
35 #if defined(ENABLE_EXTENSIONS) 38 #if defined(ENABLE_EXTENSIONS)
36 #include "chrome/browser/extensions/event_router_forwarder.h" 39 #include "chrome/browser/extensions/event_router_forwarder.h"
37 #endif 40 #endif
38 41
39 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 179 }
177 180
178 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) { 181 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) {
179 command_line_.AppendSwitchASCII("use-spdy", "off"); 182 command_line_.AppendSwitchASCII("use-spdy", "off");
180 // Command line should overwrite field trial group. 183 // Command line should overwrite field trial group.
181 field_trial_group_ = "Spdy4Enabled"; 184 field_trial_group_ = "Spdy4Enabled";
182 ConfigureSpdyGlobals(); 185 ConfigureSpdyGlobals();
183 EXPECT_EQ(0u, globals_.next_protos.size()); 186 EXPECT_EQ(0u, globals_.next_protos.size());
184 } 187 }
185 188
189 // Tests that the trusted SPDY proxy is set correctly from the command line
190 // switch.
191 TEST_F(IOThreadTest, TrustedSpdyProxy) {
192 // When command line flag is unspecified, the proxy provider is unavailable.
193 ConfigureSpdyGlobals();
194 EXPECT_FALSE(globals_.trusted_spdy_proxy_provider);
195
196 const net::ProxyServer proxy = net::ProxyServer::FromURI(
197 "example.com:443", net::ProxyServer::SCHEME_HTTP);
bengr 2016/01/11 22:29:35 Once you fix things up so that everything uses Pro
tbansal1 2016/01/12 20:50:51 Done.
198 command_line_.AppendSwitchASCII(switches::kTrustedSpdyProxy,
199 proxy.host_port_pair().ToString());
200
201 ConfigureSpdyGlobals();
202 net::ProxyServer got_trusted_spdy_proxy;
bengr 2016/01/11 22:29:35 Call this trusted_spdy_proxy.
tbansal1 2016/01/12 20:50:51 obsolete.
203 globals_.trusted_spdy_proxy_provider->GetTrustedSpdyProxy(
204 &got_trusted_spdy_proxy);
205 EXPECT_EQ(proxy, got_trusted_spdy_proxy);
206 }
207
186 TEST_F(IOThreadTest, NPNFieldTrialEnabled) { 208 TEST_F(IOThreadTest, NPNFieldTrialEnabled) {
187 field_trial_group_ = "Enable-experiment"; 209 field_trial_group_ = "Enable-experiment";
188 ConfigureNPNGlobals(); 210 ConfigureNPNGlobals();
189 net::HttpNetworkSession::Params params; 211 net::HttpNetworkSession::Params params;
190 InitializeNetworkSessionParams(&params); 212 InitializeNetworkSessionParams(&params);
191 EXPECT_TRUE(params.enable_npn); 213 EXPECT_TRUE(params.enable_npn);
192 } 214 }
193 215
194 TEST_F(IOThreadTest, NPNFieldTrialDisabled) { 216 TEST_F(IOThreadTest, NPNFieldTrialDisabled) {
195 field_trial_group_ = "Disable-holdback"; 217 field_trial_group_ = "Disable-holdback";
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, 777 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType,
756 base::Unretained(this), "acc1")); 778 base::Unretained(this), "acc1"));
757 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); 779 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2");
758 RunOnIOThreadBlocking(base::Bind( 780 RunOnIOThreadBlocking(base::Bind(
759 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, 781 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType,
760 base::Unretained(this), "acc2")); 782 base::Unretained(this), "acc2"));
761 } 783 }
762 #endif 784 #endif
763 785
764 } // namespace test 786 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698