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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2130493002: Implement THROTTLED priority semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NetworkStreamThrottler
Patch Set: Incorporate Charles' first set of comments. Created 4 years, 5 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
« net/base/network_throttle_manager_unittest.cc ('K') | « net/net.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index c99852be0d392e6b13226a6aa27fc9770d82da94..e78411e00a46c4011312f49ce0fd12ab52385f61 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -7891,7 +7891,7 @@ TEST_F(URLRequestTestHTTP, NetworkAccessedClearOnLoadOnlyFromCache) {
EXPECT_FALSE(req->response_info().network_accessed);
}
-// Test that a single job with a throttled priority completes
+// Test that a single job with a THROTTLED priority completes
// correctly in the absence of contention.
TEST_F(URLRequestTestHTTP, ThrottledPriority) {
ASSERT_TRUE(http_test_server()->Start());
@@ -7906,6 +7906,31 @@ TEST_F(URLRequestTestHTTP, ThrottledPriority) {
EXPECT_TRUE(req->status().is_success());
}
+// Test that three jobs with THROTTLED priorities complete
+// correctly in the absence of contention (the completion of the
+// first one will unthrottle the third, but there is no visibility
+// to that at this level).
+TEST_F(URLRequestTestHTTP, MultiThrottledPriority) {
+ ASSERT_TRUE(http_test_server()->Start());
+
+ TestDelegate d;
+ GURL test_url(http_test_server()->GetURL("/"));
+ std::unique_ptr<URLRequest> req1(
+ default_context_.CreateRequest(test_url, THROTTLED, &d));
+ std::unique_ptr<URLRequest> req2(
+ default_context_.CreateRequest(test_url, THROTTLED, &d));
+ std::unique_ptr<URLRequest> req3(
+ default_context_.CreateRequest(test_url, THROTTLED, &d));
+ req1->Start();
+ req2->Start();
+ req3->Start();
+ base::RunLoop().Run();
+
+ EXPECT_TRUE(req1->status().is_success());
+ EXPECT_TRUE(req2->status().is_success());
+ EXPECT_TRUE(req3->status().is_success());
+}
+
class URLRequestInterceptorTestHTTP : public URLRequestTestHTTP {
public:
// TODO(bengr): Merge this with the URLRequestInterceptorHTTPTest fixture,
« net/base/network_throttle_manager_unittest.cc ('K') | « net/net.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698