| 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 #ifndef WebURLLoaderMockFactory_h | 5 #ifndef WebURLLoaderMockFactory_h |
| 6 #define WebURLLoaderMockFactory_h | 6 #define WebURLLoaderMockFactory_h |
| 7 | 7 |
| 8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
| 9 #include "public/platform/WebData.h" | 9 #include "public/platform/WebData.h" |
| 10 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class WebURLLoaderMockFactory { | 22 class WebURLLoaderMockFactory { |
| 23 public: | 23 public: |
| 24 static std::unique_ptr<WebURLLoaderMockFactory> Create(); | 24 static std::unique_ptr<WebURLLoaderMockFactory> Create(); |
| 25 | 25 |
| 26 virtual ~WebURLLoaderMockFactory() {} | 26 virtual ~WebURLLoaderMockFactory() {} |
| 27 | 27 |
| 28 // Create a WebURLLoader that takes care of mocked requests. | 28 // Create a WebURLLoader that takes care of mocked requests. |
| 29 // Non-mocked request are forwarded to given loader which should not | 29 // Non-mocked request are forwarded to given loader which should not |
| 30 // be nullptr. | 30 // be nullptr. |
| 31 virtual WebURLLoader* CreateURLLoader(WebURLLoader*) = 0; | 31 virtual std::unique_ptr<WebURLLoader> CreateURLLoader( |
| 32 std::unique_ptr<WebURLLoader>) = 0; |
| 32 | 33 |
| 33 // Registers a response and the file to be served when the specified URL | 34 // Registers a response and the file to be served when the specified URL |
| 34 // is loaded. If no file is specified then the response content will be empty. | 35 // is loaded. If no file is specified then the response content will be empty. |
| 35 // unregisterURL() should be called for each test entry before registering | 36 // unregisterURL() should be called for each test entry before registering |
| 36 // another response for the same URL from another test. | 37 // another response for the same URL from another test. |
| 37 virtual void RegisterURL(const WebURL&, | 38 virtual void RegisterURL(const WebURL&, |
| 38 const WebURLResponse&, | 39 const WebURLResponse&, |
| 39 const WebString& file_path) = 0; | 40 const WebString& file_path) = 0; |
| 40 | 41 |
| 41 // Registers an error to be served when the specified URL is requested. | 42 // Registers an error to be served when the specified URL is requested. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 62 virtual void ServeAsynchronousRequests() = 0; | 63 virtual void ServeAsynchronousRequests() = 0; |
| 63 | 64 |
| 64 // Set a delegate that allows callbacks for all WebURLLoaderClients to be | 65 // Set a delegate that allows callbacks for all WebURLLoaderClients to be |
| 65 // intercepted. | 66 // intercepted. |
| 66 virtual void SetLoaderDelegate(WebURLLoaderTestDelegate*) = 0; | 67 virtual void SetLoaderDelegate(WebURLLoaderTestDelegate*) = 0; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace blink | 70 } // namespace blink |
| 70 | 71 |
| 71 #endif // WebURLLoaderMockFactory_h | 72 #endif // WebURLLoaderMockFactory_h |
| OLD | NEW |