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

Side by Side Diff: third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 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 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, 15 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory,
16 WebURLLoader* default_loader) 16 WebURLLoader* default_loader)
17 : factory_(factory), 17 : factory_(factory),
18 default_loader_(wrapUnique(default_loader)), 18 default_loader_(WTF::wrapUnique(default_loader)),
19 weak_factory_(this) { 19 weak_factory_(this) {}
20 }
21 20
22 WebURLLoaderMock::~WebURLLoaderMock() { 21 WebURLLoaderMock::~WebURLLoaderMock() {
23 cancel(); 22 cancel();
24 } 23 }
25 24
26 void WebURLLoaderMock::ServeAsynchronousRequest( 25 void WebURLLoaderMock::ServeAsynchronousRequest(
27 WebURLLoaderTestDelegate* delegate, 26 WebURLLoaderTestDelegate* delegate,
28 const WebURLResponse& response, 27 const WebURLResponse& response,
29 const WebData& data, 28 const WebData& data,
30 const WebURLError& error) { 29 const WebURLError& error) {
31 DCHECK(!using_default_loader_); 30 DCHECK(!using_default_loader_);
32 if (!client_) 31 if (!client_)
33 return; 32 return;
34 33
35 // If no delegate is provided then create an empty one. The default behavior 34 // If no delegate is provided then create an empty one. The default behavior
36 // will just proxy to the client. 35 // will just proxy to the client.
37 std::unique_ptr<WebURLLoaderTestDelegate> default_delegate; 36 std::unique_ptr<WebURLLoaderTestDelegate> default_delegate;
38 if (!delegate) { 37 if (!delegate) {
39 default_delegate = wrapUnique(new WebURLLoaderTestDelegate()); 38 default_delegate = WTF::wrapUnique(new WebURLLoaderTestDelegate());
40 delegate = default_delegate.get(); 39 delegate = default_delegate.get();
41 } 40 }
42 41
43 // didReceiveResponse() and didReceiveData() might end up getting ::cancel() 42 // didReceiveResponse() and didReceiveData() might end up getting ::cancel()
44 // to be called which will make the ResourceLoader to delete |this|. 43 // to be called which will make the ResourceLoader to delete |this|.
45 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr(); 44 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr();
46 45
47 delegate->didReceiveResponse(client_, response); 46 delegate->didReceiveResponse(client_, response);
48 if (!self) 47 if (!self)
49 return; 48 return;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods 156 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods
158 // the console during webkit unit tests, so we leave the function empty. 157 // the console during webkit unit tests, so we leave the function empty.
159 DCHECK(runner); 158 DCHECK(runner);
160 } 159 }
161 160
162 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { 161 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() {
163 return weak_factory_.createWeakPtr(); 162 return weak_factory_.createWeakPtr();
164 } 163 }
165 164
166 } // namespace blink 165 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698