Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 const WebURLResponse&, | 38 const WebURLResponse&, |
| 39 const WebString& filePath) = 0; | 39 const WebString& filePath) = 0; |
| 40 | 40 |
| 41 // Registers an error to be served when the specified URL is requested. | 41 // Registers an error to be served when the specified URL is requested. |
| 42 // unregisterURL() should be called for each test entry before registering | 42 // unregisterURL() should be called for each test entry before registering |
| 43 // another response for the same URL from another test. | 43 // another response for the same URL from another test. |
| 44 virtual void registerErrorURL(const WebURL&, | 44 virtual void registerErrorURL(const WebURL&, |
| 45 const WebURLResponse&, | 45 const WebURLResponse&, |
| 46 const WebURLError&) = 0; | 46 const WebURLError&) = 0; |
| 47 | 47 |
| 48 // Unregisters URLs so they are no longer mocked. | 48 // Unregisters the given URL so it is no longer mocked. |
| 49 virtual void unregisterURL(const WebURL&) = 0; | 49 virtual void unregisterURL(const WebURL&) = 0; |
| 50 | |
| 51 // Unregisters URLs so they are no longer mocked. This also clears the | |
| 52 // MemoryCache. | |
| 50 virtual void unregisterAllURLs() = 0; | 53 virtual void unregisterAllURLs() = 0; |
|
dcheng
2017/02/09 19:42:12
I wonder if it'd be clearer if it was named:
unre
| |
| 51 | 54 |
| 52 // Causes all pending asynchronous requests to be served. When this method | 55 // Causes all pending asynchronous requests to be served. When this method |
| 53 // returns all the pending requests have been processed. | 56 // returns all the pending requests have been processed. |
| 54 // Note: this may not work as expected if more requests could be made | 57 // Note: this may not work as expected if more requests could be made |
| 55 // asynchronously from different threads (e.g. when HTML parser thread | 58 // asynchronously from different threads (e.g. when HTML parser thread |
| 56 // is being involved). | 59 // is being involved). |
| 57 // DO NOT USE THIS for Frame loading; always use methods defined in | 60 // DO NOT USE THIS for Frame loading; always use methods defined in |
| 58 // FrameTestHelpers instead. | 61 // FrameTestHelpers instead. |
| 59 virtual void serveAsynchronousRequests() = 0; | 62 virtual void serveAsynchronousRequests() = 0; |
| 60 | 63 |
| 61 // Set a delegate that allows callbacks for all WebURLLoaderClients to be | 64 // Set a delegate that allows callbacks for all WebURLLoaderClients to be |
| 62 // intercepted. | 65 // intercepted. |
| 63 virtual void setLoaderDelegate(WebURLLoaderTestDelegate*) = 0; | 66 virtual void setLoaderDelegate(WebURLLoaderTestDelegate*) = 0; |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 } // namespace blink | 69 } // namespace blink |
| 67 | 70 |
| 68 #endif // WebURLLoaderMockFactory_h | 71 #endif // WebURLLoaderMockFactory_h |
| OLD | NEW |