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

Side by Side Diff: net/http/http_network_transaction_ssl_unittest.cc

Issue 1342613002: Revert of Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/http/http_network_session_peer.cc ('k') | net/http/http_network_transaction_unittest.cc » ('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 <string> 5 #include <string>
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/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 mock_socket_factory_.AddSocketDataProvider(&data2); 120 mock_socket_factory_.AddSocketDataProvider(&data2);
121 121
122 // |ssl_data3| contains the handshake result for a TLS 1.0 122 // |ssl_data3| contains the handshake result for a TLS 1.0
123 // handshake which will be attempted after the TLS 1.1 123 // handshake which will be attempted after the TLS 1.1
124 // handshake fails. 124 // handshake fails.
125 SSLSocketDataProvider ssl_data3(ASYNC, ERR_SSL_PROTOCOL_ERROR); 125 SSLSocketDataProvider ssl_data3(ASYNC, ERR_SSL_PROTOCOL_ERROR);
126 mock_socket_factory_.AddSSLSocketDataProvider(&ssl_data3); 126 mock_socket_factory_.AddSSLSocketDataProvider(&ssl_data3);
127 StaticSocketDataProvider data3(NULL, 0, NULL, 0); 127 StaticSocketDataProvider data3(NULL, 0, NULL, 0);
128 mock_socket_factory_.AddSocketDataProvider(&data3); 128 mock_socket_factory_.AddSocketDataProvider(&data3);
129 129
130 scoped_ptr<HttpNetworkSession> session( 130 scoped_refptr<HttpNetworkSession> session(
131 new HttpNetworkSession(session_params_)); 131 new HttpNetworkSession(session_params_));
132 scoped_ptr<HttpNetworkTransaction> trans( 132 scoped_ptr<HttpNetworkTransaction> trans(
133 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 133 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
134 134
135 TestCompletionCallback callback; 135 TestCompletionCallback callback;
136 // This will consume |ssl_data1|, |ssl_data2| and |ssl_data3|. 136 // This will consume |ssl_data1|, |ssl_data2| and |ssl_data3|.
137 int rv = callback.GetResult( 137 int rv = callback.GetResult(
138 trans->Start(GetRequestInfo("https://www.paypal.com/"), 138 trans->Start(GetRequestInfo("https://www.paypal.com/"),
139 callback.callback(), BoundNetLog())); 139 callback.callback(), BoundNetLog()));
140 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); 140 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv);
141 141
142 SocketDataProviderArray<SocketDataProvider>& mock_data = 142 SocketDataProviderArray<SocketDataProvider>& mock_data =
143 mock_socket_factory_.mock_data(); 143 mock_socket_factory_.mock_data();
144 // Confirms that |ssl_data1|, |ssl_data2| and |ssl_data3| are consumed. 144 // Confirms that |ssl_data1|, |ssl_data2| and |ssl_data3| are consumed.
145 EXPECT_EQ(3u, mock_data.next_index()); 145 EXPECT_EQ(3u, mock_data.next_index());
146 146
147 SSLConfig& ssl_config = GetServerSSLConfig(trans.get()); 147 SSLConfig& ssl_config = GetServerSSLConfig(trans.get());
148 // |version_max| fallbacks to TLS 1.0. 148 // |version_max| fallbacks to TLS 1.0.
149 EXPECT_EQ(SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_max); 149 EXPECT_EQ(SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_max);
150 EXPECT_TRUE(ssl_config.version_fallback); 150 EXPECT_TRUE(ssl_config.version_fallback);
151 } 151 }
152 152
153 } // namespace net 153 } // namespace net
154 154
OLDNEW
« no previous file with comments | « net/http/http_network_session_peer.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698