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

Side by Side Diff: content/child/web_url_loader_impl_unittest.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, 4 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 canceled_(false), 64 canceled_(false),
65 defers_loading_(false) { 65 defers_loading_(false) {
66 } 66 }
67 67
68 ~TestResourceDispatcher() override {} 68 ~TestResourceDispatcher() override {}
69 69
70 // TestDispatcher implementation: 70 // TestDispatcher implementation:
71 71
72 void StartSync(const RequestInfo& request_info, 72 void StartSync(const RequestInfo& request_info,
73 ResourceRequestBodyImpl* request_body, 73 ResourceRequestBodyImpl* request_body,
74 SyncLoadResponse* response) override { 74 SyncLoadResponse* response,
75 blink::WebURLRequest::LoadingIPCType ipc_type,
76 mojom::URLLoaderFactory* url_loader_factory) override {
75 *response = sync_load_response_; 77 *response = sync_load_response_;
76 } 78 }
77 79
78 int StartAsync(const RequestInfo& request_info, 80 int StartAsync(const RequestInfo& request_info,
79 ResourceRequestBodyImpl* request_body, 81 ResourceRequestBodyImpl* request_body,
80 std::unique_ptr<RequestPeer> peer) override { 82 std::unique_ptr<RequestPeer> peer,
83 blink::WebURLRequest::LoadingIPCType ipc_type,
84 mojom::URLLoaderFactory* url_loader_factory) override {
81 EXPECT_FALSE(peer_); 85 EXPECT_FALSE(peer_);
86 EXPECT_EQ(blink::WebURLRequest::LoadingIPCType::ChromeIPC, ipc_type);
82 peer_ = std::move(peer); 87 peer_ = std::move(peer);
83 url_ = request_info.url; 88 url_ = request_info.url;
84 stream_url_ = request_info.resource_body_stream_url; 89 stream_url_ = request_info.resource_body_stream_url;
85 return 1; 90 return 1;
86 } 91 }
87 92
88 void Cancel(int request_id) override { 93 void Cancel(int request_id) override {
89 EXPECT_FALSE(canceled_); 94 EXPECT_FALSE(canceled_);
90 canceled_ = true; 95 canceled_ = true;
91 } 96 }
(...skipping 24 matching lines...) Expand all
116 121
117 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); 122 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher);
118 }; 123 };
119 124
120 class TestWebURLLoaderClient : public blink::WebURLLoaderClient { 125 class TestWebURLLoaderClient : public blink::WebURLLoaderClient {
121 public: 126 public:
122 TestWebURLLoaderClient(ResourceDispatcher* dispatcher, 127 TestWebURLLoaderClient(ResourceDispatcher* dispatcher,
123 scoped_refptr<scheduler::TaskQueue> task_runner) 128 scoped_refptr<scheduler::TaskQueue> task_runner)
124 : loader_(new WebURLLoaderImpl( 129 : loader_(new WebURLLoaderImpl(
125 dispatcher, 130 dispatcher,
126 base::WrapUnique(new scheduler::WebTaskRunnerImpl(task_runner)))), 131 base::WrapUnique(new scheduler::WebTaskRunnerImpl(task_runner)),
132 nullptr)),
127 delete_on_receive_redirect_(false), 133 delete_on_receive_redirect_(false),
128 delete_on_receive_response_(false), 134 delete_on_receive_response_(false),
129 delete_on_receive_data_(false), 135 delete_on_receive_data_(false),
130 delete_on_finish_(false), 136 delete_on_finish_(false),
131 delete_on_fail_(false), 137 delete_on_fail_(false),
132 did_receive_redirect_(false), 138 did_receive_redirect_(false),
133 did_receive_response_(false), 139 did_receive_response_(false),
134 check_redirect_request_priority_(false), 140 check_redirect_request_priority_(false),
135 did_finish_(false) {} 141 did_finish_(false) {}
136 142
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 encoded_data_length); 714 encoded_data_length);
709 715
710 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength()); 716 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength());
711 EXPECT_EQ(kEncodedDataLength, encoded_data_length); 717 EXPECT_EQ(kEncodedDataLength, encoded_data_length);
712 int expected_decoded_body_length = strlen(kBodyData); 718 int expected_decoded_body_length = strlen(kBodyData);
713 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength()); 719 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength());
714 } 720 }
715 721
716 } // namespace 722 } // namespace
717 } // namespace content 723 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698