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

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

Issue 1371263002: Refactor SSLClientSocket::SerializeNextProtos(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move DisableHTTP2 to next_protos. 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') | no next file » | 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 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 // explicit NSS initialization. 2366 // explicit NSS initialization.
2367 TEST(SSLClientSocket, ClearSessionCache) { 2367 TEST(SSLClientSocket, ClearSessionCache) {
2368 SSLClientSocket::ClearSessionCache(); 2368 SSLClientSocket::ClearSessionCache();
2369 } 2369 }
2370 2370
2371 TEST(SSLClientSocket, SerializeNextProtos) { 2371 TEST(SSLClientSocket, SerializeNextProtos) {
2372 NextProtoVector next_protos; 2372 NextProtoVector next_protos;
2373 next_protos.push_back(kProtoHTTP11); 2373 next_protos.push_back(kProtoHTTP11);
2374 next_protos.push_back(kProtoSPDY31); 2374 next_protos.push_back(kProtoSPDY31);
2375 static std::vector<uint8_t> serialized = 2375 static std::vector<uint8_t> serialized =
2376 SSLClientSocket::SerializeNextProtos(next_protos, true); 2376 SSLClientSocket::SerializeNextProtos(next_protos);
2377 ASSERT_EQ(18u, serialized.size()); 2377 ASSERT_EQ(18u, serialized.size());
2378 EXPECT_EQ(8, serialized[0]); // length("http/1.1") 2378 EXPECT_EQ(8, serialized[0]); // length("http/1.1")
2379 EXPECT_EQ('h', serialized[1]); 2379 EXPECT_EQ('h', serialized[1]);
2380 EXPECT_EQ('t', serialized[2]); 2380 EXPECT_EQ('t', serialized[2]);
2381 EXPECT_EQ('t', serialized[3]); 2381 EXPECT_EQ('t', serialized[3]);
2382 EXPECT_EQ('p', serialized[4]); 2382 EXPECT_EQ('p', serialized[4]);
2383 EXPECT_EQ('/', serialized[5]); 2383 EXPECT_EQ('/', serialized[5]);
2384 EXPECT_EQ('1', serialized[6]); 2384 EXPECT_EQ('1', serialized[6]);
2385 EXPECT_EQ('.', serialized[7]); 2385 EXPECT_EQ('.', serialized[7]);
2386 EXPECT_EQ('1', serialized[8]); 2386 EXPECT_EQ('1', serialized[8]);
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 ssl_config.channel_id_enabled = true; 3474 ssl_config.channel_id_enabled = true;
3475 3475
3476 int rv; 3476 int rv;
3477 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); 3477 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
3478 3478
3479 EXPECT_EQ(ERR_UNEXPECTED, rv); 3479 EXPECT_EQ(ERR_UNEXPECTED, rv);
3480 EXPECT_FALSE(sock_->IsConnected()); 3480 EXPECT_FALSE(sock_->IsConnected());
3481 } 3481 }
3482 3482
3483 } // namespace net 3483 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698