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

Side by Side Diff: content/test/test_navigation_url_loader.cc

Issue 2885453003: NavigationSimulator: add support for GlobalRequestIds (Closed)
Patch Set: dcheck Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "content/test/test_navigation_url_loader.h" 5 #include "content/test/test_navigation_url_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/loader/navigation_url_loader_delegate.h" 9 #include "content/browser/loader/navigation_url_loader_delegate.h"
10 #include "content/public/browser/global_request_id.h" 10 #include "content/public/browser/global_request_id.h"
11 #include "content/public/browser/navigation_data.h" 11 #include "content/public/browser/navigation_data.h"
12 #include "content/public/browser/render_process_host.h"
12 #include "content/public/browser/ssl_status.h" 13 #include "content/public/browser/ssl_status.h"
13 #include "content/public/browser/stream_handle.h" 14 #include "content/public/browser/stream_handle.h"
15 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/resource_response.h" 16 #include "content/public/common/resource_response.h"
15 #include "net/url_request/redirect_info.h" 17 #include "net/url_request/redirect_info.h"
16 18
17 namespace content { 19 namespace content {
18 20
19 TestNavigationURLLoader::TestNavigationURLLoader( 21 TestNavigationURLLoader::TestNavigationURLLoader(
20 std::unique_ptr<NavigationRequestInfo> request_info, 22 std::unique_ptr<NavigationRequestInfo> request_info,
21 NavigationURLLoaderDelegate* delegate) 23 NavigationURLLoaderDelegate* delegate)
22 : request_info_(std::move(request_info)), 24 : request_info_(std::move(request_info)),
23 delegate_(delegate), 25 delegate_(delegate),
(...skipping 25 matching lines...) Expand all
49 void TestNavigationURLLoader::CallOnRequestRedirected( 51 void TestNavigationURLLoader::CallOnRequestRedirected(
50 const net::RedirectInfo& redirect_info, 52 const net::RedirectInfo& redirect_info,
51 const scoped_refptr<ResourceResponse>& response) { 53 const scoped_refptr<ResourceResponse>& response) {
52 delegate_->OnRequestRedirected(redirect_info, response); 54 delegate_->OnRequestRedirected(redirect_info, response);
53 } 55 }
54 56
55 void TestNavigationURLLoader::CallOnResponseStarted( 57 void TestNavigationURLLoader::CallOnResponseStarted(
56 const scoped_refptr<ResourceResponse>& response, 58 const scoped_refptr<ResourceResponse>& response,
57 std::unique_ptr<StreamHandle> body, 59 std::unique_ptr<StreamHandle> body,
58 std::unique_ptr<NavigationData> navigation_data) { 60 std::unique_ptr<NavigationData> navigation_data) {
61 static int request_id = 0;
Charlie Reis 2017/05/15 20:07:43 Hmm, now it does look like there's a potential for
Charlie Harrison 2017/05/15 21:45:54 Yes, but the code I've changed in navigation_simul
Charlie Reis 2017/05/15 22:02:39 Ah, glad they're mutually exclusive. Can you add
Charlie Harrison 2017/05/16 03:41:42 I've added a DCHECK in the constructor.
62 int child_id =
63 WebContents::FromFrameTreeNodeId(request_info_->frame_tree_node_id)
64 ->GetRenderProcessHost()
65 ->GetID();
66 GlobalRequestID global_id(child_id, ++request_id);
59 delegate_->OnResponseStarted( 67 delegate_->OnResponseStarted(
60 response, std::move(body), mojo::ScopedDataPipeConsumerHandle(), 68 response, std::move(body), mojo::ScopedDataPipeConsumerHandle(),
61 SSLStatus(), std::move(navigation_data), GlobalRequestID(), false, false); 69 SSLStatus(), std::move(navigation_data), global_id, false, false);
62 } 70 }
63 71
64 TestNavigationURLLoader::~TestNavigationURLLoader() {} 72 TestNavigationURLLoader::~TestNavigationURLLoader() {}
65 73
66 } // namespace content 74 } // namespace content
OLDNEW
« content/public/test/navigation_simulator.cc ('K') | « content/public/test/navigation_simulator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698