OLD | NEW |
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 "platform/testing/weburl_loader_mock.h" | 5 #include "platform/testing/weburl_loader_mock.h" |
6 | 6 |
7 #include "platform/testing/weburl_loader_mock_factory_impl.h" | 7 #include "platform/testing/weburl_loader_mock_factory_impl.h" |
8 #include "public/platform/URLConversion.h" | 8 #include "public/platform/URLConversion.h" |
9 #include "public/platform/WebData.h" | 9 #include "public/platform/WebData.h" |
10 #include "public/platform/WebURLError.h" | 10 #include "public/platform/WebURLError.h" |
11 #include "public/platform/WebURLLoaderClient.h" | 11 #include "public/platform/WebURLLoaderClient.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 void AssertFallbackLoaderAvailability(const WebURL& url, | 17 void AssertFallbackLoaderAvailability(const WebURL& url, |
18 const WebURLLoader* default_loader) { | 18 const WebURLLoader* default_loader) { |
19 DCHECK(KURL(url).ProtocolIsData()) | 19 DCHECK(KURL(url).ProtocolIsData()) |
20 << "shouldn't be falling back: " << url.GetString().Utf8(); | 20 << "shouldn't be falling back: " << url.GetString().Utf8(); |
21 DCHECK(default_loader) << "default_loader wasn't set: " | 21 DCHECK(default_loader) << "default_loader wasn't set: " |
22 << url.GetString().Utf8(); | 22 << url.GetString().Utf8(); |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, | 27 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, |
28 WebURLLoader* default_loader) | 28 std::unique_ptr<WebURLLoader> default_loader) |
29 : factory_(factory), | 29 : factory_(factory), |
30 default_loader_(WTF::WrapUnique(default_loader)), | 30 default_loader_(std::move(default_loader)), |
31 weak_factory_(this) {} | 31 weak_factory_(this) {} |
32 | 32 |
33 WebURLLoaderMock::~WebURLLoaderMock() { | 33 WebURLLoaderMock::~WebURLLoaderMock() { |
34 Cancel(); | 34 Cancel(); |
35 } | 35 } |
36 | 36 |
37 void WebURLLoaderMock::ServeAsynchronousRequest( | 37 void WebURLLoaderMock::ServeAsynchronousRequest( |
38 WebURLLoaderTestDelegate* delegate, | 38 WebURLLoaderTestDelegate* delegate, |
39 const WebURLResponse& response, | 39 const WebURLResponse& response, |
40 const WebData& data, | 40 const WebData& data, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods | 164 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods |
165 // the console during webkit unit tests, so we leave the function empty. | 165 // the console during webkit unit tests, so we leave the function empty. |
166 DCHECK(runner); | 166 DCHECK(runner); |
167 } | 167 } |
168 | 168 |
169 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { | 169 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { |
170 return weak_factory_.CreateWeakPtr(); | 170 return weak_factory_.CreateWeakPtr(); |
171 } | 171 } |
172 | 172 |
173 } // namespace blink | 173 } // namespace blink |
OLD | NEW |