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

Unified Diff: content/browser/loader/mojo_async_resource_handler_unittest.cc

Issue 2646343007: [Mojo-Loading] Implement URLLoader::SetPriority (Closed)
Patch Set: rebase 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: content/browser/loader/mojo_async_resource_handler_unittest.cc
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc
index 5d8db0ccf3c6066cf441d4dd3d554d70d89ccb5e..a2171bd0d348e91bc34436cd478d732c7a7f7d69 100644
--- a/content/browser/loader/mojo_async_resource_handler_unittest.cc
+++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -22,6 +22,7 @@
#include "content/browser/loader/resource_controller.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/loader/resource_request_info_impl.h"
+#include "content/browser/loader/resource_scheduler.h"
#include "content/browser/loader/test_url_loader_client.h"
#include "content/common/resource_request_completion_status.h"
#include "content/common/url_loader.mojom.h"
@@ -42,6 +43,7 @@
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/auth.h"
#include "net/base/net_errors.h"
+#include "net/base/request_priority.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_status_code.h"
@@ -945,6 +947,19 @@ TEST_F(MojoAsyncResourceHandlerUploadTest, UploadProgressHandling) {
EXPECT_EQ(1000, url_loader_client_.total_upload_size());
}
+TEST_F(MojoAsyncResourceHandlerTest, SetPriority) {
+ ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());
+ std::unique_ptr<ResourceThrottle> throttle =
+ ResourceDispatcherHostImpl::Get()->scheduler()->ScheduleRequest(
+ 4, 2, false, request_.get());
+
+ EXPECT_EQ(net::LOWEST, request_->priority());
+
+ handler_->SetPriority(mojom::RequestPriority::kHighest, 4);
+
+ EXPECT_EQ(net::HIGHEST, request_->priority());
+}
+
TEST_P(MojoAsyncResourceHandlerWithAllocationSizeTest,
OnWillReadWithLongContents) {
ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());

Powered by Google App Engine
This is Rietveld 408576698