OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | 5 #ifndef WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ |
6 #define WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | 6 #define WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGamepads.
h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGamepads.
h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 typedef struct _HyphenDict HyphenDict; | 29 typedef struct _HyphenDict HyphenDict; |
30 | 30 |
31 // An implementation of WebKitPlatformSupport for tests. | 31 // An implementation of WebKitPlatformSupport for tests. |
32 class TestWebKitPlatformSupport : | 32 class TestWebKitPlatformSupport : |
33 public webkit_glue::WebKitPlatformSupportImpl { | 33 public webkit_glue::WebKitPlatformSupportImpl { |
34 public: | 34 public: |
35 TestWebKitPlatformSupport(bool unit_test_mode, | 35 TestWebKitPlatformSupport(bool unit_test_mode, |
36 WebKit::Platform* shadow_platform_delegate); | 36 WebKit::Platform* shadow_platform_delegate); |
37 virtual ~TestWebKitPlatformSupport(); | 37 virtual ~TestWebKitPlatformSupport(); |
38 | 38 |
39 virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE; | 39 virtual WebKit::WebMimeRegistry* mimeRegistry(); |
40 virtual WebKit::WebClipboard* clipboard() OVERRIDE; | 40 virtual WebKit::WebClipboard* clipboard(); |
41 virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE; | 41 virtual WebKit::WebFileUtilities* fileUtilities(); |
42 virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE; | 42 virtual WebKit::WebSandboxSupport* sandboxSupport(); |
43 virtual WebKit::WebCookieJar* cookieJar() OVERRIDE; | 43 virtual WebKit::WebCookieJar* cookieJar(); |
44 virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE; | 44 virtual WebKit::WebBlobRegistry* blobRegistry(); |
45 virtual WebKit::WebFileSystem* fileSystem() OVERRIDE; | 45 virtual WebKit::WebFileSystem* fileSystem(); |
46 | 46 |
47 virtual bool sandboxEnabled() OVERRIDE; | 47 virtual bool sandboxEnabled(); |
48 virtual WebKit::WebKitPlatformSupport::FileHandle databaseOpenFile( | 48 virtual WebKit::WebKitPlatformSupport::FileHandle databaseOpenFile( |
49 const WebKit::WebString& vfs_file_name, int desired_flags) OVERRIDE; | 49 const WebKit::WebString& vfs_file_name, int desired_flags); |
50 virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, | 50 virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, |
51 bool sync_dir) OVERRIDE; | 51 bool sync_dir); |
52 virtual long databaseGetFileAttributes( | 52 virtual long databaseGetFileAttributes( |
53 const WebKit::WebString& vfs_file_name) OVERRIDE; | 53 const WebKit::WebString& vfs_file_name); |
54 virtual long long databaseGetFileSize( | 54 virtual long long databaseGetFileSize( |
55 const WebKit::WebString& vfs_file_name) OVERRIDE; | 55 const WebKit::WebString& vfs_file_name); |
56 virtual long long databaseGetSpaceAvailableForOrigin( | 56 virtual long long databaseGetSpaceAvailableForOrigin( |
57 const WebKit::WebString& origin_identifier) OVERRIDE; | 57 const WebKit::WebString& origin_identifier); |
58 virtual unsigned long long visitedLinkHash(const char* canonicalURL, | 58 virtual unsigned long long visitedLinkHash(const char* canonicalURL, |
59 size_t length) OVERRIDE; | 59 size_t length); |
60 virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE; | 60 virtual bool isLinkVisited(unsigned long long linkHash); |
61 virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE; | 61 virtual WebKit::WebMessagePortChannel* createMessagePortChannel(); |
62 virtual void prefetchHostName(const WebKit::WebString&) OVERRIDE; | 62 virtual void prefetchHostName(const WebKit::WebString&); |
63 virtual WebKit::WebURLLoader* createURLLoader() OVERRIDE; | 63 virtual WebKit::WebURLLoader* createURLLoader(); |
64 virtual WebKit::WebData loadResource(const char* name) OVERRIDE; | 64 virtual WebKit::WebData loadResource(const char* name); |
65 virtual WebKit::WebString queryLocalizedString( | 65 virtual WebKit::WebString queryLocalizedString( |
66 WebKit::WebLocalizedString::Name name) OVERRIDE; | 66 WebKit::WebLocalizedString::Name name); |
67 virtual WebKit::WebString queryLocalizedString( | 67 virtual WebKit::WebString queryLocalizedString( |
68 WebKit::WebLocalizedString::Name name, | 68 WebKit::WebLocalizedString::Name name, |
69 const WebKit::WebString& value) OVERRIDE; | 69 const WebKit::WebString& value); |
70 virtual WebKit::WebString queryLocalizedString( | 70 virtual WebKit::WebString queryLocalizedString( |
71 WebKit::WebLocalizedString::Name name, | 71 WebKit::WebLocalizedString::Name name, |
72 const WebKit::WebString& value1, | 72 const WebKit::WebString& value1, |
73 const WebKit::WebString& value2) OVERRIDE; | 73 const WebKit::WebString& value2); |
74 virtual WebKit::WebString defaultLocale() OVERRIDE; | 74 virtual WebKit::WebString defaultLocale(); |
75 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( | 75 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( |
76 const WebKit::WebString& path, unsigned quota) OVERRIDE; | 76 const WebKit::WebString& path, unsigned quota); |
77 | 77 |
78 virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; | 78 virtual WebKit::WebIDBFactory* idbFactory(); |
79 | 79 |
80 #if defined(OS_WIN) || defined(OS_MACOSX) | 80 #if defined(OS_WIN) || defined(OS_MACOSX) |
81 void SetThemeEngine(WebKit::WebThemeEngine* engine); | 81 void SetThemeEngine(WebKit::WebThemeEngine* engine); |
82 virtual WebKit::WebThemeEngine *themeEngine() OVERRIDE; | 82 virtual WebKit::WebThemeEngine *themeEngine(); |
83 #endif | 83 #endif |
84 | 84 |
85 virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D( | 85 virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D( |
86 const WebKit::WebGraphicsContext3D::Attributes&); | 86 const WebKit::WebGraphicsContext3D::Attributes&); |
87 virtual bool canAccelerate2dCanvas(); | 87 virtual bool canAccelerate2dCanvas(); |
88 | 88 |
89 WebURLLoaderMockFactory* url_loader_factory() { | 89 WebURLLoaderMockFactory* url_loader_factory() { |
90 return &url_loader_factory_; | 90 return &url_loader_factory_; |
91 } | 91 } |
92 | 92 |
93 const FilePath& file_system_root() const { | 93 const FilePath& file_system_root() const { |
94 return file_system_root_.path(); | 94 return file_system_root_.path(); |
95 } | 95 } |
96 | 96 |
97 // Mock out the WebAudioDevice since the real one | 97 // Mock out the WebAudioDevice since the real one |
98 // talks with the browser process. | 98 // talks with the browser process. |
99 virtual double audioHardwareSampleRate() OVERRIDE; | 99 virtual double audioHardwareSampleRate(); |
100 virtual size_t audioHardwareBufferSize() OVERRIDE; | 100 virtual size_t audioHardwareBufferSize(); |
101 virtual WebKit::WebAudioDevice* createAudioDevice(size_t bufferSize, | 101 virtual WebKit::WebAudioDevice* createAudioDevice(size_t bufferSize, |
102 unsigned numberOfChannels, double sampleRate, | 102 unsigned numberOfChannels, double sampleRate, |
103 WebKit::WebAudioDevice::RenderCallback*) OVERRIDE; | 103 WebKit::WebAudioDevice::RenderCallback*); |
104 | 104 |
105 virtual void sampleGamepads(WebKit::WebGamepads& data); | 105 virtual void sampleGamepads(WebKit::WebGamepads& data); |
106 void setGamepadData(const WebKit::WebGamepads& data); | 106 void setGamepadData(const WebKit::WebGamepads& data); |
107 | 107 |
108 virtual string16 GetLocalizedString(int message_id) OVERRIDE; | 108 virtual string16 GetLocalizedString(int message_id) OVERRIDE; |
109 virtual base::StringPiece GetDataResource( | 109 virtual base::StringPiece GetDataResource( |
110 int resource_id, | 110 int resource_id, |
111 ui::ScaleFactor scale_factor) OVERRIDE; | 111 ui::ScaleFactor scale_factor) OVERRIDE; |
112 virtual void GetPlugins(bool refresh, | 112 virtual void GetPlugins(bool refresh, |
113 std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE; | 113 std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE; |
114 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( | 114 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( |
115 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) | 115 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) |
116 OVERRIDE; | 116 OVERRIDE; |
117 virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( | 117 virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( |
118 WebKit::WebSocketStreamHandle* handle, | 118 WebKit::WebSocketStreamHandle* handle, |
119 webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; | 119 webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; |
120 | 120 |
121 virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter( | 121 virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter( |
122 WebKit::WebMediaStreamCenterClient* client) OVERRIDE; | 122 WebKit::WebMediaStreamCenterClient* client); |
123 virtual WebKit::WebRTCPeerConnectionHandler* createRTCPeerConnectionHandler( | 123 virtual WebKit::WebRTCPeerConnectionHandler* createRTCPeerConnectionHandler( |
124 WebKit::WebRTCPeerConnectionHandlerClient* client) OVERRIDE; | 124 WebKit::WebRTCPeerConnectionHandlerClient* client); |
125 virtual bool canHyphenate(const WebKit::WebString& locale) OVERRIDE; | 125 virtual bool canHyphenate(const WebKit::WebString& locale); |
126 virtual size_t computeLastHyphenLocation( | 126 virtual size_t computeLastHyphenLocation( |
127 const char16* characters, | 127 const char16* characters, |
128 size_t length, | 128 size_t length, |
129 size_t before_index, | 129 size_t before_index, |
130 const WebKit::WebString& locale) OVERRIDE; | 130 const WebKit::WebString& locale); |
131 | 131 |
132 virtual WebKit::WebGestureCurve* createFlingAnimationCurve( | 132 virtual WebKit::WebGestureCurve* createFlingAnimationCurve( |
133 int device_source, | 133 int device_source, |
134 const WebKit::WebFloatPoint& velocity, | 134 const WebKit::WebFloatPoint& velocity, |
135 const WebKit::WebSize& cumulative_scroll) OVERRIDE; | 135 const WebKit::WebSize& cumulative_scroll); |
136 | 136 |
137 private: | 137 private: |
138 TestShellWebMimeRegistryImpl mime_registry_; | 138 TestShellWebMimeRegistryImpl mime_registry_; |
139 MockWebClipboardImpl mock_clipboard_; | 139 MockWebClipboardImpl mock_clipboard_; |
140 webkit_glue::WebFileUtilitiesImpl file_utilities_; | 140 webkit_glue::WebFileUtilitiesImpl file_utilities_; |
141 base::ScopedTempDir appcache_dir_; | 141 base::ScopedTempDir appcache_dir_; |
142 SimpleAppCacheSystem appcache_system_; | 142 SimpleAppCacheSystem appcache_system_; |
143 SimpleDatabaseSystem database_system_; | 143 SimpleDatabaseSystem database_system_; |
144 SimpleDomStorageSystem dom_storage_system_; | 144 SimpleDomStorageSystem dom_storage_system_; |
145 SimpleWebCookieJarImpl cookie_jar_; | 145 SimpleWebCookieJarImpl cookie_jar_; |
146 scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_; | 146 scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_; |
147 SimpleFileSystem file_system_; | 147 SimpleFileSystem file_system_; |
148 base::ScopedTempDir file_system_root_; | 148 base::ScopedTempDir file_system_root_; |
149 WebURLLoaderMockFactory url_loader_factory_; | 149 WebURLLoaderMockFactory url_loader_factory_; |
150 bool unit_test_mode_; | 150 bool unit_test_mode_; |
151 WebKit::WebGamepads gamepad_data_; | 151 WebKit::WebGamepads gamepad_data_; |
152 WebKit::Platform* shadow_platform_delegate_; | 152 WebKit::Platform* shadow_platform_delegate_; |
153 HyphenDict* hyphen_dictionary_; | 153 HyphenDict* hyphen_dictionary_; |
154 | 154 |
155 #if defined(OS_WIN) || defined(OS_MACOSX) | 155 #if defined(OS_WIN) || defined(OS_MACOSX) |
156 WebKit::WebThemeEngine* active_theme_engine_; | 156 WebKit::WebThemeEngine* active_theme_engine_; |
157 #endif | 157 #endif |
158 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport); | 158 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport); |
159 }; | 159 }; |
160 | 160 |
161 #endif // WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | 161 #endif // WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ |
OLD | NEW |