| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 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 "WebCommon.h" | 29 #include "WebCommon.h" |
| 30 #include "WebData.h" |
| 30 #include "WebString.h" | 31 #include "WebString.h" |
| 31 | 32 |
| 32 namespace WebKit { | 33 namespace WebKit { |
| 33 | 34 |
| 34 class WebLayerTreeView; | 35 class WebLayerTreeView; |
| 35 class WebURL; | 36 class WebURL; |
| 36 class WebURLResponse; | 37 class WebURLResponse; |
| 37 struct WebURLError; | 38 struct WebURLError; |
| 38 | 39 |
| 39 class WebUnitTestSupport { | 40 class WebUnitTestSupport { |
| 40 public: | 41 public: |
| 41 virtual void registerMockedURL(const WebURL&, const WebURLResponse&, const W
ebString& filePath) { } | 42 virtual void registerMockedURL(const WebURL&, const WebURLResponse&, const W
ebString& filePath) { } |
| 42 | 43 |
| 43 // Registers the error to be returned when |url| is requested. | 44 // Registers the error to be returned when |url| is requested. |
| 44 virtual void registerMockedErrorURL(const WebURL&, const WebURLResponse&, co
nst WebURLError&) { } | 45 virtual void registerMockedErrorURL(const WebURL&, const WebURLResponse&, co
nst WebURLError&) { } |
| 45 | 46 |
| 46 // Unregisters URLs so they are no longer mocked. | 47 // Unregisters URLs so they are no longer mocked. |
| 47 virtual void unregisterMockedURL(const WebURL&) { } | 48 virtual void unregisterMockedURL(const WebURL&) { } |
| 48 virtual void unregisterAllMockedURLs() { } | 49 virtual void unregisterAllMockedURLs() { } |
| 49 | 50 |
| 50 // Causes all pending asynchronous requests to be served. When this method | 51 // Causes all pending asynchronous requests to be served. When this method |
| 51 // returns all the pending requests have been processed. | 52 // returns all the pending requests have been processed. |
| 52 virtual void serveAsynchronousMockedRequests() { } | 53 virtual void serveAsynchronousMockedRequests() { } |
| 53 | 54 |
| 54 // Returns the root directory of the WebKit code. | 55 // Returns the root directory of the WebKit code. |
| 55 virtual WebString webKitRootDir() { return WebString(); } | 56 virtual WebString webKitRootDir() { return WebString(); } |
| 56 | 57 |
| 57 // Constructs a WebLayerTreeView set up with reasonable defaults for | 58 // Constructs a WebLayerTreeView set up with reasonable defaults for |
| 58 // testing. | 59 // testing. |
| 60 virtual WebLayerTreeView* createLayerTreeViewForTesting() { return 0; } |
| 59 | 61 |
| 60 virtual WebLayerTreeView* createLayerTreeViewForTesting() { return 0; } | 62 virtual WebData readFromFile(const WebString& path) { return WebData(); } |
| 61 | 63 |
| 62 // DEPRECATED, use the version above. | 64 // DEPRECATED, use the version above. |
| 63 #define HAVE_CREATELAYERTREEVIEWFORTESTING 1 | 65 #define HAVE_CREATELAYERTREEVIEWFORTESTING 1 |
| 64 enum TestViewType { | 66 enum TestViewType { |
| 65 TestViewTypeUnitTest, | 67 TestViewTypeUnitTest, |
| 66 TestViewTypeLayoutTest | 68 TestViewTypeLayoutTest |
| 67 }; | 69 }; |
| 68 virtual WebLayerTreeView* createLayerTreeViewForTesting(TestViewType) { retu
rn 0; } | 70 virtual WebLayerTreeView* createLayerTreeViewForTesting(TestViewType) { retu
rn 0; } |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 } | 73 } |
| 72 | 74 |
| 73 #endif // WebUnitTestSupport_h | 75 #endif // WebUnitTestSupport_h |
| OLD | NEW |