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

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

Issue 1564963002: [on hold] Remove dependency on RenderViewHost from LoadState notifications Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only notify navigations / uploads Created 4 years, 6 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/resource_dispatcher_host_unittest.cc
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index 58ab2d130de3b48e182428775f96848d09560f55..9860c02b95784835cda7e72a8bfb45cb971cd87a 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -836,7 +836,7 @@ class TestWebContentsObserver : public WebContentsObserver {
// Information used to create resource requests that use URLRequestLoadInfoJobs.
// The child_id is just that of ResourceDispatcherHostTest::filter_.
struct LoadInfoTestRequestInfo {
- int route_id;
+ GlobalFrameRoutingId route_id;
GURL url;
net::LoadState load_state;
net::UploadProgress upload_progress;
@@ -937,7 +937,9 @@ class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
loader_test_request_info_.reset(
new LoadInfoTestRequestInfo(request_info[i]));
wait_for_request_create_loop_.reset(new base::RunLoop());
- MakeTestRequest(request_info[i].route_id, i + 1, request_info[i].url);
+ MakeTestRequestWithRenderFrame(
+ MSG_ROUTING_NONE, request_info[i].route_id.frame_routing_id, i + 1,
+ request_info[i].url, RESOURCE_TYPE_SUB_FRAME);
wait_for_request_create_loop_->Run();
wait_for_request_create_loop_.reset();
}
@@ -3592,19 +3594,13 @@ TEST_P(ResourceDispatcherHostTest, LoadInfoNoRequests) {
// Tests GetLoadInfoForAllRoutes when there are 3 requests from the same
// RenderView. The second one is farthest along.
TEST_P(ResourceDispatcherHostTest, LoadInfo) {
- const GlobalRoutingID kId(filter_->child_id(), 0);
+ const GlobalFrameRoutingId kId(filter_->child_id(), 1);
LoadInfoTestRequestInfo request_info[] = {
- {kId.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_SENDING_REQUEST,
+ {kId, GURL("test://1/"), net::LOAD_STATE_SENDING_REQUEST,
net::UploadProgress(0, 0)},
- {kId.route_id,
- GURL("test://2/"),
- net::LOAD_STATE_READING_RESPONSE,
+ {kId, GURL("test://2/"), net::LOAD_STATE_READING_RESPONSE,
net::UploadProgress(0, 0)},
- {kId.route_id,
- GURL("test://3/"),
- net::LOAD_STATE_SENDING_REQUEST,
+ {kId, GURL("test://3/"), net::LOAD_STATE_SENDING_REQUEST,
net::UploadProgress(0, 0)},
};
std::unique_ptr<LoadInfoMap> load_info_map =
@@ -3621,16 +3617,10 @@ TEST_P(ResourceDispatcherHostTest, LoadInfo) {
// Tests GetLoadInfoForAllRoutes when there are 2 requests with the same
// priority. The first one (Which will have the lowest ID) should be returned.
TEST_P(ResourceDispatcherHostTest, LoadInfoSamePriority) {
- const GlobalRoutingID kId(filter_->child_id(), 0);
+ const GlobalFrameRoutingId kId(filter_->child_id(), 1);
LoadInfoTestRequestInfo request_info[] = {
- {kId.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_IDLE,
- net::UploadProgress(0, 0)},
- {kId.route_id,
- GURL("test://2/"),
- net::LOAD_STATE_IDLE,
- net::UploadProgress(0, 0)},
+ {kId, GURL("test://1/"), net::LOAD_STATE_IDLE, net::UploadProgress(0, 0)},
+ {kId, GURL("test://2/"), net::LOAD_STATE_IDLE, net::UploadProgress(0, 0)},
};
std::unique_ptr<LoadInfoMap> load_info_map =
RunLoadInfoTest(request_info, arraysize(request_info));
@@ -3644,27 +3634,17 @@ TEST_P(ResourceDispatcherHostTest, LoadInfoSamePriority) {
// Tests GetLoadInfoForAllRoutes when a request is uploading a body.
TEST_P(ResourceDispatcherHostTest, LoadInfoUploadProgress) {
- const GlobalRoutingID kId(filter_->child_id(), 0);
+ const GlobalFrameRoutingId kId(filter_->child_id(), 1);
LoadInfoTestRequestInfo request_info[] = {
- {kId.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_READING_RESPONSE,
+ {kId, GURL("test://1/"), net::LOAD_STATE_READING_RESPONSE,
net::UploadProgress(0, 0)},
- {kId.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_READING_RESPONSE,
+ {kId, GURL("test://1/"), net::LOAD_STATE_READING_RESPONSE,
net::UploadProgress(1000, 1000)},
- {kId.route_id,
- GURL("test://2/"),
- net::LOAD_STATE_SENDING_REQUEST,
+ {kId, GURL("test://2/"), net::LOAD_STATE_SENDING_REQUEST,
net::UploadProgress(50, 100)},
- {kId.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_READING_RESPONSE,
+ {kId, GURL("test://1/"), net::LOAD_STATE_READING_RESPONSE,
net::UploadProgress(1000, 1000)},
- {kId.route_id,
- GURL("test://3/"),
- net::LOAD_STATE_READING_RESPONSE,
+ {kId, GURL("test://3/"), net::LOAD_STATE_READING_RESPONSE,
net::UploadProgress(0, 0)},
};
std::unique_ptr<LoadInfoMap> load_info_map =
@@ -3682,24 +3662,16 @@ TEST_P(ResourceDispatcherHostTest, LoadInfoUploadProgress) {
// RenderViews. Also tests the case where the first / last requests are the
// most interesting ones.
TEST_P(ResourceDispatcherHostTest, LoadInfoTwoRenderViews) {
- const GlobalRoutingID kId1(filter_->child_id(), 0);
- const GlobalRoutingID kId2(filter_->child_id(), 1);
+ const GlobalFrameRoutingId kId1(filter_->child_id(), 1);
+ const GlobalFrameRoutingId kId2(filter_->child_id(), 2);
LoadInfoTestRequestInfo request_info[] = {
- {kId1.route_id,
- GURL("test://1/"),
- net::LOAD_STATE_CONNECTING,
+ {kId1, GURL("test://1/"), net::LOAD_STATE_CONNECTING,
net::UploadProgress(0, 0)},
- {kId2.route_id,
- GURL("test://2/"),
- net::LOAD_STATE_IDLE,
+ {kId2, GURL("test://2/"), net::LOAD_STATE_IDLE,
net::UploadProgress(0, 0)},
- {kId1.route_id,
- GURL("test://3/"),
- net::LOAD_STATE_IDLE,
+ {kId1, GURL("test://3/"), net::LOAD_STATE_IDLE,
net::UploadProgress(0, 0)},
- {kId2.route_id,
- GURL("test://4/"),
- net::LOAD_STATE_CONNECTING,
+ {kId2, GURL("test://4/"), net::LOAD_STATE_CONNECTING,
net::UploadProgress(0, 0)},
};
std::unique_ptr<LoadInfoMap> load_info_map =
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698