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

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

Issue 2738973002: Allow MojoAsyncResourceHandler::OnWillRead to complete asyncronously (Closed)
Patch Set: Cleanup Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/browser/loader/mock_resource_loader.h" 5 #include "content/browser/loader/mock_resource_loader.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return status_; 153 return status_;
154 } 154 }
155 155
156 MockResourceLoader::Status 156 MockResourceLoader::Status
157 MockResourceLoader::OnResponseCompletedFromExternalOutOfBandCancel( 157 MockResourceLoader::OnResponseCompletedFromExternalOutOfBandCancel(
158 const net::URLRequestStatus& url_request_status) { 158 const net::URLRequestStatus& url_request_status) {
159 // This can happen at any point, except from a recursive call from 159 // This can happen at any point, except from a recursive call from
160 // ResourceHandler. 160 // ResourceHandler.
161 EXPECT_NE(Status::CALLING_HANDLER, status_); 161 EXPECT_NE(Status::CALLING_HANDLER, status_);
162 162
163 waiting_on_buffer_ = false;
163 io_buffer_ = nullptr; 164 io_buffer_ = nullptr;
164 io_buffer_size_ = 0; 165 io_buffer_size_ = 0;
165 status_ = Status::CALLING_HANDLER; 166 status_ = Status::CALLING_HANDLER;
166 167
167 resource_handler_->OnResponseCompleted( 168 resource_handler_->OnResponseCompleted(
168 url_request_status, 169 url_request_status,
169 base::MakeUnique<TestResourceController>(weak_factory_.GetWeakPtr())); 170 base::MakeUnique<TestResourceController>(weak_factory_.GetWeakPtr()));
170 if (status_ == Status::CALLING_HANDLER) 171 if (status_ == Status::CALLING_HANDLER)
171 status_ = Status::CALLBACK_PENDING; 172 status_ = Status::CALLBACK_PENDING;
172 EXPECT_NE(Status::CANCELED, status_); 173 EXPECT_NE(Status::CANCELED, status_);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Shouldn't update |io_buffer_| or |io_buffer_size_| on cancel. 237 // Shouldn't update |io_buffer_| or |io_buffer_size_| on cancel.
237 EXPECT_TRUE(status_ == Status::CALLBACK_PENDING || 238 EXPECT_TRUE(status_ == Status::CALLBACK_PENDING ||
238 status_ == Status::CALLING_HANDLER); 239 status_ == Status::CALLING_HANDLER);
239 240
240 status_ = Status::IDLE; 241 status_ = Status::IDLE;
241 if (canceled_or_idle_run_loop_) 242 if (canceled_or_idle_run_loop_)
242 canceled_or_idle_run_loop_->Quit(); 243 canceled_or_idle_run_loop_->Quit();
243 } 244 }
244 245
245 } // namespace content 246 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698