Chromium Code Reviews| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #endif | 10 #endif |
| (...skipping 5388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5399 EXPECT_EQ("insert", parts[0]); | 5399 EXPECT_EQ("insert", parts[0]); |
| 5400 if (i == 0) { | 5400 if (i == 0) { |
| 5401 session_id = parts[1]; | 5401 session_id = parts[1]; |
| 5402 } else { | 5402 } else { |
| 5403 EXPECT_NE(session_id, parts[1]); | 5403 EXPECT_NE(session_id, parts[1]); |
| 5404 } | 5404 } |
| 5405 } | 5405 } |
| 5406 } | 5406 } |
| 5407 } | 5407 } |
| 5408 | 5408 |
| 5409 TEST_F(HTTPSRequestTest, ClientHelloTest) { | |
| 5410 // Check that our ClientHello doesn't get too large because that's known to | |
| 5411 // cause issues. | |
| 5412 | |
| 5413 SpawnedTestServer::SSLOptions ssl_options; | |
| 5414 SpawnedTestServer test_server( | |
| 5415 SpawnedTestServer::TYPE_HTTPS, | |
| 5416 ssl_options, | |
| 5417 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | |
| 5418 ASSERT_TRUE(test_server.Start()); | |
| 5419 | |
| 5420 HttpStreamFactory::EnableNpnSpdy4a2(); | |
|
Ryan Sleevi
2013/07/23 20:50:02
Need a comment explaining why this is being called
agl
2013/07/24 18:09:18
Done. This will be reset by NetTestSuite; have not
| |
| 5421 | |
| 5422 TestDelegate d; | |
| 5423 URLRequest r( | |
| 5424 test_server.GetURL("client-hello-length"), &d, &default_context_); | |
| 5425 | |
| 5426 r.Start(); | |
| 5427 EXPECT_TRUE(r.is_pending()); | |
| 5428 | |
| 5429 base::MessageLoop::current()->Run(); | |
| 5430 | |
| 5431 // The response will be a single, base 10 number which is the number of bytes | |
| 5432 // in the ClientHello, including the handshake message type byte and 3 byte | |
| 5433 // length at the beginning. | |
| 5434 | |
| 5435 EXPECT_EQ(1, d.response_started_count()); | |
| 5436 unsigned client_hello_length; | |
| 5437 ASSERT_TRUE(base::StringToUint(d.data_received(), &client_hello_length)); | |
| 5438 const unsigned sni_overhead = 2 /* extension type */ + | |
| 5439 2 /* extension length */ + | |
| 5440 4 /* lengths in the server_name extension */ + | |
| 5441 strlen("www.wellsfargo.com"); | |
|
Ryan Sleevi
2013/07/23 20:50:02
I don't quite get why you chose this, or incorpora
agl
2013/07/24 18:09:18
www.wellsfargo.com is probably the biggest site wi
| |
| 5442 static const unsigned session_id_overhead = 32; | |
| 5443 | |
| 5444 EXPECT_LT(client_hello_length + sni_overhead + session_id_overhead, 256u); | |
| 5445 } | |
| 5446 | |
| 5409 class TestSSLConfigService : public SSLConfigService { | 5447 class TestSSLConfigService : public SSLConfigService { |
| 5410 public: | 5448 public: |
| 5411 TestSSLConfigService(bool ev_enabled, bool online_rev_checking) | 5449 TestSSLConfigService(bool ev_enabled, bool online_rev_checking) |
| 5412 : ev_enabled_(ev_enabled), | 5450 : ev_enabled_(ev_enabled), |
| 5413 online_rev_checking_(online_rev_checking) { | 5451 online_rev_checking_(online_rev_checking) { |
| 5414 } | 5452 } |
| 5415 | 5453 |
| 5416 // SSLConfigService: | 5454 // SSLConfigService: |
| 5417 virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { | 5455 virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { |
| 5418 *config = SSLConfig(); | 5456 *config = SSLConfig(); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6113 | 6151 |
| 6114 EXPECT_FALSE(r.is_pending()); | 6152 EXPECT_FALSE(r.is_pending()); |
| 6115 EXPECT_EQ(1, d->response_started_count()); | 6153 EXPECT_EQ(1, d->response_started_count()); |
| 6116 EXPECT_FALSE(d->received_data_before_response()); | 6154 EXPECT_FALSE(d->received_data_before_response()); |
| 6117 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 6155 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 6118 } | 6156 } |
| 6119 } | 6157 } |
| 6120 #endif // !defined(DISABLE_FTP_SUPPORT) | 6158 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 6121 | 6159 |
| 6122 } // namespace net | 6160 } // namespace net |
| OLD | NEW |