OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 1448 matching lines...) Loading... |
1459 data2_reads.push_back(MockRead(ASYNC, kHttpData, strlen(kHttpData), 2)); | 1459 data2_reads.push_back(MockRead(ASYNC, kHttpData, strlen(kHttpData), 2)); |
1460 data2_reads.push_back(MockRead(ASYNC, OK, 3)); | 1460 data2_reads.push_back(MockRead(ASYNC, OK, 3)); |
1461 } | 1461 } |
1462 SequencedSocketData data2(&data2_reads[0], data2_reads.size(), | 1462 SequencedSocketData data2(&data2_reads[0], data2_reads.size(), |
1463 &data2_writes[0], data2_writes.size()); | 1463 &data2_writes[0], data2_writes.size()); |
1464 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 1464 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
1465 | 1465 |
1466 // Preconnect a socket. | 1466 // Preconnect a socket. |
1467 SSLConfig ssl_config; | 1467 SSLConfig ssl_config; |
1468 session->ssl_config_service()->GetSSLConfig(&ssl_config); | 1468 session->ssl_config_service()->GetSSLConfig(&ssl_config); |
1469 session->GetNextProtos(&ssl_config.next_protos); | 1469 session->GetAlpnProtos(&ssl_config.alpn_protos); |
| 1470 session->GetNpnProtos(&ssl_config.npn_protos); |
1470 session->http_stream_factory()->PreconnectStreams(1, request, ssl_config, | 1471 session->http_stream_factory()->PreconnectStreams(1, request, ssl_config, |
1471 ssl_config); | 1472 ssl_config); |
1472 // Wait for the preconnect to complete. | 1473 // Wait for the preconnect to complete. |
1473 // TODO(davidben): Some way to wait for an idle socket count might be handy. | 1474 // TODO(davidben): Some way to wait for an idle socket count might be handy. |
1474 base::RunLoop().RunUntilIdle(); | 1475 base::RunLoop().RunUntilIdle(); |
1475 EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session.get())); | 1476 EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session.get())); |
1476 | 1477 |
1477 // Make the request. | 1478 // Make the request. |
1478 TestCompletionCallback callback; | 1479 TestCompletionCallback callback; |
1479 | 1480 |
(...skipping 13829 matching lines...) Loading... |
15309 std::string response_data; | 15310 std::string response_data; |
15310 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 15311 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
15311 | 15312 |
15312 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 15313 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
15313 trans->GetTotalSentBytes()); | 15314 trans->GetTotalSentBytes()); |
15314 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 15315 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
15315 trans->GetTotalReceivedBytes()); | 15316 trans->GetTotalReceivedBytes()); |
15316 } | 15317 } |
15317 | 15318 |
15318 } // namespace net | 15319 } // namespace net |
OLD | NEW |