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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1866483002: Add a new priority level, THROTTLED, below IDLE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusted predictor priorities. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 7789 matching lines...) Expand 10 before | Expand all | Expand 10 after
7800 std::unique_ptr<URLRequest> req( 7800 std::unique_ptr<URLRequest> req(
7801 default_context_.CreateRequest(test_url, DEFAULT_PRIORITY, &d)); 7801 default_context_.CreateRequest(test_url, DEFAULT_PRIORITY, &d));
7802 req->SetLoadFlags(LOAD_ONLY_FROM_CACHE); 7802 req->SetLoadFlags(LOAD_ONLY_FROM_CACHE);
7803 7803
7804 req->Start(); 7804 req->Start();
7805 base::RunLoop().Run(); 7805 base::RunLoop().Run();
7806 7806
7807 EXPECT_FALSE(req->response_info().network_accessed); 7807 EXPECT_FALSE(req->response_info().network_accessed);
7808 } 7808 }
7809 7809
7810 // Test that a single job with a throttled priority completes
7811 // correctly in the absence of contention.
7812 TEST_F(URLRequestTestHTTP, ThrottledPriority) {
7813 ASSERT_TRUE(http_test_server()->Start());
7814
7815 TestDelegate d;
7816 GURL test_url(http_test_server()->GetURL("/"));
7817 std::unique_ptr<URLRequest> req(
7818 default_context_.CreateRequest(test_url, THROTTLED, &d));
7819 req->Start();
7820 base::RunLoop().Run();
7821
7822 EXPECT_TRUE(req->status().is_success());
7823 }
7824
7810 TEST_F(URLRequestTestHTTP, RawBodyBytesNoContentEncoding) { 7825 TEST_F(URLRequestTestHTTP, RawBodyBytesNoContentEncoding) {
7811 ASSERT_TRUE(http_test_server()->Start()); 7826 ASSERT_TRUE(http_test_server()->Start());
7812 7827
7813 TestDelegate d; 7828 TestDelegate d;
7814 std::unique_ptr<URLRequest> req(default_context().CreateRequest( 7829 std::unique_ptr<URLRequest> req(default_context().CreateRequest(
7815 http_test_server()->GetURL("/simple.html"), DEFAULT_PRIORITY, &d)); 7830 http_test_server()->GetURL("/simple.html"), DEFAULT_PRIORITY, &d));
7816 req->Start(); 7831 req->Start();
7817 base::RunLoop().Run(); 7832 base::RunLoop().Run();
7818 7833
7819 EXPECT_EQ(5, req->GetRawBodyBytes()); 7834 EXPECT_EQ(5, req->GetRawBodyBytes());
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
10218 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10233 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10219 10234
10220 req->Start(); 10235 req->Start();
10221 req->Cancel(); 10236 req->Cancel();
10222 base::RunLoop().RunUntilIdle(); 10237 base::RunLoop().RunUntilIdle();
10223 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10238 EXPECT_EQ(ERR_ABORTED, d.request_status());
10224 EXPECT_EQ(0, d.received_redirect_count()); 10239 EXPECT_EQ(0, d.received_redirect_count());
10225 } 10240 }
10226 10241
10227 } // namespace net 10242 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698