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 "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1507 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool( | 1507 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool( |
| 1508 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1508 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1509 EXPECT_EQ(0, GetSocketPoolGroupCount( | 1509 EXPECT_EQ(0, GetSocketPoolGroupCount( |
| 1510 session->GetTransportSocketPool( | 1510 session->GetTransportSocketPool( |
| 1511 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 1511 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
| 1512 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool( | 1512 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool( |
| 1513 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 1513 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
| 1514 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1514 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 // Test the race of SetPriority versus stream completion where SetPriority | |
| 1518 // may be called on a stream request after the stream has been returned. | |
|
mmenke
2017/01/06 20:48:54
Is this really needed by the API? Should be possi
Randy Smith (Not in Mondays)
2017/01/13 23:05:44
As phrased, not, but I wanted to do a crash test a
| |
| 1519 TEST_F(HttpStreamFactoryTest, ReprioritizeAfterStreamReceived) { | |
| 1520 SpdySessionDependencies session_deps(ProxyService::CreateDirect()); | |
| 1521 | |
| 1522 StaticSocketDataProvider socket_data; | |
| 1523 socket_data.set_connect_data(MockConnect(ASYNC, OK)); | |
| 1524 session_deps.socket_factory->AddSocketDataProvider(&socket_data); | |
| 1525 | |
| 1526 std::unique_ptr<HttpNetworkSession> session( | |
| 1527 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | |
| 1528 | |
| 1529 // Now request a stream. It should succeed using the second proxy in the | |
| 1530 // list. | |
| 1531 HttpRequestInfo request_info; | |
| 1532 request_info.method = "GET"; | |
| 1533 request_info.url = GURL("http://www.google.com"); | |
| 1534 request_info.load_flags = 0; | |
| 1535 | |
| 1536 SSLConfig ssl_config; | |
| 1537 StreamRequestWaiter waiter; | |
| 1538 std::unique_ptr<HttpStreamRequest> request( | |
| 1539 session->http_stream_factory()->RequestStream( | |
| 1540 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, | |
| 1541 NetLogWithSource())); | |
| 1542 waiter.WaitForStream(); | |
| 1543 EXPECT_TRUE(waiter.stream_done()); | |
| 1544 ASSERT_TRUE(nullptr != waiter.stream()); | |
| 1545 EXPECT_TRUE(nullptr == waiter.websocket_stream()); | |
| 1546 | |
| 1547 // Crash test | |
|
mmenke
2017/01/06 20:48:54
Should not crash test?
Randy Smith (Not in Mondays)
2017/01/13 23:05:44
Done (in the new test).
| |
| 1548 request->SetPriority(HIGHEST); | |
| 1549 } | |
| 1550 | |
| 1517 TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverSSL) { | 1551 TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverSSL) { |
| 1518 SpdySessionDependencies session_deps(ProxyService::CreateDirect()); | 1552 SpdySessionDependencies session_deps(ProxyService::CreateDirect()); |
| 1519 | 1553 |
| 1520 MockRead mock_read(ASYNC, OK); | 1554 MockRead mock_read(ASYNC, OK); |
| 1521 StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0); | 1555 StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0); |
| 1522 socket_data.set_connect_data(MockConnect(ASYNC, OK)); | 1556 socket_data.set_connect_data(MockConnect(ASYNC, OK)); |
| 1523 session_deps.socket_factory->AddSocketDataProvider(&socket_data); | 1557 session_deps.socket_factory->AddSocketDataProvider(&socket_data); |
| 1524 | 1558 |
| 1525 SSLSocketDataProvider ssl_socket_data(ASYNC, OK); | 1559 SSLSocketDataProvider ssl_socket_data(ASYNC, OK); |
| 1526 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl_socket_data); | 1560 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl_socket_data); |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2512 session->GetTransportSocketPool( | 2546 session->GetTransportSocketPool( |
| 2513 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 2547 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
| 2514 EXPECT_EQ(1, GetSocketPoolGroupCount( | 2548 EXPECT_EQ(1, GetSocketPoolGroupCount( |
| 2515 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 2549 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
| 2516 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 2550 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 2517 } | 2551 } |
| 2518 | 2552 |
| 2519 } // namespace | 2553 } // namespace |
| 2520 | 2554 |
| 2521 } // namespace net | 2555 } // namespace net |
| OLD | NEW |