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

Unified Diff: net/socket/ssl_client_socket_unittest.cc

Issue 801803002: Add SSLClientSocket::SerializeNextProtos unittest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 977c25b4aa82241d3bf6165472c4cf22e338d947..d650f627df44889770ff8c20da00476c2f83cfb8 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -2351,6 +2351,33 @@ TEST(SSLClientSocket, ClearSessionCache) {
SSLClientSocket::ClearSessionCache();
}
+TEST(SSLClientSocket, SerializeNextProtos) {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoSPDY31);
+ static std::vector<uint8_t> serialized =
+ SSLClientSocket::SerializeNextProtos(next_protos);
+ ASSERT_EQ(18u, serialized.size());
+ EXPECT_EQ(8, serialized[0]); // length("http/1.1")
+ EXPECT_EQ('h', serialized[1]);
+ EXPECT_EQ('t', serialized[2]);
+ EXPECT_EQ('t', serialized[3]);
+ EXPECT_EQ('p', serialized[4]);
+ EXPECT_EQ('/', serialized[5]);
+ EXPECT_EQ('1', serialized[6]);
+ EXPECT_EQ('.', serialized[7]);
+ EXPECT_EQ('1', serialized[8]);
+ EXPECT_EQ(8, serialized[9]); // length("spdy/3.1")
+ EXPECT_EQ('s', serialized[10]);
+ EXPECT_EQ('p', serialized[11]);
+ EXPECT_EQ('d', serialized[12]);
+ EXPECT_EQ('y', serialized[13]);
+ EXPECT_EQ('/', serialized[14]);
+ EXPECT_EQ('3', serialized[15]);
+ EXPECT_EQ('.', serialized[16]);
+ EXPECT_EQ('1', serialized[17]);
Ryan Hamilton 2014/12/12 15:12:12 Could you do something like EXPECT_EQ("\x08http/1.
Bence 2014/12/12 15:40:16 I couldn't quite do this, since one is a vector, t
+}
+
// Test that the server certificates are properly retrieved from the underlying
// SSL stack.
TEST_F(SSLClientSocketTest, VerifyServerChainProperlyOrdered) {
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698