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

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

Issue 953503002: PlzNavigate: test updates post beforeUnload IPC refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR comments. Created 5 years, 9 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 "content/browser/loader/navigation_url_loader_delegate.h" 7 #include "content/browser/loader/navigation_url_loader_delegate.h"
8 #include "content/public/browser/stream_handle.h" 8 #include "content/public/browser/stream_handle.h"
9 #include "content/public/common/resource_response.h"
10 #include "net/url_request/redirect_info.h"
9 11
10 namespace content { 12 namespace content {
11 13
12 TestNavigationURLLoader::TestNavigationURLLoader( 14 TestNavigationURLLoader::TestNavigationURLLoader(
13 scoped_ptr<NavigationRequestInfo> request_info, 15 scoped_ptr<NavigationRequestInfo> request_info,
14 NavigationURLLoaderDelegate* delegate) 16 NavigationURLLoaderDelegate* delegate)
15 : request_info_(request_info.Pass()), 17 : request_info_(request_info.Pass()),
16 delegate_(delegate), 18 delegate_(delegate),
17 redirect_count_(0) { 19 redirect_count_(0) {
18 } 20 }
19 21
20 void TestNavigationURLLoader::FollowRedirect() { 22 void TestNavigationURLLoader::FollowRedirect() {
21 redirect_count_++; 23 redirect_count_++;
22 } 24 }
23 25
26 void TestNavigationURLLoader::SimulateServerRedirect(const GURL& redirect_url) {
27 net::RedirectInfo redirect_info;
28 redirect_info.status_code = 302;
29 redirect_info.new_method = "GET";
30 redirect_info.new_url = redirect_url;
31 redirect_info.new_first_party_for_cookies = redirect_url;
32 scoped_refptr<ResourceResponse> response(new ResourceResponse);
33 CallOnRequestRedirected(redirect_info, response);
34 }
35
24 void TestNavigationURLLoader::CallOnRequestRedirected( 36 void TestNavigationURLLoader::CallOnRequestRedirected(
25 const net::RedirectInfo& redirect_info, 37 const net::RedirectInfo& redirect_info,
26 const scoped_refptr<ResourceResponse>& response) { 38 const scoped_refptr<ResourceResponse>& response) {
27 delegate_->OnRequestRedirected(redirect_info, response); 39 delegate_->OnRequestRedirected(redirect_info, response);
28 } 40 }
29 41
30 void TestNavigationURLLoader::CallOnResponseStarted( 42 void TestNavigationURLLoader::CallOnResponseStarted(
31 const scoped_refptr<ResourceResponse>& response, 43 const scoped_refptr<ResourceResponse>& response,
32 scoped_ptr<StreamHandle> body) { 44 scoped_ptr<StreamHandle> body) {
33 delegate_->OnResponseStarted(response, body.Pass()); 45 delegate_->OnResponseStarted(response, body.Pass());
34 } 46 }
35 47
36 TestNavigationURLLoader::~TestNavigationURLLoader() {} 48 TestNavigationURLLoader::~TestNavigationURLLoader() {}
37 49
38 } // namespace content 50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698