OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef WebUnitTestSupport_h | 26 #ifndef WebUnitTestSupport_h |
27 #define WebUnitTestSupport_h | 27 #define WebUnitTestSupport_h |
28 | 28 |
29 #include "WebBlobData.h" | 29 #include "WebBlobData.h" |
30 #include "WebCommon.h" | 30 #include "WebCommon.h" |
31 #include "WebData.h" | 31 #include "WebData.h" |
32 #include "WebString.h" | 32 #include "WebString.h" |
| 33 #include "WebURLLoaderTestDelegate.h" |
33 #include "WebVector.h" | 34 #include "WebVector.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class WebLayerTreeView; | 38 class WebLayerTreeView; |
38 class WebURL; | 39 class WebURL; |
39 class WebURLLoader; | |
40 class WebURLResponse; | 40 class WebURLResponse; |
41 class WebURLLoaderClient; | |
42 struct WebURLError; | 41 struct WebURLError; |
43 | 42 |
44 class WebURLLoaderTestDelegate { | |
45 public: | |
46 ~WebURLLoaderTestDelegate() { } | |
47 | |
48 virtual void didReceiveData(WebURLLoaderClient* originalClient, WebURLLoader
*, const char* data, int dataLength, int encodedDataLength) { } | |
49 }; | |
50 | |
51 class WebUnitTestSupport { | 43 class WebUnitTestSupport { |
52 public: | 44 public: |
53 virtual void registerMockedURL(const WebURL&, const WebURLResponse&, const W
ebString& filePath) { } | 45 virtual void registerMockedURL(const WebURL&, const WebURLResponse&, const W
ebString& filePath) { } |
54 | 46 |
55 // Registers the error to be returned when |url| is requested. | 47 // Registers the error to be returned when |url| is requested. |
56 virtual void registerMockedErrorURL(const WebURL&, const WebURLResponse&, co
nst WebURLError&) { } | 48 virtual void registerMockedErrorURL(const WebURL&, const WebURLResponse&, co
nst WebURLError&) { } |
57 | 49 |
58 // Unregisters URLs so they are no longer mocked. | 50 // Unregisters URLs so they are no longer mocked. |
59 virtual void unregisterMockedURL(const WebURL&) { } | 51 virtual void unregisterMockedURL(const WebURL&) { } |
60 virtual void unregisterAllMockedURLs() { } | 52 virtual void unregisterAllMockedURLs() { } |
61 | 53 |
62 // Causes all pending asynchronous requests to be served. When this method | 54 // Causes all pending asynchronous requests to be served. When this method |
63 // returns all the pending requests have been processed. | 55 // returns all the pending requests have been processed. |
64 virtual void serveAsynchronousMockedRequests() { } | 56 virtual void serveAsynchronousMockedRequests() { } |
65 | 57 |
66 // Set a delegate that allows callbacks for all WebURLLoaderClients to be in
tercepted. | 58 // Set a delegate that allows callbacks for all WebURLLoaderClients to be in
tercepted. |
67 virtual void setLoaderDelegate(WebURLLoaderTestDelegate*) {} | 59 virtual void setLoaderDelegate(WebURLLoaderTestDelegate*) { } |
68 | 60 |
69 // Returns the root directory of the WebKit code. | 61 // Returns the root directory of the WebKit code. |
70 virtual WebString webKitRootDir() { return WebString(); } | 62 virtual WebString webKitRootDir() { return WebString(); } |
71 | 63 |
72 // Constructs a WebLayerTreeView set up with reasonable defaults for | 64 // Constructs a WebLayerTreeView set up with reasonable defaults for |
73 // testing. | 65 // testing. |
74 virtual WebLayerTreeView* createLayerTreeViewForTesting() { return nullptr;
} | 66 virtual WebLayerTreeView* createLayerTreeViewForTesting() { return nullptr;
} |
75 | 67 |
76 virtual WebData readFromFile(const WebString& path) { return WebData(); } | 68 virtual WebData readFromFile(const WebString& path) { return WebData(); } |
77 | 69 |
78 // Gets the blob items from the blob handle's uuid. | 70 // Gets the blob items from the blob handle's uuid. |
79 // The ownership of WebBlobData::Items is not transferred. | 71 // The ownership of WebBlobData::Items is not transferred. |
80 virtual bool getBlobItems(const WebString& uuid, WebVector<WebBlobData::Item
*>*) { return false; } | 72 virtual bool getBlobItems(const WebString& uuid, WebVector<WebBlobData::Item
*>*) { return false; } |
81 | 73 |
82 virtual void enterRunLoop() { } | 74 virtual void enterRunLoop() { } |
83 virtual void exitRunLoop() { } | 75 virtual void exitRunLoop() { } |
84 }; | 76 }; |
85 | 77 |
86 } | 78 } |
87 | 79 |
88 #endif // WebUnitTestSupport_h | 80 #endif // WebUnitTestSupport_h |
OLD | NEW |