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

Side by Side Diff: net/spdy/spdy_session_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: Added net/base/test_proxy_delegate.{h,cc} Created 4 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
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/test/histogram_tester.h" 14 #include "base/test/histogram_tester.h"
15 #include "net/base/host_port_pair.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 #include "net/base/ip_endpoint.h" 17 #include "net/base/ip_endpoint.h"
18 #include "net/base/proxy_delegate.h"
17 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.h"
18 #include "net/base/test_data_directory.h" 20 #include "net/base/test_data_directory.h"
19 #include "net/base/test_data_stream.h" 21 #include "net/base/test_data_stream.h"
22 #include "net/base/test_proxy_delegate.h"
20 #include "net/log/test_net_log.h" 23 #include "net/log/test_net_log.h"
21 #include "net/log/test_net_log_entry.h" 24 #include "net/log/test_net_log_entry.h"
22 #include "net/log/test_net_log_util.h" 25 #include "net/log/test_net_log_util.h"
26 #include "net/proxy/proxy_server.h"
23 #include "net/socket/client_socket_pool_manager.h" 27 #include "net/socket/client_socket_pool_manager.h"
24 #include "net/socket/next_proto.h" 28 #include "net/socket/next_proto.h"
25 #include "net/socket/socket_test_util.h" 29 #include "net/socket/socket_test_util.h"
26 #include "net/spdy/spdy_http_utils.h" 30 #include "net/spdy/spdy_http_utils.h"
27 #include "net/spdy/spdy_session_pool.h" 31 #include "net/spdy/spdy_session_pool.h"
28 #include "net/spdy/spdy_session_test_util.h" 32 #include "net/spdy/spdy_session_test_util.h"
29 #include "net/spdy/spdy_stream.h" 33 #include "net/spdy/spdy_stream.h"
30 #include "net/spdy/spdy_stream_test_util.h" 34 #include "net/spdy/spdy_stream_test_util.h"
31 #include "net/spdy/spdy_test_util_common.h" 35 #include "net/spdy/spdy_test_util_common.h"
32 #include "net/spdy/spdy_test_utils.h" 36 #include "net/spdy/spdy_test_utils.h"
(...skipping 4917 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 scoped_ptr<SpdyFrame> req( 4954 scoped_ptr<SpdyFrame> req(
4951 spdy_util_.ConstructSpdyGet(nullptr, 0, false, 1, LOWEST, true)); 4955 spdy_util_.ConstructSpdyGet(nullptr, 0, false, 1, LOWEST, true));
4952 scoped_ptr<SpdyFrame> rst( 4956 scoped_ptr<SpdyFrame> rst(
4953 spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_REFUSED_STREAM)); 4957 spdy_util_.ConstructSpdyRstStream(4, RST_STREAM_REFUSED_STREAM));
4954 MockWrite writes[] = { 4958 MockWrite writes[] = {
4955 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 5), 4959 CreateMockWrite(*req, 0), CreateMockWrite(*rst, 5),
4956 }; 4960 };
4957 4961
4958 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 4962 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
4959 session_deps_.socket_factory->AddSocketDataProvider(&data); 4963 session_deps_.socket_factory->AddSocketDataProvider(&data);
4960 session_deps_.trusted_spdy_proxy = 4964
4961 HostPortPair::FromURL(GURL(kDefaultURL)).ToString(); 4965 scoped_ptr<TestProxyDelegate> proxy_delegate(new TestProxyDelegate());
4966 proxy_delegate->set_trusted_spdy_proxy(
4967 net::ProxyServer(net::ProxyServer::SCHEME_HTTPS,
4968 HostPortPair(GURL(kDefaultURL).host(), 80)));
4969 session_deps_.proxy_delegate.reset(proxy_delegate.release());
4962 4970
4963 CreateNetworkSession(); 4971 CreateNetworkSession();
4964 CreateInsecureSpdySession(); 4972 CreateInsecureSpdySession();
4965 4973
4966 base::WeakPtr<SpdyStream> spdy_stream = CreateStreamSynchronously( 4974 base::WeakPtr<SpdyStream> spdy_stream = CreateStreamSynchronously(
4967 SPDY_REQUEST_RESPONSE_STREAM, session_, test_url_, LOWEST, BoundNetLog()); 4975 SPDY_REQUEST_RESPONSE_STREAM, session_, test_url_, LOWEST, BoundNetLog());
4968 ASSERT_TRUE(spdy_stream.get() != nullptr); 4976 ASSERT_TRUE(spdy_stream.get() != nullptr);
4969 EXPECT_EQ(0u, spdy_stream->stream_id()); 4977 EXPECT_EQ(0u, spdy_stream->stream_id());
4970 test::StreamDelegateDoNothing delegate(spdy_stream); 4978 test::StreamDelegateDoNothing delegate(spdy_stream);
4971 spdy_stream->SetDelegate(&delegate); 4979 spdy_stream->SetDelegate(&delegate);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
5440 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5448 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5441 "spdy_pooling.pem"); 5449 "spdy_pooling.pem");
5442 ssl_info.is_issued_by_known_root = true; 5450 ssl_info.is_issued_by_known_root = true;
5443 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5451 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5444 5452
5445 EXPECT_TRUE(SpdySession::CanPool( 5453 EXPECT_TRUE(SpdySession::CanPool(
5446 &tss, ssl_info, "www.example.org", "mail.example.org")); 5454 &tss, ssl_info, "www.example.org", "mail.example.org"));
5447 } 5455 }
5448 5456
5449 } // namespace net 5457 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698