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

Unified Diff: content/browser/loader/mojo_async_resource_handler_test_util.cc

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/mojo_async_resource_handler_test_util.cc
diff --git a/content/browser/loader/mojo_async_resource_handler_test_util.cc b/content/browser/loader/mojo_async_resource_handler_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ae33d11d925921fb04cf53716b862acea9b8845b
--- /dev/null
+++ b/content/browser/loader/mojo_async_resource_handler_test_util.cc
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/loader/mojo_async_resource_handler_test_util.h"
+
+namespace content {
+
+FakeURLLoaderClient::FakeURLLoaderClient() : binding_(this) {}
+FakeURLLoaderClient::~FakeURLLoaderClient() {}
+
+void FakeURLLoaderClient::OnReceiveResponse(
+ const ResourceResponseHead& response_head) {
+ has_received_response_ = true;
+ response_head_ = response_head;
+ if (quit_closure_)
+ quit_closure_.Run();
+}
+
+void FakeURLLoaderClient::OnStartLoadingResponseBody(
+ mojo::ScopedDataPipeConsumerHandle body) {
+ response_body_ = std::move(body);
+ if (quit_closure_)
+ quit_closure_.Run();
+}
+
+void FakeURLLoaderClient::OnComplete(
+ const ResourceRequestCompletionStatus& status) {
+ has_received_completion_ = true;
+ completion_status_ = status;
+ if (quit_closure_)
+ quit_closure_.Run();
+}
+
+mojom::URLLoaderClientPtr FakeURLLoaderClient::CreateInterfacePtrAndBind() {
+ return binding_.CreateInterfacePtrAndBind();
+}
+
+void FakeURLLoaderClient::Unbind() {
+ binding_.Unbind();
+ response_body_.reset();
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698