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

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

Issue 2831033002: Use unique_ptr for Platform::CreateURLLoader (Closed)
Patch Set: Created 3 years, 8 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 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 #ifndef WebURLLoaderMock_h 5 #ifndef WebURLLoaderMock_h
6 #define WebURLLoaderMock_h 6 #define WebURLLoaderMock_h
7 7
8 #include <memory> 8 #include <memory>
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "platform/wtf/WeakPtr.h" 10 #include "platform/wtf/WeakPtr.h"
(...skipping 12 matching lines...) Expand all
23 const int kRedirectResponseOverheadBytes = 300; 23 const int kRedirectResponseOverheadBytes = 300;
24 24
25 // A simple class for mocking WebURLLoader. 25 // A simple class for mocking WebURLLoader.
26 // If the WebURLLoaderMockFactory it is associated with has been configured to 26 // If the WebURLLoaderMockFactory it is associated with has been configured to
27 // mock the request it gets, it serves the mocked resource. Otherwise it just 27 // mock the request it gets, it serves the mocked resource. Otherwise it just
28 // forwards it to the default loader. 28 // forwards it to the default loader.
29 class WebURLLoaderMock : public WebURLLoader { 29 class WebURLLoaderMock : public WebURLLoader {
30 public: 30 public:
31 // This object becomes the owner of |default_loader|. 31 // This object becomes the owner of |default_loader|.
32 WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, 32 WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory,
33 WebURLLoader* default_loader); 33 std::unique_ptr<WebURLLoader> default_loader);
34 ~WebURLLoaderMock() override; 34 ~WebURLLoaderMock() override;
35 35
36 // Simulates the asynchronous request being served. 36 // Simulates the asynchronous request being served.
37 void ServeAsynchronousRequest(WebURLLoaderTestDelegate* delegate, 37 void ServeAsynchronousRequest(WebURLLoaderTestDelegate* delegate,
38 const WebURLResponse& response, 38 const WebURLResponse& response,
39 const WebData& data, 39 const WebData& data,
40 const WebURLError& error); 40 const WebURLError& error);
41 41
42 // Simulates the redirect being served. 42 // Simulates the redirect being served.
43 WebURLRequest ServeRedirect(const WebURLRequest& request, 43 WebURLRequest ServeRedirect(const WebURLRequest& request,
(...skipping 25 matching lines...) Expand all
69 bool is_deferred_ = false; 69 bool is_deferred_ = false;
70 70
71 WeakPtrFactory<WebURLLoaderMock> weak_factory_; 71 WeakPtrFactory<WebURLLoaderMock> weak_factory_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock); 73 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock);
74 }; 74 };
75 75
76 } // namespace blink 76 } // namespace blink
77 77
78 #endif // WebURLLoaderMock_h 78 #endif // WebURLLoaderMock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698