Chromium Code Reviews| Index: net/http/http_stream_factory_impl_unittest.cc |
| diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc |
| index a33649090be28b3467eada923cb91343779cb0e5..d85da3713de608ac194c4ac72f3697384e948a54 100644 |
| --- a/net/http/http_stream_factory_impl_unittest.cc |
| +++ b/net/http/http_stream_factory_impl_unittest.cc |
| @@ -1514,6 +1514,44 @@ TEST_F(HttpStreamFactoryTest, RequestHttpStream) { |
| EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| } |
| +// Test the race of SetPriority versus stream completion where SetPriority |
| +// may be called on an HttpStreamFactoryImpl::Job after the stream |
| +// has been created by the job. |
| +TEST_F(HttpStreamFactoryTest, ReprioritizeAfterStreamReceived) { |
| + SpdySessionDependencies session_deps(ProxyService::CreateDirect()); |
| + |
| + StaticSocketDataProvider socket_data; |
| + socket_data.set_connect_data(MockConnect(SYNCHRONOUS, OK)); |
| + session_deps.socket_factory->AddSocketDataProvider(&socket_data); |
| + |
| + std::unique_ptr<HttpNetworkSession> session( |
| + SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| + |
| + // Now request a stream. It should succeed using the second proxy in the |
| + // list. |
| + HttpRequestInfo request_info; |
| + request_info.method = "GET"; |
| + request_info.url = GURL("http://www.google.com"); |
| + request_info.load_flags = 0; |
| + |
| + SSLConfig ssl_config; |
| + StreamRequestWaiter waiter; |
| + std::unique_ptr<HttpStreamRequest> request( |
| + session->http_stream_factory()->RequestStream( |
| + request_info, LOWEST, ssl_config, ssl_config, &waiter, |
| + NetLogWithSource())); |
| + EXPECT_FALSE(waiter.stream_done()); |
| + |
| + // Test to confirm that a SetPriority received after the stream is created |
| + // does not crash. |
|
mmenke
2017/01/18 20:37:26
Hrm...Is there some way we can verify the stream w
Randy Smith (Not in Mondays)
2017/01/22 21:37:00
I've modified the test to confirm that a session h
|
| + request->SetPriority(HIGHEST); |
| + |
| + waiter.WaitForStream(); |
| + EXPECT_TRUE(waiter.stream_done()); |
| + ASSERT_TRUE(nullptr != waiter.stream()); |
|
mmenke
2017/01/18 20:37:26
I believe you can ASSERT_TRUE(waiter.stream()); no
Randy Smith (Not in Mondays)
2017/01/22 21:37:00
Done.
|
| + EXPECT_TRUE(nullptr == waiter.websocket_stream()); |
|
mmenke
2017/01/18 20:37:27
Same as above (Except EXPECT_FALSE)
Randy Smith (Not in Mondays)
2017/01/22 21:37:00
Done.
|
| +} |
| + |
| TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverSSL) { |
| SpdySessionDependencies session_deps(ProxyService::CreateDirect()); |