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

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
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 canceled_(false), 61 canceled_(false),
62 defers_loading_(false) { 62 defers_loading_(false) {
63 } 63 }
64 64
65 ~TestResourceDispatcher() override {} 65 ~TestResourceDispatcher() override {}
66 66
67 // TestDispatcher implementation: 67 // TestDispatcher implementation:
68 68
69 void StartSync(const RequestInfo& request_info, 69 void StartSync(const RequestInfo& request_info,
70 ResourceRequestBodyImpl* request_body, 70 ResourceRequestBodyImpl* request_body,
71 SyncLoadResponse* response) override { 71 SyncLoadResponse* response,
72 blink::WebURLRequest::LoadingIPCType ipc_type,
73 mojom::URLLoaderFactory* url_loader_factory) override {
72 *response = sync_load_response_; 74 *response = sync_load_response_;
73 } 75 }
74 76
75 int StartAsync(const RequestInfo& request_info, 77 int StartAsync(const RequestInfo& request_info,
76 ResourceRequestBodyImpl* request_body, 78 ResourceRequestBodyImpl* request_body,
77 std::unique_ptr<RequestPeer> peer) override { 79 std::unique_ptr<RequestPeer> peer,
80 blink::WebURLRequest::LoadingIPCType ipc_type,
81 mojom::URLLoaderFactory* url_loader_factory) override {
78 EXPECT_FALSE(peer_); 82 EXPECT_FALSE(peer_);
83 EXPECT_EQ(blink::WebURLRequest::LoadingIPCType::ChromeIPC, ipc_type);
79 peer_ = std::move(peer); 84 peer_ = std::move(peer);
80 url_ = request_info.url; 85 url_ = request_info.url;
81 stream_url_ = request_info.resource_body_stream_url; 86 stream_url_ = request_info.resource_body_stream_url;
82 return 1; 87 return 1;
83 } 88 }
84 89
85 void Cancel(int request_id) override { 90 void Cancel(int request_id) override {
86 EXPECT_FALSE(canceled_); 91 EXPECT_FALSE(canceled_);
87 canceled_ = true; 92 canceled_ = true;
88 } 93 }
(...skipping 21 matching lines...) Expand all
110 GURL url_; 115 GURL url_;
111 GURL stream_url_; 116 GURL stream_url_;
112 SyncLoadResponse sync_load_response_; 117 SyncLoadResponse sync_load_response_;
113 118
114 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); 119 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher);
115 }; 120 };
116 121
117 class TestWebURLLoaderClient : public blink::WebURLLoaderClient { 122 class TestWebURLLoaderClient : public blink::WebURLLoaderClient {
118 public: 123 public:
119 TestWebURLLoaderClient(ResourceDispatcher* dispatcher) 124 TestWebURLLoaderClient(ResourceDispatcher* dispatcher)
120 : loader_(new WebURLLoaderImpl(dispatcher)), 125 : loader_(new WebURLLoaderImpl(dispatcher, nullptr)),
121 delete_on_receive_redirect_(false), 126 delete_on_receive_redirect_(false),
122 delete_on_receive_response_(false), 127 delete_on_receive_response_(false),
123 delete_on_receive_data_(false), 128 delete_on_receive_data_(false),
124 delete_on_finish_(false), 129 delete_on_finish_(false),
125 delete_on_fail_(false), 130 delete_on_fail_(false),
126 did_receive_redirect_(false), 131 did_receive_redirect_(false),
127 did_receive_response_(false), 132 did_receive_response_(false),
128 check_redirect_request_priority_(false), 133 check_redirect_request_priority_(false),
129 did_finish_(false) {} 134 did_finish_(false) {}
130 135
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 encoded_data_length); 698 encoded_data_length);
694 699
695 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength()); 700 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength());
696 EXPECT_EQ(kEncodedDataLength, encoded_data_length); 701 EXPECT_EQ(kEncodedDataLength, encoded_data_length);
697 int expected_decoded_body_length = strlen(kBodyData); 702 int expected_decoded_body_length = strlen(kBodyData);
698 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength()); 703 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength());
699 } 704 }
700 705
701 } // namespace 706 } // namespace
702 } // namespace content 707 } // namespace content
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698