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

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Lots of fixes driven by try jobs. Created 5 years, 4 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 SpdySessionDependencies* CreateSpdySessionDependencies( 108 SpdySessionDependencies* CreateSpdySessionDependencies(
109 SpdyNetworkTransactionTestParams test_params) { 109 SpdyNetworkTransactionTestParams test_params) {
110 SpdySessionDependencies* session_deps = 110 SpdySessionDependencies* session_deps =
111 new SpdySessionDependencies(test_params.protocol); 111 new SpdySessionDependencies(test_params.protocol);
112 UpdateSpdySessionDependencies(test_params, session_deps); 112 UpdateSpdySessionDependencies(test_params, session_deps);
113 return session_deps; 113 return session_deps;
114 } 114 }
115 115
116 SpdySessionDependencies* CreateSpdySessionDependencies( 116 SpdySessionDependencies* CreateSpdySessionDependencies(
pauljensen 2015/08/28 13:38:03 would be nice to make this a scoped_ptr too
Randy Smith (Not in Mondays) 2015/09/02 23:42:20 Done.
117 SpdyNetworkTransactionTestParams test_params, 117 SpdyNetworkTransactionTestParams test_params,
118 ProxyService* proxy_service) { 118 scoped_ptr<ProxyService> proxy_service) {
119 SpdySessionDependencies* session_deps = 119 SpdySessionDependencies* session_deps =
120 new SpdySessionDependencies(test_params.protocol, proxy_service); 120 new SpdySessionDependencies(test_params.protocol, proxy_service.Pass());
121 UpdateSpdySessionDependencies(test_params, session_deps); 121 UpdateSpdySessionDependencies(test_params, session_deps);
122 return session_deps; 122 return session_deps;
123 } 123 }
124 124
125 } // namespace 125 } // namespace
126 126
127 class SpdyNetworkTransactionTest 127 class SpdyNetworkTransactionTest
128 : public ::testing::TestWithParam<SpdyNetworkTransactionTestParams> { 128 : public ::testing::TestWithParam<SpdyNetworkTransactionTestParams> {
129 protected: 129 protected:
130 SpdyNetworkTransactionTest() : spdy_util_(GetParam().protocol) { 130 SpdyNetworkTransactionTest() : spdy_util_(GetParam().protocol) {
(...skipping 4350 matching lines...) Expand 10 before | Expand all | Expand 10 after
4481 if (spdy_util_.spdy_version() < HTTP2) 4481 if (spdy_util_.spdy_version() < HTTP2)
4482 return; 4482 return;
4483 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is 4483 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is
4484 // only spoken over SSL. 4484 // only spoken over SSL.
4485 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN) 4485 if (GetParam().ssl_type != HTTPS_SPDY_VIA_NPN)
4486 return; 4486 return;
4487 4487
4488 HttpRequestInfo request; 4488 HttpRequestInfo request;
4489 request.method = "GET"; 4489 request.method = "GET";
4490 request.url = GURL("https://www.example.org/"); 4490 request.url = GURL("https://www.example.org/");
4491
pauljensen 2015/08/28 13:38:02 unnecessary whitespace change?
Randy Smith (Not in Mondays) 2015/09/02 23:42:20 Done.
4491 scoped_ptr<SpdySessionDependencies> session_deps( 4492 scoped_ptr<SpdySessionDependencies> session_deps(
4492 CreateSpdySessionDependencies( 4493 CreateSpdySessionDependencies(
4493 GetParam(), 4494 GetParam(),
4494 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"))); 4495 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")));
4495 // Do not force SPDY so that second socket can negotiate HTTP/1.1. 4496 // Do not force SPDY so that second socket can negotiate HTTP/1.1.
4496 session_deps->next_protos = SpdyNextProtos(); 4497 session_deps->next_protos = SpdyNextProtos();
4497 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), 4498 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(),
4498 GetParam(), session_deps.release()); 4499 GetParam(), session_deps.release());
4499 4500
4500 // First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED. 4501 // First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 EXPECT_EQ(70, response->socket_address.port()); 4578 EXPECT_EQ(70, response->socket_address.port());
4578 std::string response_data; 4579 std::string response_data;
4579 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); 4580 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data));
4580 EXPECT_EQ("hello", response_data); 4581 EXPECT_EQ("hello", response_data);
4581 } 4582 }
4582 4583
4583 // Test to make sure we can correctly connect through a proxy. 4584 // Test to make sure we can correctly connect through a proxy.
4584 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { 4585 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) {
4585 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 4586 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
4586 BoundNetLog(), GetParam(), NULL); 4587 BoundNetLog(), GetParam(), NULL);
4588
pauljensen 2015/08/28 13:38:02 ditto
Randy Smith (Not in Mondays) 2015/09/02 23:42:20 Done.
4587 helper.session_deps().reset(CreateSpdySessionDependencies( 4589 helper.session_deps().reset(CreateSpdySessionDependencies(
4588 GetParam(), 4590 GetParam(), ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")));
pauljensen 2015/08/28 13:38:02 a formatting change...to an unrelated line...perha
Randy Smith (Not in Mondays) 2015/09/02 23:42:20 Moot, since there's now a substantive change on 45
4589 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")));
4590 helper.SetSession(make_scoped_refptr( 4591 helper.SetSession(make_scoped_refptr(
4591 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); 4592 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())));
4592 helper.RunPreTestSetup(); 4593 helper.RunPreTestSetup();
4593 HttpNetworkTransaction* trans = helper.trans(); 4594 HttpNetworkTransaction* trans = helper.trans();
4594 4595
4595 const char kConnect443[] = { 4596 const char kConnect443[] = {
4596 "CONNECT www.example.org:443 HTTP/1.1\r\n" 4597 "CONNECT www.example.org:443 HTTP/1.1\r\n"
4597 "Host: www.example.org\r\n" 4598 "Host: www.example.org\r\n"
4598 "Proxy-Connection: keep-alive\r\n\r\n"}; 4599 "Proxy-Connection: keep-alive\r\n\r\n"};
4599 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; 4600 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"};
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
6630 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6631 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6631 scoped_ptr<SSLSocketDataProvider> ssl_provider( 6632 scoped_ptr<SSLSocketDataProvider> ssl_provider(
6632 new SSLSocketDataProvider(ASYNC, OK)); 6633 new SSLSocketDataProvider(ASYNC, OK));
6633 // Set to TLS_RSA_WITH_NULL_MD5 6634 // Set to TLS_RSA_WITH_NULL_MD5
6634 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6635 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6635 6636
6636 RunTLSUsageCheckTest(ssl_provider.Pass()); 6637 RunTLSUsageCheckTest(ssl_provider.Pass());
6637 } 6638 }
6638 6639
6639 } // namespace net 6640 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698