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

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: Created 4 years, 10 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(const scoped_refptr<ResourceResponse>& response,
113 scoped_ptr<StreamHandle> body) override { 113 scoped_ptr<StreamHandle> body,
114 mojo::ScopedDataPipeConsumerHandle data_consumer_handle ) override {
114 response_ = response; 115 response_ = response;
115 body_ = std::move(body); 116 body_ = std::move(body);
117 data_consumer_handle_ = std::move(data_consumer_handle);
116 ASSERT_TRUE(response_started_); 118 ASSERT_TRUE(response_started_);
117 response_started_->Quit(); 119 response_started_->Quit();
118 } 120 }
119 121
120 void OnRequestFailed(bool in_cache, int net_error) override { 122 void OnRequestFailed(bool in_cache, int net_error) override {
121 net_error_ = net_error; 123 net_error_ = net_error;
122 ASSERT_TRUE(request_failed_); 124 ASSERT_TRUE(request_failed_);
123 request_failed_->Quit(); 125 request_failed_->Quit();
124 } 126 }
125 127
126 void OnRequestStarted(base::TimeTicks timestamp) override { 128 void OnRequestStarted(base::TimeTicks timestamp) override {
127 ASSERT_FALSE(timestamp.is_null()); 129 ASSERT_FALSE(timestamp.is_null());
128 ++on_request_handled_counter_; 130 ++on_request_handled_counter_;
129 } 131 }
130 132
131 private: 133 private:
132 net::RedirectInfo redirect_info_; 134 net::RedirectInfo redirect_info_;
133 scoped_refptr<ResourceResponse> redirect_response_; 135 scoped_refptr<ResourceResponse> redirect_response_;
134 scoped_refptr<ResourceResponse> response_; 136 scoped_refptr<ResourceResponse> response_;
135 scoped_ptr<StreamHandle> body_; 137 scoped_ptr<StreamHandle> body_;
138 mojo::ScopedDataPipeConsumerHandle data_consumer_handle_;
136 int net_error_; 139 int net_error_;
137 int on_request_handled_counter_; 140 int on_request_handled_counter_;
138 141
139 scoped_ptr<base::RunLoop> request_redirected_; 142 scoped_ptr<base::RunLoop> request_redirected_;
140 scoped_ptr<base::RunLoop> response_started_; 143 scoped_ptr<base::RunLoop> response_started_;
141 scoped_ptr<base::RunLoop> request_failed_; 144 scoped_ptr<base::RunLoop> request_failed_;
142 }; 145 };
143 146
144 class RequestBlockingResourceDispatcherHostDelegate 147 class RequestBlockingResourceDispatcherHostDelegate
145 : public ResourceDispatcherHostDelegate { 148 : public ResourceDispatcherHostDelegate {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 401
399 // Release the body. 402 // Release the body.
400 delegate.ReleaseBody(); 403 delegate.ReleaseBody();
401 base::RunLoop().RunUntilIdle(); 404 base::RunLoop().RunUntilIdle();
402 405
403 // Verify that URLRequestTestJob no longer has anything paused. 406 // Verify that URLRequestTestJob no longer has anything paused.
404 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); 407 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage());
405 } 408 }
406 409
407 } // namespace content 410 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698