OLD | NEW |
---|---|
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 Loading... | |
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 trusted SPDY proxy is set correctly from the command line switch. | |
bengr
2016/01/12 21:43:03
It seems you lost some changes.
Add the "the" bac
tbansal1
2016/01/12 23:43:49
Done.
| |
190 TEST_F(IOThreadTest, TrustedSpdyProxy) { | |
191 // When command line flag is unspecified, the proxy provider is unavailable. | |
192 ConfigureSpdyGlobals(); | |
193 EXPECT_FALSE(globals_.trusted_spdy_proxy_provider); | |
194 | |
195 const net::ProxyServer proxy = net::ProxyServer::FromURI( | |
196 "example.com:443", net::ProxyServer::SCHEME_HTTP); | |
197 command_line_.AppendSwitchASCII(switches::kTrustedSpdyProxy, | |
198 proxy.host_port_pair().ToString()); | |
199 | |
200 ConfigureSpdyGlobals(); | |
201 net::ProxyServer got_trusted_spdy_proxy; | |
202 globals_.trusted_spdy_proxy_provider->GetTrustedSpdyProxy( | |
203 &got_trusted_spdy_proxy); | |
204 EXPECT_EQ(proxy, got_trusted_spdy_proxy); | |
205 } | |
206 | |
186 TEST_F(IOThreadTest, NPNFieldTrialEnabled) { | 207 TEST_F(IOThreadTest, NPNFieldTrialEnabled) { |
187 field_trial_group_ = "Enable-experiment"; | 208 field_trial_group_ = "Enable-experiment"; |
188 ConfigureNPNGlobals(); | 209 ConfigureNPNGlobals(); |
189 net::HttpNetworkSession::Params params; | 210 net::HttpNetworkSession::Params params; |
190 InitializeNetworkSessionParams(¶ms); | 211 InitializeNetworkSessionParams(¶ms); |
191 EXPECT_TRUE(params.enable_npn); | 212 EXPECT_TRUE(params.enable_npn); |
192 } | 213 } |
193 | 214 |
194 TEST_F(IOThreadTest, NPNFieldTrialDisabled) { | 215 TEST_F(IOThreadTest, NPNFieldTrialDisabled) { |
195 field_trial_group_ = "Disable-holdback"; | 216 field_trial_group_ = "Disable-holdback"; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 776 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
756 base::Unretained(this), "acc1")); | 777 base::Unretained(this), "acc1")); |
757 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 778 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
758 RunOnIOThreadBlocking(base::Bind( | 779 RunOnIOThreadBlocking(base::Bind( |
759 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 780 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
760 base::Unretained(this), "acc2")); | 781 base::Unretained(this), "acc2")); |
761 } | 782 } |
762 #endif | 783 #endif |
763 | 784 |
764 } // namespace test | 785 } // namespace test |
OLD | NEW |