Chromium Code Reviews| Index: content/test/test_navigation_url_loader.cc |
| diff --git a/content/test/test_navigation_url_loader.cc b/content/test/test_navigation_url_loader.cc |
| index 0ba5b7e13c740c0211a4e30bc72c0218942d7fd5..9dce60aa8f438d833c8981b21778bd4818cb5570 100644 |
| --- a/content/test/test_navigation_url_loader.cc |
| +++ b/content/test/test_navigation_url_loader.cc |
| @@ -9,8 +9,11 @@ |
| #include "content/browser/loader/navigation_url_loader_delegate.h" |
| #include "content/public/browser/global_request_id.h" |
| #include "content/public/browser/navigation_data.h" |
| +#include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/ssl_status.h" |
| #include "content/public/browser/stream_handle.h" |
| +#include "content/public/browser/web_contents.h" |
| +#include "content/public/common/browser_side_navigation_policy.h" |
| #include "content/public/common/resource_response.h" |
| #include "net/url_request/redirect_info.h" |
| @@ -22,7 +25,9 @@ TestNavigationURLLoader::TestNavigationURLLoader( |
| : request_info_(std::move(request_info)), |
| delegate_(delegate), |
| redirect_count_(0), |
| - response_proceeded_(false) {} |
| + response_proceeded_(false) { |
| + DCHECK(IsBrowserSideNavigationEnabled()); |
| +} |
| void TestNavigationURLLoader::FollowRedirect() { |
| redirect_count_++; |
| @@ -56,9 +61,17 @@ void TestNavigationURLLoader::CallOnResponseStarted( |
| const scoped_refptr<ResourceResponse>& response, |
| std::unique_ptr<StreamHandle> body, |
| std::unique_ptr<NavigationData> navigation_data) { |
| + // Start the request_ids at 1000 to avoid collisions with request ids from |
| + // network resoures (it should be rare to compare these in unit tests). |
|
arthursonzogni
2017/05/16 09:16:05
nit: s/resoures/resources
Charlie Harrison
2017/05/16 12:23:39
Done.
|
| + static int request_id = 1000; |
| + int child_id = |
| + WebContents::FromFrameTreeNodeId(request_info_->frame_tree_node_id) |
| + ->GetRenderProcessHost() |
| + ->GetID(); |
| + GlobalRequestID global_id(child_id, ++request_id); |
| delegate_->OnResponseStarted( |
| response, std::move(body), mojo::ScopedDataPipeConsumerHandle(), |
| - SSLStatus(), std::move(navigation_data), GlobalRequestID(), false, false); |
| + SSLStatus(), std::move(navigation_data), global_id, false, false); |
| } |
| TestNavigationURLLoader::~TestNavigationURLLoader() {} |