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

Side by Side Diff: net/socket/ssl_client_socket_unittest.cc

Issue 1387363004: Disable HTTP/2 over NPN (with OpenSSL). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #7. Created 5 years, 2 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/socket/ssl_client_socket_openssl.cc ('k') | net/spdy/spdy_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 "net/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 3124
3125 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( 3125 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket(
3126 transport.Pass(), test_server.host_port_pair(), config)); 3126 transport.Pass(), test_server.host_port_pair(), config));
3127 3127
3128 rv = sock->Connect(callback.callback()); 3128 rv = sock->Connect(callback.callback());
3129 rv = callback.GetResult(rv); 3129 rv = callback.GetResult(rv);
3130 3130
3131 EXPECT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, rv); 3131 EXPECT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, rv);
3132 } 3132 }
3133 3133
3134 // In tests requiring NPN, client_config.alpn_protos and
3135 // client_config.npn_protos both need to be set when using NSS, otherwise NPN is
3136 // disabled due to quirks of the implementation.
3137
3134 TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) { 3138 TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) {
3135 // False Start requires NPN/ALPN, ECDHE, and an AEAD. 3139 // False Start requires NPN/ALPN, ECDHE, and an AEAD.
3136 SpawnedTestServer::SSLOptions server_options; 3140 SpawnedTestServer::SSLOptions server_options;
3137 server_options.key_exchanges = 3141 server_options.key_exchanges =
3138 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3142 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3139 server_options.bulk_ciphers = 3143 server_options.bulk_ciphers =
3140 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3144 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3141 server_options.npn_protocols.push_back(std::string("http/1.1")); 3145 server_options.npn_protocols.push_back(std::string("http/1.1"));
3142 SSLConfig client_config; 3146 SSLConfig client_config;
3143 client_config.next_protos.push_back(kProtoHTTP11); 3147 #if !defined(USE_OPENSSL)
3148 client_config.alpn_protos.push_back(kProtoHTTP11);
3149 #endif
3150 client_config.npn_protos.push_back(kProtoHTTP11);
3144 ASSERT_NO_FATAL_FAILURE( 3151 ASSERT_NO_FATAL_FAILURE(
3145 TestFalseStart(server_options, client_config, true)); 3152 TestFalseStart(server_options, client_config, true));
3146 } 3153 }
3147 3154
3148 // Test that False Start is disabled without NPN. 3155 // Test that False Start is disabled without NPN.
3149 TEST_F(SSLClientSocketFalseStartTest, NoNPN) { 3156 TEST_F(SSLClientSocketFalseStartTest, NoNPN) {
3150 SpawnedTestServer::SSLOptions server_options; 3157 SpawnedTestServer::SSLOptions server_options;
3151 server_options.key_exchanges = 3158 server_options.key_exchanges =
3152 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3159 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3153 server_options.bulk_ciphers = 3160 server_options.bulk_ciphers =
3154 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3161 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3155 SSLConfig client_config; 3162 SSLConfig client_config;
3156 client_config.next_protos.clear(); 3163 client_config.alpn_protos.clear();
3164 client_config.npn_protos.clear();
3157 ASSERT_NO_FATAL_FAILURE( 3165 ASSERT_NO_FATAL_FAILURE(
3158 TestFalseStart(server_options, client_config, false)); 3166 TestFalseStart(server_options, client_config, false));
3159 } 3167 }
3160 3168
3161 // Test that False Start is disabled with plain RSA ciphers. 3169 // Test that False Start is disabled with plain RSA ciphers.
3162 TEST_F(SSLClientSocketFalseStartTest, RSA) { 3170 TEST_F(SSLClientSocketFalseStartTest, RSA) {
3163 SpawnedTestServer::SSLOptions server_options; 3171 SpawnedTestServer::SSLOptions server_options;
3164 server_options.key_exchanges = 3172 server_options.key_exchanges =
3165 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_RSA; 3173 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_RSA;
3166 server_options.bulk_ciphers = 3174 server_options.bulk_ciphers =
3167 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3175 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3168 server_options.npn_protocols.push_back(std::string("http/1.1")); 3176 server_options.npn_protocols.push_back(std::string("http/1.1"));
3169 SSLConfig client_config; 3177 SSLConfig client_config;
3170 client_config.next_protos.push_back(kProtoHTTP11); 3178 #if !defined(USE_OPENSSL)
3179 client_config.alpn_protos.push_back(kProtoHTTP11);
3180 #endif
3181 client_config.npn_protos.push_back(kProtoHTTP11);
3171 ASSERT_NO_FATAL_FAILURE( 3182 ASSERT_NO_FATAL_FAILURE(
3172 TestFalseStart(server_options, client_config, false)); 3183 TestFalseStart(server_options, client_config, false));
3173 } 3184 }
3174 3185
3175 // Test that False Start is disabled with DHE_RSA ciphers. 3186 // Test that False Start is disabled with DHE_RSA ciphers.
3176 TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) { 3187 TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) {
3177 SpawnedTestServer::SSLOptions server_options; 3188 SpawnedTestServer::SSLOptions server_options;
3178 server_options.key_exchanges = 3189 server_options.key_exchanges =
3179 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA; 3190 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA;
3180 server_options.bulk_ciphers = 3191 server_options.bulk_ciphers =
3181 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3192 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3182 server_options.npn_protocols.push_back(std::string("http/1.1")); 3193 server_options.npn_protocols.push_back(std::string("http/1.1"));
3183 SSLConfig client_config; 3194 SSLConfig client_config;
3184 client_config.next_protos.push_back(kProtoHTTP11); 3195 #if !defined(USE_OPENSSL)
3196 client_config.alpn_protos.push_back(kProtoHTTP11);
3197 #endif
3198 client_config.npn_protos.push_back(kProtoHTTP11);
3185 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); 3199 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
3186 } 3200 }
3187 3201
3188 // Test that False Start is disabled without an AEAD. 3202 // Test that False Start is disabled without an AEAD.
3189 TEST_F(SSLClientSocketFalseStartTest, NoAEAD) { 3203 TEST_F(SSLClientSocketFalseStartTest, NoAEAD) {
3190 SpawnedTestServer::SSLOptions server_options; 3204 SpawnedTestServer::SSLOptions server_options;
3191 server_options.key_exchanges = 3205 server_options.key_exchanges =
3192 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3206 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3193 server_options.bulk_ciphers = 3207 server_options.bulk_ciphers =
3194 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; 3208 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128;
3195 server_options.npn_protocols.push_back(std::string("http/1.1")); 3209 server_options.npn_protocols.push_back(std::string("http/1.1"));
3196 SSLConfig client_config; 3210 SSLConfig client_config;
3197 client_config.next_protos.push_back(kProtoHTTP11); 3211 #if !defined(USE_OPENSSL)
3212 client_config.alpn_protos.push_back(kProtoHTTP11);
3213 #endif
3214 client_config.npn_protos.push_back(kProtoHTTP11);
3198 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); 3215 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
3199 } 3216 }
3200 3217
3201 // Test that sessions are resumable after receiving the server Finished message. 3218 // Test that sessions are resumable after receiving the server Finished message.
3202 TEST_F(SSLClientSocketFalseStartTest, SessionResumption) { 3219 TEST_F(SSLClientSocketFalseStartTest, SessionResumption) {
3203 // Start a server. 3220 // Start a server.
3204 SpawnedTestServer::SSLOptions server_options; 3221 SpawnedTestServer::SSLOptions server_options;
3205 server_options.key_exchanges = 3222 server_options.key_exchanges =
3206 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3223 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3207 server_options.bulk_ciphers = 3224 server_options.bulk_ciphers =
3208 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3225 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3209 server_options.npn_protocols.push_back(std::string("http/1.1")); 3226 server_options.npn_protocols.push_back(std::string("http/1.1"));
3210 SSLConfig client_config; 3227 SSLConfig client_config;
3211 client_config.next_protos.push_back(kProtoHTTP11); 3228 #if !defined(USE_OPENSSL)
3229 client_config.alpn_protos.push_back(kProtoHTTP11);
3230 #endif
3231 client_config.npn_protos.push_back(kProtoHTTP11);
3212 3232
3213 // Let a full handshake complete with False Start. 3233 // Let a full handshake complete with False Start.
3214 ASSERT_NO_FATAL_FAILURE( 3234 ASSERT_NO_FATAL_FAILURE(
3215 TestFalseStart(server_options, client_config, true)); 3235 TestFalseStart(server_options, client_config, true));
3216 3236
3217 // Make a second connection. 3237 // Make a second connection.
3218 TestCompletionCallback callback; 3238 TestCompletionCallback callback;
3219 scoped_ptr<StreamSocket> transport2( 3239 scoped_ptr<StreamSocket> transport2(
3220 new TCPClientSocket(addr(), &log_, NetLog::Source())); 3240 new TCPClientSocket(addr(), &log_, NetLog::Source()));
3221 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback()))); 3241 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback())));
(...skipping 14 matching lines...) Expand all
3236 // Start a server. 3256 // Start a server.
3237 SpawnedTestServer::SSLOptions server_options; 3257 SpawnedTestServer::SSLOptions server_options;
3238 server_options.key_exchanges = 3258 server_options.key_exchanges =
3239 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3259 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3240 server_options.bulk_ciphers = 3260 server_options.bulk_ciphers =
3241 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3261 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3242 server_options.npn_protocols.push_back(std::string("http/1.1")); 3262 server_options.npn_protocols.push_back(std::string("http/1.1"));
3243 ASSERT_TRUE(StartTestServer(server_options)); 3263 ASSERT_TRUE(StartTestServer(server_options));
3244 3264
3245 SSLConfig client_config; 3265 SSLConfig client_config;
3246 client_config.next_protos.push_back(kProtoHTTP11); 3266 #if !defined(USE_OPENSSL)
3267 client_config.alpn_protos.push_back(kProtoHTTP11);
3268 #endif
3269 client_config.npn_protos.push_back(kProtoHTTP11);
3247 3270
3248 // Start a handshake up to the server Finished message. 3271 // Start a handshake up to the server Finished message.
3249 TestCompletionCallback callback; 3272 TestCompletionCallback callback;
3250 FakeBlockingStreamSocket* raw_transport1 = NULL; 3273 FakeBlockingStreamSocket* raw_transport1 = NULL;
3251 scoped_ptr<SSLClientSocket> sock1; 3274 scoped_ptr<SSLClientSocket> sock1;
3252 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( 3275 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
3253 client_config, &callback, &raw_transport1, &sock1)); 3276 client_config, &callback, &raw_transport1, &sock1));
3254 // Although raw_transport1 has the server Finished blocked, the handshake 3277 // Although raw_transport1 has the server Finished blocked, the handshake
3255 // still completes. 3278 // still completes.
3256 EXPECT_EQ(OK, callback.WaitForResult()); 3279 EXPECT_EQ(OK, callback.WaitForResult());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 // Start a server. 3317 // Start a server.
3295 SpawnedTestServer::SSLOptions server_options; 3318 SpawnedTestServer::SSLOptions server_options;
3296 server_options.key_exchanges = 3319 server_options.key_exchanges =
3297 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; 3320 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
3298 server_options.bulk_ciphers = 3321 server_options.bulk_ciphers =
3299 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; 3322 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
3300 server_options.npn_protocols.push_back(std::string("http/1.1")); 3323 server_options.npn_protocols.push_back(std::string("http/1.1"));
3301 ASSERT_TRUE(StartTestServer(server_options)); 3324 ASSERT_TRUE(StartTestServer(server_options));
3302 3325
3303 SSLConfig client_config; 3326 SSLConfig client_config;
3304 client_config.next_protos.push_back(kProtoHTTP11); 3327 #if !defined(USE_OPENSSL)
3328 client_config.alpn_protos.push_back(kProtoHTTP11);
3329 #endif
3330 client_config.npn_protos.push_back(kProtoHTTP11);
3305 3331
3306 // Start a handshake up to the server Finished message. 3332 // Start a handshake up to the server Finished message.
3307 TestCompletionCallback callback; 3333 TestCompletionCallback callback;
3308 FakeBlockingStreamSocket* raw_transport1 = NULL; 3334 FakeBlockingStreamSocket* raw_transport1 = NULL;
3309 scoped_ptr<SSLClientSocket> sock1; 3335 scoped_ptr<SSLClientSocket> sock1;
3310 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( 3336 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
3311 client_config, &callback, &raw_transport1, &sock1)); 3337 client_config, &callback, &raw_transport1, &sock1));
3312 // Although raw_transport1 has the server Finished blocked, the handshake 3338 // Although raw_transport1 has the server Finished blocked, the handshake
3313 // still completes. 3339 // still completes.
3314 EXPECT_EQ(OK, callback.WaitForResult()); 3340 EXPECT_EQ(OK, callback.WaitForResult());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 EXPECT_FALSE(sock_->IsConnected()); 3444 EXPECT_FALSE(sock_->IsConnected());
3419 } 3445 }
3420 3446
3421 TEST_F(SSLClientSocketTest, NPN) { 3447 TEST_F(SSLClientSocketTest, NPN) {
3422 SpawnedTestServer::SSLOptions server_options; 3448 SpawnedTestServer::SSLOptions server_options;
3423 server_options.npn_protocols.push_back(std::string("spdy/3.1")); 3449 server_options.npn_protocols.push_back(std::string("spdy/3.1"));
3424 server_options.npn_protocols.push_back(std::string("h2")); 3450 server_options.npn_protocols.push_back(std::string("h2"));
3425 ASSERT_TRUE(ConnectToTestServer(server_options)); 3451 ASSERT_TRUE(ConnectToTestServer(server_options));
3426 3452
3427 SSLConfig client_config; 3453 SSLConfig client_config;
3428 client_config.next_protos.push_back(kProtoHTTP2); 3454 #if !defined(USE_OPENSSL)
3429 client_config.next_protos.push_back(kProtoHTTP11); 3455 client_config.alpn_protos.push_back(kProtoHTTP2);
3456 client_config.alpn_protos.push_back(kProtoHTTP11);
3457 #endif
3458 client_config.npn_protos.push_back(kProtoHTTP2);
3459 client_config.npn_protos.push_back(kProtoHTTP11);
3430 3460
3431 int rv; 3461 int rv;
3432 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); 3462 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
3433 EXPECT_EQ(OK, rv); 3463 EXPECT_EQ(OK, rv);
3434 3464
3435 std::string proto; 3465 std::string proto;
3436 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); 3466 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto));
3437 EXPECT_EQ("h2", proto); 3467 EXPECT_EQ("h2", proto);
3438 } 3468 }
3439 3469
3440 // In case of no overlap between client and server list, SSLClientSocket should 3470 // In case of no overlap between client and server list, SSLClientSocket should
3441 // fall back to last one on the client list. 3471 // fall back to last one on the client list.
3442 TEST_F(SSLClientSocketTest, NPNNoOverlap) { 3472 TEST_F(SSLClientSocketTest, NPNNoOverlap) {
3443 SpawnedTestServer::SSLOptions server_options; 3473 SpawnedTestServer::SSLOptions server_options;
3444 server_options.npn_protocols.push_back(std::string("http/1.1")); 3474 server_options.npn_protocols.push_back(std::string("http/1.1"));
3445 ASSERT_TRUE(ConnectToTestServer(server_options)); 3475 ASSERT_TRUE(ConnectToTestServer(server_options));
3446 3476
3447 SSLConfig client_config; 3477 SSLConfig client_config;
3448 client_config.next_protos.push_back(kProtoSPDY31); 3478 #if !defined(USE_OPENSSL)
3449 client_config.next_protos.push_back(kProtoHTTP2); 3479 client_config.alpn_protos.push_back(kProtoSPDY31);
3480 client_config.alpn_protos.push_back(kProtoHTTP2);
3481 #endif
3482 client_config.npn_protos.push_back(kProtoSPDY31);
3483 client_config.npn_protos.push_back(kProtoHTTP2);
3450 3484
3451 int rv; 3485 int rv;
3452 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); 3486 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
3453 EXPECT_EQ(OK, rv); 3487 EXPECT_EQ(OK, rv);
3454 3488
3455 std::string proto; 3489 std::string proto;
3456 EXPECT_EQ(SSLClientSocket::kNextProtoNoOverlap, sock_->GetNextProto(&proto)); 3490 EXPECT_EQ(SSLClientSocket::kNextProtoNoOverlap, sock_->GetNextProto(&proto));
3457 EXPECT_EQ("h2", proto); 3491 EXPECT_EQ("h2", proto);
3458 } 3492 }
3459 3493
3460 // Server preference should be respected. The list is in decreasing order of 3494 // Server preference should be respected. The list is in decreasing order of
3461 // preference. 3495 // preference.
3462 TEST_F(SSLClientSocketTest, NPNServerPreference) { 3496 TEST_F(SSLClientSocketTest, NPNServerPreference) {
3463 SpawnedTestServer::SSLOptions server_options; 3497 SpawnedTestServer::SSLOptions server_options;
3464 server_options.npn_protocols.push_back(std::string("spdy/3.1")); 3498 server_options.npn_protocols.push_back(std::string("spdy/3.1"));
3465 server_options.npn_protocols.push_back(std::string("h2")); 3499 server_options.npn_protocols.push_back(std::string("h2"));
3466 ASSERT_TRUE(ConnectToTestServer(server_options)); 3500 ASSERT_TRUE(ConnectToTestServer(server_options));
3467 3501
3468 SSLConfig client_config; 3502 SSLConfig client_config;
3469 client_config.next_protos.push_back(kProtoHTTP2); 3503 #if !defined(USE_OPENSSL)
3470 client_config.next_protos.push_back(kProtoSPDY31); 3504 client_config.alpn_protos.push_back(kProtoHTTP2);
3505 client_config.alpn_protos.push_back(kProtoSPDY31);
3506 #endif
3507 client_config.npn_protos.push_back(kProtoHTTP2);
3508 client_config.npn_protos.push_back(kProtoSPDY31);
3471 3509
3472 int rv; 3510 int rv;
3473 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); 3511 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
3474 EXPECT_EQ(OK, rv); 3512 EXPECT_EQ(OK, rv);
3475 3513
3476 std::string proto; 3514 std::string proto;
3477 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); 3515 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto));
3478 EXPECT_EQ("spdy/3.1", proto); 3516 EXPECT_EQ("spdy/3.1", proto);
3479 } 3517 }
3480 3518
(...skipping 11 matching lines...) Expand all
3492 std::string proto; 3530 std::string proto;
3493 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, 3531 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported,
3494 sock_->GetNextProto(&proto)); 3532 sock_->GetNextProto(&proto));
3495 } 3533 }
3496 3534
3497 TEST_F(SSLClientSocketTest, NPNServerDisabled) { 3535 TEST_F(SSLClientSocketTest, NPNServerDisabled) {
3498 SpawnedTestServer::SSLOptions server_options; 3536 SpawnedTestServer::SSLOptions server_options;
3499 ASSERT_TRUE(ConnectToTestServer(server_options)); 3537 ASSERT_TRUE(ConnectToTestServer(server_options));
3500 3538
3501 SSLConfig client_config; 3539 SSLConfig client_config;
3502 client_config.next_protos.push_back(kProtoHTTP11); 3540 #if !defined(USE_OPENSSL)
3541 client_config.alpn_protos.push_back(kProtoHTTP11);
3542 #endif
3543 client_config.npn_protos.push_back(kProtoHTTP11);
3503 3544
3504 int rv; 3545 int rv;
3505 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); 3546 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
3506 EXPECT_EQ(OK, rv); 3547 EXPECT_EQ(OK, rv);
3507 3548
3508 std::string proto; 3549 std::string proto;
3509 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, 3550 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported,
3510 sock_->GetNextProto(&proto)); 3551 sock_->GetNextProto(&proto));
3511 } 3552 }
3512 3553
3513 } // namespace net 3554 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698