| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |