| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | |
| 6 #define WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/files/scoped_temp_dir.h" | |
| 10 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" | |
| 11 #include "webkit/child/webkitplatformsupport_child_impl.h" | |
| 12 #include "webkit/glue/simple_webmimeregistry_impl.h" | |
| 13 #include "webkit/glue/webfileutilities_impl.h" | |
| 14 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" | |
| 15 #include "webkit/support/mock_webclipboard_impl.h" | |
| 16 #include "webkit/support/weburl_loader_mock_factory.h" | |
| 17 | |
| 18 namespace WebKit { | |
| 19 class WebLayerTreeView; | |
| 20 } | |
| 21 | |
| 22 // An implementation of WebKitPlatformSupport for tests. | |
| 23 class TestWebKitPlatformSupport : | |
| 24 public WebKit::WebUnitTestSupport, | |
| 25 public webkit_glue::WebKitPlatformSupportChildImpl { | |
| 26 public: | |
| 27 TestWebKitPlatformSupport(); | |
| 28 virtual ~TestWebKitPlatformSupport(); | |
| 29 | |
| 30 virtual WebKit::WebMimeRegistry* mimeRegistry(); | |
| 31 virtual WebKit::WebClipboard* clipboard(); | |
| 32 virtual WebKit::WebFileUtilities* fileUtilities(); | |
| 33 virtual WebKit::WebIDBFactory* idbFactory(); | |
| 34 | |
| 35 virtual WebKit::WebURLLoader* createURLLoader(); | |
| 36 virtual WebKit::WebData loadResource(const char* name); | |
| 37 virtual WebKit::WebString queryLocalizedString( | |
| 38 WebKit::WebLocalizedString::Name name); | |
| 39 virtual WebKit::WebString queryLocalizedString( | |
| 40 WebKit::WebLocalizedString::Name name, | |
| 41 const WebKit::WebString& value); | |
| 42 virtual WebKit::WebString queryLocalizedString( | |
| 43 WebKit::WebLocalizedString::Name name, | |
| 44 const WebKit::WebString& value1, | |
| 45 const WebKit::WebString& value2); | |
| 46 virtual WebKit::WebString defaultLocale(); | |
| 47 | |
| 48 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 49 void SetThemeEngine(WebKit::WebThemeEngine* engine); | |
| 50 virtual WebKit::WebThemeEngine *themeEngine(); | |
| 51 #endif | |
| 52 | |
| 53 virtual WebKit::WebCompositorSupport* compositorSupport(); | |
| 54 | |
| 55 WebURLLoaderMockFactory* url_loader_factory() { | |
| 56 return &url_loader_factory_; | |
| 57 } | |
| 58 | |
| 59 const base::FilePath& file_system_root() const { | |
| 60 return file_system_root_.path(); | |
| 61 } | |
| 62 | |
| 63 virtual base::string16 GetLocalizedString(int message_id) OVERRIDE; | |
| 64 virtual base::StringPiece GetDataResource( | |
| 65 int resource_id, | |
| 66 ui::ScaleFactor scale_factor) OVERRIDE; | |
| 67 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( | |
| 68 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) | |
| 69 OVERRIDE; | |
| 70 virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( | |
| 71 WebKit::WebSocketStreamHandle* handle, | |
| 72 webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; | |
| 73 | |
| 74 virtual WebKit::WebGestureCurve* createFlingAnimationCurve( | |
| 75 int device_source, | |
| 76 const WebKit::WebFloatPoint& velocity, | |
| 77 const WebKit::WebSize& cumulative_scroll); | |
| 78 | |
| 79 virtual WebKit::WebUnitTestSupport* unitTestSupport(); | |
| 80 | |
| 81 // WebUnitTestSupport implementation | |
| 82 virtual void registerMockedURL(const WebKit::WebURL& url, | |
| 83 const WebKit::WebURLResponse& response, | |
| 84 const WebKit::WebString& filePath); | |
| 85 virtual void registerMockedErrorURL(const WebKit::WebURL& url, | |
| 86 const WebKit::WebURLResponse& response, | |
| 87 const WebKit::WebURLError& error); | |
| 88 virtual void unregisterMockedURL(const WebKit::WebURL& url); | |
| 89 virtual void unregisterAllMockedURLs(); | |
| 90 virtual void serveAsynchronousMockedRequests(); | |
| 91 virtual WebKit::WebString webKitRootDir(); | |
| 92 virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting(); | |
| 93 virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting( | |
| 94 TestViewType type); | |
| 95 virtual WebKit::WebData readFromFile(const WebKit::WebString& path); | |
| 96 | |
| 97 private: | |
| 98 webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; | |
| 99 MockWebClipboardImpl mock_clipboard_; | |
| 100 webkit_glue::WebFileUtilitiesImpl file_utilities_; | |
| 101 base::ScopedTempDir file_system_root_; | |
| 102 WebURLLoaderMockFactory url_loader_factory_; | |
| 103 webkit::WebCompositorSupportImpl compositor_support_; | |
| 104 | |
| 105 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 106 WebKit::WebThemeEngine* active_theme_engine_; | |
| 107 #endif | |
| 108 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport); | |
| 109 }; | |
| 110 | |
| 111 #endif // WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | |
| OLD | NEW |