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

Side by Side Diff: content/browser/loader/navigation_url_loader_unittest.cc

Issue 1693563002: PROTOTYPE: PlzNavigate: use a Mojo data pipe to stream navigation data to the renderer. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browser sends URLRequest id to the renderer and renderer uses intermediary buffer for data: none he… Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 <utility> 5 #include <utility>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // NavigationURLLoaderDelegate implementation. 102 // NavigationURLLoaderDelegate implementation.
103 void OnRequestRedirected( 103 void OnRequestRedirected(
104 const net::RedirectInfo& redirect_info, 104 const net::RedirectInfo& redirect_info,
105 const scoped_refptr<ResourceResponse>& response) override { 105 const scoped_refptr<ResourceResponse>& response) override {
106 redirect_info_ = redirect_info; 106 redirect_info_ = redirect_info;
107 redirect_response_ = response; 107 redirect_response_ = response;
108 ASSERT_TRUE(request_redirected_); 108 ASSERT_TRUE(request_redirected_);
109 request_redirected_->Quit(); 109 request_redirected_->Quit();
110 } 110 }
111 111
112 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, 112 void OnResponseStarted(
113 scoped_ptr<StreamHandle> body) override { 113 const scoped_refptr<ResourceResponse>& response,
114 scoped_ptr<StreamHandle> body,
115 mojo::ScopedDataPipeConsumerHandle data_consumer_handle) override {
114 response_ = response; 116 response_ = response;
115 body_ = std::move(body); 117 body_ = std::move(body);
118 data_consumer_handle_ = std::move(data_consumer_handle);
116 ASSERT_TRUE(response_started_); 119 ASSERT_TRUE(response_started_);
117 response_started_->Quit(); 120 response_started_->Quit();
118 } 121 }
119 122
120 void OnRequestFailed(bool in_cache, int net_error) override { 123 void OnRequestFailed(bool in_cache, int net_error) override {
121 net_error_ = net_error; 124 net_error_ = net_error;
122 ASSERT_TRUE(request_failed_); 125 ASSERT_TRUE(request_failed_);
123 request_failed_->Quit(); 126 request_failed_->Quit();
124 } 127 }
125 128
126 void OnRequestStarted(base::TimeTicks timestamp) override { 129 void OnRequestStarted(base::TimeTicks timestamp) override {
127 ASSERT_FALSE(timestamp.is_null()); 130 ASSERT_FALSE(timestamp.is_null());
128 ++on_request_handled_counter_; 131 ++on_request_handled_counter_;
129 } 132 }
130 133
131 private: 134 private:
132 net::RedirectInfo redirect_info_; 135 net::RedirectInfo redirect_info_;
133 scoped_refptr<ResourceResponse> redirect_response_; 136 scoped_refptr<ResourceResponse> redirect_response_;
134 scoped_refptr<ResourceResponse> response_; 137 scoped_refptr<ResourceResponse> response_;
135 scoped_ptr<StreamHandle> body_; 138 scoped_ptr<StreamHandle> body_;
139 mojo::ScopedDataPipeConsumerHandle data_consumer_handle_;
136 int net_error_; 140 int net_error_;
137 int on_request_handled_counter_; 141 int on_request_handled_counter_;
138 142
139 scoped_ptr<base::RunLoop> request_redirected_; 143 scoped_ptr<base::RunLoop> request_redirected_;
140 scoped_ptr<base::RunLoop> response_started_; 144 scoped_ptr<base::RunLoop> response_started_;
141 scoped_ptr<base::RunLoop> request_failed_; 145 scoped_ptr<base::RunLoop> request_failed_;
142 }; 146 };
143 147
144 class RequestBlockingResourceDispatcherHostDelegate 148 class RequestBlockingResourceDispatcherHostDelegate
145 : public ResourceDispatcherHostDelegate { 149 : public ResourceDispatcherHostDelegate {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 401
398 // Release the body. 402 // Release the body.
399 delegate.ReleaseBody(); 403 delegate.ReleaseBody();
400 base::RunLoop().RunUntilIdle(); 404 base::RunLoop().RunUntilIdle();
401 405
402 // Verify that URLRequestTestJob no longer has anything paused. 406 // Verify that URLRequestTestJob no longer has anything paused.
403 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); 407 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage());
404 } 408 }
405 409
406 } // namespace content 410 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_impl_core.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698