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 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5398 EXPECT_EQ("insert", parts[0]); | 5398 EXPECT_EQ("insert", parts[0]); |
| 5399 if (i == 0) { | 5399 if (i == 0) { |
| 5400 session_id = parts[1]; | 5400 session_id = parts[1]; |
| 5401 } else { | 5401 } else { |
| 5402 EXPECT_NE(session_id, parts[1]); | 5402 EXPECT_NE(session_id, parts[1]); |
| 5403 } | 5403 } |
| 5404 } | 5404 } |
| 5405 } | 5405 } |
| 5406 } | 5406 } |
| 5407 | 5407 |
| 5408 TEST_F(HTTPSRequestTest, ClientHelloTest) { | |
| 5409 // Check that our ClientHello doesn't get too large because that's known to | |
| 5410 // cause issues. | |
|
wtc
2013/07/24 19:25:10
Nit: we usually put this kind of comment before th
agl
2013/07/29 16:58:37
Done.
| |
| 5411 | |
| 5412 SpawnedTestServer::SSLOptions ssl_options; | |
| 5413 SpawnedTestServer test_server( | |
| 5414 SpawnedTestServer::TYPE_HTTPS, | |
| 5415 ssl_options, | |
| 5416 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | |
| 5417 ASSERT_TRUE(test_server.Start()); | |
| 5418 | |
| 5419 // NPN/ALPN strings need to be enabled in order for the size of the handshake | |
| 5420 // to be accurate as ALPN includes these strings in the handshake. This will | |
| 5421 // be reset by NetTestSuite. | |
| 5422 HttpStreamFactory::EnableNpnSpdy4a2(); | |
| 5423 | |
| 5424 TestDelegate d; | |
| 5425 URLRequest r( | |
| 5426 test_server.GetURL("client-hello-length"), &d, &default_context_); | |
| 5427 | |
| 5428 r.Start(); | |
| 5429 EXPECT_TRUE(r.is_pending()); | |
| 5430 | |
| 5431 base::MessageLoop::current()->Run(); | |
| 5432 | |
| 5433 // The response will be a single, base 10 number which is the number of bytes | |
| 5434 // in the ClientHello, including the handshake message type byte and 3 byte | |
| 5435 // length at the beginning. | |
| 5436 | |
| 5437 EXPECT_EQ(1, d.response_started_count()); | |
| 5438 unsigned client_hello_length; | |
| 5439 ASSERT_TRUE(base::StringToUint(d.data_received(), &client_hello_length)); | |
| 5440 const unsigned sni_overhead = 2 /* extension type */ + | |
| 5441 2 /* extension length */ + | |
| 5442 4 /* lengths in the server_name extension */ + | |
| 5443 strlen("www.wellsfargo.com"); | |
|
wtc
2013/07/24 19:25:10
Why do we add the SNI overhead? Is it because this
agl
2013/07/29 16:58:37
Yes, have noted so in comment.
| |
| 5444 static const unsigned session_id_overhead = 32; | |
| 5445 | |
| 5446 EXPECT_LT(client_hello_length + sni_overhead + session_id_overhead, 256u); | |
|
wtc
2013/07/24 19:25:10
Nit: it may be better to reverse this:
EXPECT_GT
| |
| 5447 } | |
| 5448 | |
| 5408 class TestSSLConfigService : public SSLConfigService { | 5449 class TestSSLConfigService : public SSLConfigService { |
| 5409 public: | 5450 public: |
| 5410 TestSSLConfigService(bool ev_enabled, bool online_rev_checking) | 5451 TestSSLConfigService(bool ev_enabled, bool online_rev_checking) |
| 5411 : ev_enabled_(ev_enabled), | 5452 : ev_enabled_(ev_enabled), |
| 5412 online_rev_checking_(online_rev_checking) { | 5453 online_rev_checking_(online_rev_checking) { |
| 5413 } | 5454 } |
| 5414 | 5455 |
| 5415 // SSLConfigService: | 5456 // SSLConfigService: |
| 5416 virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { | 5457 virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { |
| 5417 *config = SSLConfig(); | 5458 *config = SSLConfig(); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6112 | 6153 |
| 6113 EXPECT_FALSE(r.is_pending()); | 6154 EXPECT_FALSE(r.is_pending()); |
| 6114 EXPECT_EQ(1, d->response_started_count()); | 6155 EXPECT_EQ(1, d->response_started_count()); |
| 6115 EXPECT_FALSE(d->received_data_before_response()); | 6156 EXPECT_FALSE(d->received_data_before_response()); |
| 6116 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 6157 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 6117 } | 6158 } |
| 6118 } | 6159 } |
| 6119 #endif // !defined(DISABLE_FTP_SUPPORT) | 6160 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 6120 | 6161 |
| 6121 } // namespace net | 6162 } // namespace net |
| OLD | NEW |