Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 1898133002: Add reprioritization to socket pools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix glitch in ClientSocketHandle API contract. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a14335269cbe3992eef2b38a7229e9f365f69838 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -1514,6 +1514,40 @@ 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 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
+TEST_F(HttpStreamFactoryTest, ReprioritizeAfterStreamReceived) {
+ SpdySessionDependencies session_deps(ProxyService::CreateDirect());
+
+ StaticSocketDataProvider socket_data;
+ socket_data.set_connect_data(MockConnect(ASYNC, 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, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
+ NetLogWithSource()));
+ waiter.WaitForStream();
+ EXPECT_TRUE(waiter.stream_done());
+ ASSERT_TRUE(nullptr != waiter.stream());
+ EXPECT_TRUE(nullptr == waiter.websocket_stream());
+
+ // 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).
+ request->SetPriority(HIGHEST);
+}
+
TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverSSL) {
SpdySessionDependencies session_deps(ProxyService::CreateDirect());

Powered by Google App Engine
This is Rietveld 408576698