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

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

Issue 2646343007: [Mojo-Loading] Implement URLLoader::SetPriority (Closed)
Patch Set: fix 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 f9adba5aafc1a5d2b427b3fde3a645adcf7c7464..e2f112da1cb941b52fb6adafd0da16deec2ace4e 100644
--- a/content/browser/loader/mojo_async_resource_handler_unittest.cc
+++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -19,6 +19,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"
@@ -39,6 +40,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"
@@ -799,6 +801,19 @@ TEST_F(MojoAsyncResourceHandlerTest,
EXPECT_EQ(net::ERR_FAILED, mock_loader_->error_code());
}
+TEST_F(MojoAsyncResourceHandlerTest, SetPriority) {
+ ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());
+ std::unique_ptr<ResourceThrottle> throttle =
+ ResourceDispatcherHostImpl::Get()->scheduler()->ScheduleRequest(
+ 4, 2, false, request_.get());
mmenke 2017/01/24 16:57:52 Should label the 4 and 2 with comments.
yhirano 2017/01/27 07:53:55 I gave names to these values.
+
+ EXPECT_EQ(net::LOWEST, request_->priority());
+
+ handler_->SetPriority(mojom::RequestPriority::kHighest, 4);
mmenke 2017/01/24 16:57:52 Please label this 4 as well.
yhirano 2017/01/27 07:53:55 I gave a name to the value.
+
+ EXPECT_EQ(net::HIGHEST, request_->priority());
+}
+
TEST_P(MojoAsyncResourceHandlerWithAllocationSizeTest,
OnWillReadWithLongContents) {
ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());

Powered by Google App Engine
This is Rietveld 408576698