Index: net/socket/ssl_client_socket_unittest.cc |
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc |
index d151cfbf18b25939085a2a0bf2f1f0f3ad179724..b3506cc58d45436ba4cc5bf34da3855b767884d1 100644 |
--- a/net/socket/ssl_client_socket_unittest.cc |
+++ b/net/socket/ssl_client_socket_unittest.cc |
@@ -3140,7 +3140,8 @@ TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) { |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
server_options.npn_protocols.push_back(std::string("http/1.1")); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ 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.
|
+ client_config.npn_protos.push_back(kProtoHTTP11); |
ASSERT_NO_FATAL_FAILURE( |
TestFalseStart(server_options, client_config, true)); |
} |
@@ -3153,7 +3154,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoNPN) { |
server_options.bulk_ciphers = |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
SSLConfig client_config; |
- client_config.next_protos.clear(); |
+ client_config.alpn_protos.clear(); |
+ client_config.npn_protos.clear(); |
ASSERT_NO_FATAL_FAILURE( |
TestFalseStart(server_options, client_config, false)); |
} |
@@ -3167,7 +3169,8 @@ TEST_F(SSLClientSocketFalseStartTest, RSA) { |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
server_options.npn_protocols.push_back(std::string("http/1.1")); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
ASSERT_NO_FATAL_FAILURE( |
TestFalseStart(server_options, client_config, false)); |
} |
@@ -3181,7 +3184,8 @@ TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) { |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
server_options.npn_protocols.push_back(std::string("http/1.1")); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); |
} |
@@ -3194,7 +3198,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoAEAD) { |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; |
server_options.npn_protocols.push_back(std::string("http/1.1")); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false)); |
} |
@@ -3208,7 +3213,8 @@ TEST_F(SSLClientSocketFalseStartTest, SessionResumption) { |
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM; |
server_options.npn_protocols.push_back(std::string("http/1.1")); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
// Let a full handshake complete with False Start. |
ASSERT_NO_FATAL_FAILURE( |
@@ -3243,7 +3249,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBeforeFinished) { |
ASSERT_TRUE(StartTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
// Start a handshake up to the server Finished message. |
TestCompletionCallback callback; |
@@ -3301,7 +3308,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBadFinished) { |
ASSERT_TRUE(StartTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
// Start a handshake up to the server Finished message. |
TestCompletionCallback callback; |
@@ -3418,6 +3426,11 @@ TEST_F(SSLClientSocketChannelIDTest, FailingChannelIDAsync) { |
EXPECT_FALSE(sock_->IsConnected()); |
} |
+// Because of quirks of the NSS implementation, in the following NPN tests, |
+// client_config.alpn_protos needs to be set, because NSS uses it for NPN (it |
+// has to use the same string as for ALPN), and client_config.npn_protos needs |
+// to be non-empty, otherwise NSS disables NPN. |
+ |
TEST_F(SSLClientSocketTest, NPN) { |
SpawnedTestServer::SSLOptions server_options; |
server_options.npn_protocols.push_back(std::string("spdy/3.1")); |
@@ -3425,8 +3438,12 @@ TEST_F(SSLClientSocketTest, NPN) { |
ASSERT_TRUE(ConnectToTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP2); |
- client_config.next_protos.push_back(kProtoHTTP11); |
+#if !defined(USE_OPENSSL) |
+ client_config.alpn_protos.push_back(kProtoHTTP2); |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+#endif |
+ client_config.npn_protos.push_back(kProtoHTTP2); |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
int rv; |
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
@@ -3445,8 +3462,12 @@ TEST_F(SSLClientSocketTest, NPNNoOverlap) { |
ASSERT_TRUE(ConnectToTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoSPDY31); |
- client_config.next_protos.push_back(kProtoHTTP2); |
+#if !defined(USE_OPENSSL) |
+ client_config.alpn_protos.push_back(kProtoSPDY31); |
+ client_config.alpn_protos.push_back(kProtoHTTP2); |
+#endif |
+ client_config.npn_protos.push_back(kProtoSPDY31); |
+ client_config.npn_protos.push_back(kProtoHTTP2); |
int rv; |
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
@@ -3466,8 +3487,12 @@ TEST_F(SSLClientSocketTest, NPNServerPreference) { |
ASSERT_TRUE(ConnectToTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP2); |
- client_config.next_protos.push_back(kProtoSPDY31); |
+#if !defined(USE_OPENSSL) |
+ client_config.alpn_protos.push_back(kProtoHTTP2); |
+ client_config.alpn_protos.push_back(kProtoSPDY31); |
+#endif |
+ client_config.npn_protos.push_back(kProtoHTTP2); |
+ client_config.npn_protos.push_back(kProtoSPDY31); |
int rv; |
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |
@@ -3499,7 +3524,10 @@ TEST_F(SSLClientSocketTest, NPNServerDisabled) { |
ASSERT_TRUE(ConnectToTestServer(server_options)); |
SSLConfig client_config; |
- client_config.next_protos.push_back(kProtoHTTP11); |
+#if !defined(USE_OPENSSL) |
+ client_config.alpn_protos.push_back(kProtoHTTP11); |
+#endif |
+ client_config.npn_protos.push_back(kProtoHTTP11); |
int rv; |
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); |