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

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: fix 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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 canceled_(false), 63 canceled_(false),
64 defers_loading_(false) { 64 defers_loading_(false) {
65 } 65 }
66 66
67 ~TestResourceDispatcher() override {} 67 ~TestResourceDispatcher() override {}
68 68
69 // TestDispatcher implementation: 69 // TestDispatcher implementation:
70 70
71 int StartAsync(const RequestInfo& request_info, 71 int StartAsync(const RequestInfo& request_info,
72 ResourceRequestBodyImpl* request_body, 72 ResourceRequestBodyImpl* request_body,
73 std::unique_ptr<RequestPeer> peer) override { 73 std::unique_ptr<RequestPeer> peer,
74 blink::WebURLRequest::LoadingIPCType ipc_type,
75 mojom::URLLoaderFactory* url_loader_factory) override {
74 EXPECT_FALSE(peer_); 76 EXPECT_FALSE(peer_);
77 EXPECT_EQ(blink::WebURLRequest::LoadingIPCType::ChromeIPC, ipc_type);
75 peer_ = std::move(peer); 78 peer_ = std::move(peer);
76 url_ = request_info.url; 79 url_ = request_info.url;
77 stream_url_ = request_info.resource_body_stream_url; 80 stream_url_ = request_info.resource_body_stream_url;
78 return 1; 81 return 1;
79 } 82 }
80 83
81 void Cancel(int request_id) override { 84 void Cancel(int request_id) override {
82 EXPECT_FALSE(canceled_); 85 EXPECT_FALSE(canceled_);
83 canceled_ = true; 86 canceled_ = true;
84 } 87 }
(...skipping 19 matching lines...) Expand all
104 107
105 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); 108 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher);
106 }; 109 };
107 110
108 class TestWebURLLoaderClient : public blink::WebURLLoaderClient { 111 class TestWebURLLoaderClient : public blink::WebURLLoaderClient {
109 public: 112 public:
110 TestWebURLLoaderClient(ResourceDispatcher* dispatcher, 113 TestWebURLLoaderClient(ResourceDispatcher* dispatcher,
111 scoped_refptr<scheduler::TaskQueue> task_runner) 114 scoped_refptr<scheduler::TaskQueue> task_runner)
112 : loader_(new WebURLLoaderImpl( 115 : loader_(new WebURLLoaderImpl(
113 dispatcher, 116 dispatcher,
114 base::WrapUnique(new scheduler::WebTaskRunnerImpl(task_runner)))), 117 base::WrapUnique(new scheduler::WebTaskRunnerImpl(task_runner)),
118 nullptr)),
115 delete_on_receive_redirect_(false), 119 delete_on_receive_redirect_(false),
116 delete_on_receive_response_(false), 120 delete_on_receive_response_(false),
117 delete_on_receive_data_(false), 121 delete_on_receive_data_(false),
118 delete_on_finish_(false), 122 delete_on_finish_(false),
119 delete_on_fail_(false), 123 delete_on_fail_(false),
120 did_receive_redirect_(false), 124 did_receive_redirect_(false),
121 did_receive_response_(false), 125 did_receive_response_(false),
122 check_redirect_request_priority_(false), 126 check_redirect_request_priority_(false),
123 did_finish_(false) {} 127 did_finish_(false) {}
124 128
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 content::ResourceResponseInfo info; 665 content::ResourceResponseInfo info;
662 info.socket_address = net::HostPortPair(test.ip, 443); 666 info.socket_address = net::HostPortPair(test.ip, 443);
663 blink::WebURLResponse response; 667 blink::WebURLResponse response;
664 WebURLLoaderImpl::PopulateURLResponse(url, info, &response, true); 668 WebURLLoaderImpl::PopulateURLResponse(url, info, &response, true);
665 EXPECT_EQ(test.expected, response.remoteIPAddress().utf8()); 669 EXPECT_EQ(test.expected, response.remoteIPAddress().utf8());
666 }; 670 };
667 } 671 }
668 672
669 } // namespace 673 } // namespace
670 } // namespace content 674 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698