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

Side by Side Diff: components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error from rebase Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" 10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h"
11 #include "components/navigation_interception/navigation_params.h" 11 #include "components/navigation_interception/navigation_params.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/resource_context.h" 14 #include "content/public/browser/resource_context.h"
15 #include "content/public/browser/resource_controller.h" 15 #include "content/public/browser/resource_controller.h"
16 #include "content/public/browser/resource_dispatcher_host.h" 16 #include "content/public/browser/resource_dispatcher_host.h"
17 #include "content/public/browser/resource_dispatcher_host_delegate.h" 17 #include "content/public/browser/resource_dispatcher_host_delegate.h"
18 #include "content/public/browser/resource_request_info.h" 18 #include "content/public/browser/resource_request_info.h"
19 #include "content/public/browser/resource_throttle.h" 19 #include "content/public/browser/resource_throttle.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_contents_delegate.h" 21 #include "content/public/browser/web_contents_delegate.h"
22 #include "content/public/common/page_transition_types.h" 22 #include "content/public/common/page_transition_types.h"
23 #include "content/public/test/mock_resource_context.h" 23 #include "content/public/test/mock_resource_context.h"
24 #include "content/public/test/test_renderer_host.h" 24 #include "content/public/test/test_renderer_host.h"
25 #include "net/base/request_priority.h"
25 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
26 #include "net/http/http_response_info.h" 27 #include "net/http/http_response_info.h"
27 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
28 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
29 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
31 32
32 using testing::_; 33 using testing::_;
33 using testing::Eq; 34 using testing::Eq;
34 using testing::Ne; 35 using testing::Ne;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 class TestIOThreadState { 113 class TestIOThreadState {
113 public: 114 public:
114 TestIOThreadState(const GURL& url, 115 TestIOThreadState(const GURL& url,
115 int render_process_id, 116 int render_process_id,
116 int render_view_id, 117 int render_view_id,
117 const std::string& request_method, 118 const std::string& request_method,
118 RedirectMode redirect_mode, 119 RedirectMode redirect_mode,
119 MockInterceptCallbackReceiver* callback_receiver) 120 MockInterceptCallbackReceiver* callback_receiver)
120 : resource_context_(&test_url_request_context_), 121 : resource_context_(&test_url_request_context_),
121 request_(url, NULL, resource_context_.GetRequestContext()) { 122 request_(url,
123 net::DEFAULT_PRIORITY,
124 NULL,
125 resource_context_.GetRequestContext(),
126 NULL) {
mmenke 2013/10/30 15:27:11 This depends on the resource_context_ having a NUL
akalin 2013/10/30 21:44:37 removed arg.
122 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 127 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
123 if (render_process_id != MSG_ROUTING_NONE && 128 if (render_process_id != MSG_ROUTING_NONE &&
124 render_view_id != MSG_ROUTING_NONE) { 129 render_view_id != MSG_ROUTING_NONE) {
125 content::ResourceRequestInfo::AllocateForTesting( 130 content::ResourceRequestInfo::AllocateForTesting(
126 &request_, 131 &request_,
127 ResourceType::MAIN_FRAME, 132 ResourceType::MAIN_FRAME,
128 &resource_context_, 133 &resource_context_,
129 render_process_id, 134 render_process_id,
130 render_view_id, 135 render_view_id,
131 false); 136 false);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 REDIRECT_MODE_302, 468 REDIRECT_MODE_302,
464 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 469 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
465 web_contents()->GetRenderViewHost()->GetRoutingID(), 470 web_contents()->GetRenderViewHost()->GetRoutingID(),
466 base::Unretained(&defer))); 471 base::Unretained(&defer)));
467 472
468 // Wait for the request to finish processing. 473 // Wait for the request to finish processing.
469 base::RunLoop().RunUntilIdle(); 474 base::RunLoop().RunUntilIdle();
470 } 475 }
471 476
472 } // namespace navigation_interception 477 } // namespace navigation_interception
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698