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 "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 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3133 | 3133 |
3134 TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) { | 3134 TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) { |
3135 // False Start requires NPN/ALPN, ECDHE, and an AEAD. | 3135 // False Start requires NPN/ALPN, ECDHE, and an AEAD. |
3136 SpawnedTestServer::SSLOptions server_options; | 3136 SpawnedTestServer::SSLOptions server_options; |
3137 server_options.key_exchanges = | 3137 server_options.key_exchanges = |
3138 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3138 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3139 server_options.bulk_ciphers = | 3139 server_options.bulk_ciphers = |
3140 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3140 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3141 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3141 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3142 SSLConfig client_config; | 3142 SSLConfig client_config; |
3143 client_config.next_protos.push_back(kProtoHTTP11); | 3143 client_config.alpn_protos.push_back(kProtoHTTP11); |
davidben
2015/10/14 16:36:46
The comment and #ifdef apply to all of these too,
Bence
2015/10/14 18:39:02
Done.
| |
3144 client_config.npn_protos.push_back(kProtoHTTP11); | |
3144 ASSERT_NO_FATAL_FAILURE( | 3145 ASSERT_NO_FATAL_FAILURE( |
3145 TestFalseStart(server_options, client_config, true)); | 3146 TestFalseStart(server_options, client_config, true)); |
3146 } | 3147 } |
3147 | 3148 |
3148 // Test that False Start is disabled without NPN. | 3149 // Test that False Start is disabled without NPN. |
3149 TEST_F(SSLClientSocketFalseStartTest, NoNPN) { | 3150 TEST_F(SSLClientSocketFalseStartTest, NoNPN) { |
3150 SpawnedTestServer::SSLOptions server_options; | 3151 SpawnedTestServer::SSLOptions server_options; |
3151 server_options.key_exchanges = | 3152 server_options.key_exchanges = |
3152 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3153 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3153 server_options.bulk_ciphers = | 3154 server_options.bulk_ciphers = |
3154 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3155 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3155 SSLConfig client_config; | 3156 SSLConfig client_config; |
3156 client_config.next_protos.clear(); | 3157 client_config.alpn_protos.clear(); |
3158 client_config.npn_protos.clear(); | |
3157 ASSERT_NO_FATAL_FAILURE( | 3159 ASSERT_NO_FATAL_FAILURE( |
3158 TestFalseStart(server_options, client_config, false)); | 3160 TestFalseStart(server_options, client_config, false)); |
3159 } | 3161 } |
3160 | 3162 |
3161 // Test that False Start is disabled with plain RSA ciphers. | 3163 // Test that False Start is disabled with plain RSA ciphers. |
3162 TEST_F(SSLClientSocketFalseStartTest, RSA) { | 3164 TEST_F(SSLClientSocketFalseStartTest, RSA) { |
3163 SpawnedTestServer::SSLOptions server_options; | 3165 SpawnedTestServer::SSLOptions server_options; |
3164 server_options.key_exchanges = | 3166 server_options.key_exchanges = |
3165 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_RSA; | 3167 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_RSA; |
3166 server_options.bulk_ciphers = | 3168 server_options.bulk_ciphers = |
3167 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3169 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3168 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3170 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3169 SSLConfig client_config; | 3171 SSLConfig client_config; |
3170 client_config.next_protos.push_back(kProtoHTTP11); | 3172 client_config.alpn_protos.push_back(kProtoHTTP11); |
3173 client_config.npn_protos.push_back(kProtoHTTP11); | |
3171 ASSERT_NO_FATAL_FAILURE( | 3174 ASSERT_NO_FATAL_FAILURE( |
3172 TestFalseStart(server_options, client_config, false)); | 3175 TestFalseStart(server_options, client_config, false)); |
3173 } | 3176 } |
3174 | 3177 |
3175 // Test that False Start is disabled with DHE_RSA ciphers. | 3178 // Test that False Start is disabled with DHE_RSA ciphers. |
3176 TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) { | 3179 TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) { |
3177 SpawnedTestServer::SSLOptions server_options; | 3180 SpawnedTestServer::SSLOptions server_options; |
3178 server_options.key_exchanges = | 3181 server_options.key_exchanges = |
3179 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA; | 3182 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA; |
3180 server_options.bulk_ciphers = | 3183 server_options.bulk_ciphers = |
3181 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3184 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3182 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3185 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3183 SSLConfig client_config; | 3186 SSLConfig client_config; |
3184 client_config.next_protos.push_back(kProtoHTTP11); | 3187 client_config.alpn_protos.push_back(kProtoHTTP11); |
3188 client_config.npn_protos.push_back(kProtoHTTP11); | |
3185 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); | 3189 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); |
3186 } | 3190 } |
3187 | 3191 |
3188 // Test that False Start is disabled without an AEAD. | 3192 // Test that False Start is disabled without an AEAD. |
3189 TEST_F(SSLClientSocketFalseStartTest, NoAEAD) { | 3193 TEST_F(SSLClientSocketFalseStartTest, NoAEAD) { |
3190 SpawnedTestServer::SSLOptions server_options; | 3194 SpawnedTestServer::SSLOptions server_options; |
3191 server_options.key_exchanges = | 3195 server_options.key_exchanges = |
3192 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3196 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3193 server_options.bulk_ciphers = | 3197 server_options.bulk_ciphers = |
3194 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; | 3198 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; |
3195 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3199 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3196 SSLConfig client_config; | 3200 SSLConfig client_config; |
3197 client_config.next_protos.push_back(kProtoHTTP11); | 3201 client_config.alpn_protos.push_back(kProtoHTTP11); |
3202 client_config.npn_protos.push_back(kProtoHTTP11); | |
3198 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); | 3203 ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); |
3199 } | 3204 } |
3200 | 3205 |
3201 // Test that sessions are resumable after receiving the server Finished message. | 3206 // Test that sessions are resumable after receiving the server Finished message. |
3202 TEST_F(SSLClientSocketFalseStartTest, SessionResumption) { | 3207 TEST_F(SSLClientSocketFalseStartTest, SessionResumption) { |
3203 // Start a server. | 3208 // Start a server. |
3204 SpawnedTestServer::SSLOptions server_options; | 3209 SpawnedTestServer::SSLOptions server_options; |
3205 server_options.key_exchanges = | 3210 server_options.key_exchanges = |
3206 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3211 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3207 server_options.bulk_ciphers = | 3212 server_options.bulk_ciphers = |
3208 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3213 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3209 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3214 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3210 SSLConfig client_config; | 3215 SSLConfig client_config; |
3211 client_config.next_protos.push_back(kProtoHTTP11); | 3216 client_config.alpn_protos.push_back(kProtoHTTP11); |
3217 client_config.npn_protos.push_back(kProtoHTTP11); | |
3212 | 3218 |
3213 // Let a full handshake complete with False Start. | 3219 // Let a full handshake complete with False Start. |
3214 ASSERT_NO_FATAL_FAILURE( | 3220 ASSERT_NO_FATAL_FAILURE( |
3215 TestFalseStart(server_options, client_config, true)); | 3221 TestFalseStart(server_options, client_config, true)); |
3216 | 3222 |
3217 // Make a second connection. | 3223 // Make a second connection. |
3218 TestCompletionCallback callback; | 3224 TestCompletionCallback callback; |
3219 scoped_ptr<StreamSocket> transport2( | 3225 scoped_ptr<StreamSocket> transport2( |
3220 new TCPClientSocket(addr(), &log_, NetLog::Source())); | 3226 new TCPClientSocket(addr(), &log_, NetLog::Source())); |
3221 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback()))); | 3227 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback()))); |
(...skipping 14 matching lines...) Expand all Loading... | |
3236 // Start a server. | 3242 // Start a server. |
3237 SpawnedTestServer::SSLOptions server_options; | 3243 SpawnedTestServer::SSLOptions server_options; |
3238 server_options.key_exchanges = | 3244 server_options.key_exchanges = |
3239 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3245 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3240 server_options.bulk_ciphers = | 3246 server_options.bulk_ciphers = |
3241 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3247 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3242 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3248 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3243 ASSERT_TRUE(StartTestServer(server_options)); | 3249 ASSERT_TRUE(StartTestServer(server_options)); |
3244 | 3250 |
3245 SSLConfig client_config; | 3251 SSLConfig client_config; |
3246 client_config.next_protos.push_back(kProtoHTTP11); | 3252 client_config.alpn_protos.push_back(kProtoHTTP11); |
3253 client_config.npn_protos.push_back(kProtoHTTP11); | |
3247 | 3254 |
3248 // Start a handshake up to the server Finished message. | 3255 // Start a handshake up to the server Finished message. |
3249 TestCompletionCallback callback; | 3256 TestCompletionCallback callback; |
3250 FakeBlockingStreamSocket* raw_transport1 = NULL; | 3257 FakeBlockingStreamSocket* raw_transport1 = NULL; |
3251 scoped_ptr<SSLClientSocket> sock1; | 3258 scoped_ptr<SSLClientSocket> sock1; |
3252 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( | 3259 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( |
3253 client_config, &callback, &raw_transport1, &sock1)); | 3260 client_config, &callback, &raw_transport1, &sock1)); |
3254 // Although raw_transport1 has the server Finished blocked, the handshake | 3261 // Although raw_transport1 has the server Finished blocked, the handshake |
3255 // still completes. | 3262 // still completes. |
3256 EXPECT_EQ(OK, callback.WaitForResult()); | 3263 EXPECT_EQ(OK, callback.WaitForResult()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3294 // Start a server. | 3301 // Start a server. |
3295 SpawnedTestServer::SSLOptions server_options; | 3302 SpawnedTestServer::SSLOptions server_options; |
3296 server_options.key_exchanges = | 3303 server_options.key_exchanges = |
3297 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; | 3304 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA; |
3298 server_options.bulk_ciphers = | 3305 server_options.bulk_ciphers = |
3299 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; | 3306 SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
3300 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3307 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3301 ASSERT_TRUE(StartTestServer(server_options)); | 3308 ASSERT_TRUE(StartTestServer(server_options)); |
3302 | 3309 |
3303 SSLConfig client_config; | 3310 SSLConfig client_config; |
3304 client_config.next_protos.push_back(kProtoHTTP11); | 3311 client_config.alpn_protos.push_back(kProtoHTTP11); |
3312 client_config.npn_protos.push_back(kProtoHTTP11); | |
3305 | 3313 |
3306 // Start a handshake up to the server Finished message. | 3314 // Start a handshake up to the server Finished message. |
3307 TestCompletionCallback callback; | 3315 TestCompletionCallback callback; |
3308 FakeBlockingStreamSocket* raw_transport1 = NULL; | 3316 FakeBlockingStreamSocket* raw_transport1 = NULL; |
3309 scoped_ptr<SSLClientSocket> sock1; | 3317 scoped_ptr<SSLClientSocket> sock1; |
3310 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( | 3318 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( |
3311 client_config, &callback, &raw_transport1, &sock1)); | 3319 client_config, &callback, &raw_transport1, &sock1)); |
3312 // Although raw_transport1 has the server Finished blocked, the handshake | 3320 // Although raw_transport1 has the server Finished blocked, the handshake |
3313 // still completes. | 3321 // still completes. |
3314 EXPECT_EQ(OK, callback.WaitForResult()); | 3322 EXPECT_EQ(OK, callback.WaitForResult()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3411 SSLConfig ssl_config; | 3419 SSLConfig ssl_config; |
3412 ssl_config.channel_id_enabled = true; | 3420 ssl_config.channel_id_enabled = true; |
3413 | 3421 |
3414 int rv; | 3422 int rv; |
3415 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3423 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
3416 | 3424 |
3417 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3425 EXPECT_EQ(ERR_UNEXPECTED, rv); |
3418 EXPECT_FALSE(sock_->IsConnected()); | 3426 EXPECT_FALSE(sock_->IsConnected()); |
3419 } | 3427 } |
3420 | 3428 |
3429 // Because of quirks of the NSS implementation, in the following NPN tests, | |
3430 // client_config.alpn_protos needs to be set, because NSS uses it for NPN (it | |
3431 // has to use the same string as for ALPN), and client_config.npn_protos needs | |
3432 // to be non-empty, otherwise NSS disables NPN. | |
3433 | |
3421 TEST_F(SSLClientSocketTest, NPN) { | 3434 TEST_F(SSLClientSocketTest, NPN) { |
3422 SpawnedTestServer::SSLOptions server_options; | 3435 SpawnedTestServer::SSLOptions server_options; |
3423 server_options.npn_protocols.push_back(std::string("spdy/3.1")); | 3436 server_options.npn_protocols.push_back(std::string("spdy/3.1")); |
3424 server_options.npn_protocols.push_back(std::string("h2")); | 3437 server_options.npn_protocols.push_back(std::string("h2")); |
3425 ASSERT_TRUE(ConnectToTestServer(server_options)); | 3438 ASSERT_TRUE(ConnectToTestServer(server_options)); |
3426 | 3439 |
3427 SSLConfig client_config; | 3440 SSLConfig client_config; |
3428 client_config.next_protos.push_back(kProtoHTTP2); | 3441 #if !defined(USE_OPENSSL) |
3429 client_config.next_protos.push_back(kProtoHTTP11); | 3442 client_config.alpn_protos.push_back(kProtoHTTP2); |
3443 client_config.alpn_protos.push_back(kProtoHTTP11); | |
3444 #endif | |
3445 client_config.npn_protos.push_back(kProtoHTTP2); | |
3446 client_config.npn_protos.push_back(kProtoHTTP11); | |
3430 | 3447 |
3431 int rv; | 3448 int rv; |
3432 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); | 3449 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
3433 EXPECT_EQ(OK, rv); | 3450 EXPECT_EQ(OK, rv); |
3434 | 3451 |
3435 std::string proto; | 3452 std::string proto; |
3436 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); | 3453 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); |
3437 EXPECT_EQ("h2", proto); | 3454 EXPECT_EQ("h2", proto); |
3438 } | 3455 } |
3439 | 3456 |
3440 // In case of no overlap between client and server list, SSLClientSocket should | 3457 // In case of no overlap between client and server list, SSLClientSocket should |
3441 // fall back to last one on the client list. | 3458 // fall back to last one on the client list. |
3442 TEST_F(SSLClientSocketTest, NPNNoOverlap) { | 3459 TEST_F(SSLClientSocketTest, NPNNoOverlap) { |
3443 SpawnedTestServer::SSLOptions server_options; | 3460 SpawnedTestServer::SSLOptions server_options; |
3444 server_options.npn_protocols.push_back(std::string("http/1.1")); | 3461 server_options.npn_protocols.push_back(std::string("http/1.1")); |
3445 ASSERT_TRUE(ConnectToTestServer(server_options)); | 3462 ASSERT_TRUE(ConnectToTestServer(server_options)); |
3446 | 3463 |
3447 SSLConfig client_config; | 3464 SSLConfig client_config; |
3448 client_config.next_protos.push_back(kProtoSPDY31); | 3465 #if !defined(USE_OPENSSL) |
3449 client_config.next_protos.push_back(kProtoHTTP2); | 3466 client_config.alpn_protos.push_back(kProtoSPDY31); |
3467 client_config.alpn_protos.push_back(kProtoHTTP2); | |
3468 #endif | |
3469 client_config.npn_protos.push_back(kProtoSPDY31); | |
3470 client_config.npn_protos.push_back(kProtoHTTP2); | |
3450 | 3471 |
3451 int rv; | 3472 int rv; |
3452 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); | 3473 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
3453 EXPECT_EQ(OK, rv); | 3474 EXPECT_EQ(OK, rv); |
3454 | 3475 |
3455 std::string proto; | 3476 std::string proto; |
3456 EXPECT_EQ(SSLClientSocket::kNextProtoNoOverlap, sock_->GetNextProto(&proto)); | 3477 EXPECT_EQ(SSLClientSocket::kNextProtoNoOverlap, sock_->GetNextProto(&proto)); |
3457 EXPECT_EQ("h2", proto); | 3478 EXPECT_EQ("h2", proto); |
3458 } | 3479 } |
3459 | 3480 |
3460 // Server preference should be respected. The list is in decreasing order of | 3481 // Server preference should be respected. The list is in decreasing order of |
3461 // preference. | 3482 // preference. |
3462 TEST_F(SSLClientSocketTest, NPNServerPreference) { | 3483 TEST_F(SSLClientSocketTest, NPNServerPreference) { |
3463 SpawnedTestServer::SSLOptions server_options; | 3484 SpawnedTestServer::SSLOptions server_options; |
3464 server_options.npn_protocols.push_back(std::string("spdy/3.1")); | 3485 server_options.npn_protocols.push_back(std::string("spdy/3.1")); |
3465 server_options.npn_protocols.push_back(std::string("h2")); | 3486 server_options.npn_protocols.push_back(std::string("h2")); |
3466 ASSERT_TRUE(ConnectToTestServer(server_options)); | 3487 ASSERT_TRUE(ConnectToTestServer(server_options)); |
3467 | 3488 |
3468 SSLConfig client_config; | 3489 SSLConfig client_config; |
3469 client_config.next_protos.push_back(kProtoHTTP2); | 3490 #if !defined(USE_OPENSSL) |
3470 client_config.next_protos.push_back(kProtoSPDY31); | 3491 client_config.alpn_protos.push_back(kProtoHTTP2); |
3492 client_config.alpn_protos.push_back(kProtoSPDY31); | |
3493 #endif | |
3494 client_config.npn_protos.push_back(kProtoHTTP2); | |
3495 client_config.npn_protos.push_back(kProtoSPDY31); | |
3471 | 3496 |
3472 int rv; | 3497 int rv; |
3473 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); | 3498 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
3474 EXPECT_EQ(OK, rv); | 3499 EXPECT_EQ(OK, rv); |
3475 | 3500 |
3476 std::string proto; | 3501 std::string proto; |
3477 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); | 3502 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto)); |
3478 EXPECT_EQ("spdy/3.1", proto); | 3503 EXPECT_EQ("spdy/3.1", proto); |
3479 } | 3504 } |
3480 | 3505 |
(...skipping 11 matching lines...) Expand all Loading... | |
3492 std::string proto; | 3517 std::string proto; |
3493 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, | 3518 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, |
3494 sock_->GetNextProto(&proto)); | 3519 sock_->GetNextProto(&proto)); |
3495 } | 3520 } |
3496 | 3521 |
3497 TEST_F(SSLClientSocketTest, NPNServerDisabled) { | 3522 TEST_F(SSLClientSocketTest, NPNServerDisabled) { |
3498 SpawnedTestServer::SSLOptions server_options; | 3523 SpawnedTestServer::SSLOptions server_options; |
3499 ASSERT_TRUE(ConnectToTestServer(server_options)); | 3524 ASSERT_TRUE(ConnectToTestServer(server_options)); |
3500 | 3525 |
3501 SSLConfig client_config; | 3526 SSLConfig client_config; |
3502 client_config.next_protos.push_back(kProtoHTTP11); | 3527 #if !defined(USE_OPENSSL) |
3528 client_config.alpn_protos.push_back(kProtoHTTP11); | |
3529 #endif | |
3530 client_config.npn_protos.push_back(kProtoHTTP11); | |
3503 | 3531 |
3504 int rv; | 3532 int rv; |
3505 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); | 3533 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
3506 EXPECT_EQ(OK, rv); | 3534 EXPECT_EQ(OK, rv); |
3507 | 3535 |
3508 std::string proto; | 3536 std::string proto; |
3509 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, | 3537 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, |
3510 sock_->GetNextProto(&proto)); | 3538 sock_->GetNextProto(&proto)); |
3511 } | 3539 } |
3512 | 3540 |
3513 } // namespace net | 3541 } // namespace net |
OLD | NEW |