OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "third_party/WebKit/Source/WebKit/chromium/public/WebGamepads.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGamepads.h" |
9 #include "webkit/glue/webfileutilities_impl.h" | 10 #include "webkit/glue/webfileutilities_impl.h" |
10 #include "webkit/glue/webkitplatformsupport_impl.h" | 11 #include "webkit/glue/webkitplatformsupport_impl.h" |
11 #include "webkit/support/simple_database_system.h" | 12 #include "webkit/support/simple_database_system.h" |
12 #include "webkit/support/weburl_loader_mock_factory.h" | 13 #include "webkit/support/weburl_loader_mock_factory.h" |
13 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" | 14 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" |
14 #include "webkit/tools/test_shell/simple_appcache_system.h" | 15 #include "webkit/tools/test_shell/simple_appcache_system.h" |
15 #include "webkit/tools/test_shell/simple_file_system.h" | 16 #include "webkit/tools/test_shell/simple_file_system.h" |
16 #include "webkit/tools/test_shell/simple_webcookiejar_impl.h" | 17 #include "webkit/tools/test_shell/simple_webcookiejar_impl.h" |
17 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" | 18 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" |
18 | 19 |
19 class TestShellWebBlobRegistryImpl; | 20 class TestShellWebBlobRegistryImpl; |
20 | 21 |
21 namespace WebKit { | 22 namespace WebKit { |
22 class WebAudioDevice; | 23 class WebAudioDevice; |
23 } | 24 } |
24 | 25 |
25 // An implementation of WebKitPlatformSupport for tests. | 26 // An implementation of WebKitPlatformSupport for tests. |
26 class TestWebKitPlatformSupport : | 27 class TestWebKitPlatformSupport : |
27 public webkit_glue::WebKitPlatformSupportImpl { | 28 public webkit_glue::WebKitPlatformSupportImpl { |
28 public: | 29 public: |
29 explicit TestWebKitPlatformSupport(bool unit_test_mode); | 30 explicit TestWebKitPlatformSupport(bool unit_test_mode); |
30 virtual ~TestWebKitPlatformSupport(); | 31 virtual ~TestWebKitPlatformSupport(); |
31 | 32 |
32 virtual WebKit::WebMimeRegistry* mimeRegistry(); | 33 virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE; |
33 virtual WebKit::WebClipboard* clipboard(); | 34 virtual WebKit::WebClipboard* clipboard() OVERRIDE; |
34 virtual WebKit::WebFileUtilities* fileUtilities(); | 35 virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE; |
35 virtual WebKit::WebSandboxSupport* sandboxSupport(); | 36 virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE; |
36 virtual WebKit::WebCookieJar* cookieJar(); | 37 virtual WebKit::WebCookieJar* cookieJar() OVERRIDE; |
37 virtual WebKit::WebBlobRegistry* blobRegistry(); | 38 virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE; |
38 virtual WebKit::WebFileSystem* fileSystem(); | 39 virtual WebKit::WebFileSystem* fileSystem() OVERRIDE; |
39 | 40 |
40 virtual bool sandboxEnabled(); | 41 virtual bool sandboxEnabled() OVERRIDE; |
41 virtual WebKit::WebKitPlatformSupport::FileHandle databaseOpenFile( | 42 virtual WebKit::WebKitPlatformSupport::FileHandle databaseOpenFile( |
42 const WebKit::WebString& vfs_file_name, int desired_flags); | 43 const WebKit::WebString& vfs_file_name, int desired_flags) OVERRIDE; |
43 virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, | 44 virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, |
44 bool sync_dir); | 45 bool sync_dir) OVERRIDE; |
45 virtual long databaseGetFileAttributes( | 46 virtual long databaseGetFileAttributes( |
46 const WebKit::WebString& vfs_file_name); | 47 const WebKit::WebString& vfs_file_name) OVERRIDE; |
47 virtual long long databaseGetFileSize( | 48 virtual long long databaseGetFileSize( |
48 const WebKit::WebString& vfs_file_name); | 49 const WebKit::WebString& vfs_file_name) OVERRIDE; |
49 virtual long long databaseGetSpaceAvailableForOrigin( | 50 virtual long long databaseGetSpaceAvailableForOrigin( |
50 const WebKit::WebString& origin_identifier); | 51 const WebKit::WebString& origin_identifier) OVERRIDE; |
51 virtual unsigned long long visitedLinkHash(const char* canonicalURL, | 52 virtual unsigned long long visitedLinkHash(const char* canonicalURL, |
52 size_t length); | 53 size_t length) OVERRIDE; |
53 virtual bool isLinkVisited(unsigned long long linkHash); | 54 virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE; |
54 virtual WebKit::WebMessagePortChannel* createMessagePortChannel(); | 55 virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE; |
55 virtual void prefetchHostName(const WebKit::WebString&); | 56 virtual void prefetchHostName(const WebKit::WebString&) OVERRIDE; |
56 virtual WebKit::WebURLLoader* createURLLoader(); | 57 virtual WebKit::WebURLLoader* createURLLoader() OVERRIDE; |
57 virtual WebKit::WebData loadResource(const char* name); | 58 virtual WebKit::WebData loadResource(const char* name) OVERRIDE; |
58 virtual WebKit::WebString queryLocalizedString( | 59 virtual WebKit::WebString queryLocalizedString( |
59 WebKit::WebLocalizedString::Name name); | 60 WebKit::WebLocalizedString::Name name) OVERRIDE; |
60 virtual WebKit::WebString queryLocalizedString( | |
61 WebKit::WebLocalizedString::Name name, const WebKit::WebString& value); | |
62 virtual WebKit::WebString queryLocalizedString( | 61 virtual WebKit::WebString queryLocalizedString( |
63 WebKit::WebLocalizedString::Name name, | 62 WebKit::WebLocalizedString::Name name, |
64 const WebKit::WebString& value1, const WebKit::WebString& value2); | 63 const WebKit::WebString& value) OVERRIDE; |
65 virtual WebKit::WebString defaultLocale(); | 64 virtual WebKit::WebString queryLocalizedString( |
| 65 WebKit::WebLocalizedString::Name name, |
| 66 const WebKit::WebString& value1, |
| 67 const WebKit::WebString& value2) OVERRIDE; |
| 68 virtual WebKit::WebString defaultLocale() OVERRIDE; |
66 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( | 69 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( |
67 const WebKit::WebString& path, unsigned quota); | 70 const WebKit::WebString& path, unsigned quota) OVERRIDE; |
68 | 71 |
69 virtual void dispatchStorageEvent(const WebKit::WebString& key, | 72 virtual void dispatchStorageEvent(const WebKit::WebString& key, |
70 const WebKit::WebString& old_value, const WebKit::WebString& new_value, | 73 const WebKit::WebString& old_value, const WebKit::WebString& new_value, |
71 const WebKit::WebString& origin, const WebKit::WebURL& url, | 74 const WebKit::WebString& origin, const WebKit::WebURL& url, |
72 bool is_local_storage); | 75 bool is_local_storage) OVERRIDE; |
73 virtual WebKit::WebIDBFactory* idbFactory(); | 76 virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; |
74 virtual void createIDBKeysFromSerializedValuesAndKeyPath( | 77 virtual void createIDBKeysFromSerializedValuesAndKeyPath( |
75 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, | 78 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, |
76 const WebKit::WebString& keyPath, | 79 const WebKit::WebString& keyPath, |
77 WebKit::WebVector<WebKit::WebIDBKey>& keys_out); | 80 WebKit::WebVector<WebKit::WebIDBKey>& keys_out) OVERRIDE; |
78 virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( | 81 virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( |
79 const WebKit::WebIDBKey& key, | 82 const WebKit::WebIDBKey& key, |
80 const WebKit::WebSerializedScriptValue& value, | 83 const WebKit::WebSerializedScriptValue& value, |
81 const WebKit::WebString& keyPath); | 84 const WebKit::WebString& keyPath) OVERRIDE; |
82 | 85 |
83 #if defined(OS_WIN) || defined(OS_MACOSX) | 86 #if defined(OS_WIN) || defined(OS_MACOSX) |
84 void SetThemeEngine(WebKit::WebThemeEngine* engine); | 87 void SetThemeEngine(WebKit::WebThemeEngine* engine); |
85 virtual WebKit::WebThemeEngine *themeEngine(); | 88 virtual WebKit::WebThemeEngine *themeEngine() OVERRIDE; |
86 #endif | 89 #endif |
87 | 90 |
88 virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); | 91 virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() OVERRIDE; |
89 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); | 92 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() OVERRIDE; |
90 | 93 |
91 WebURLLoaderMockFactory* url_loader_factory() { | 94 WebURLLoaderMockFactory* url_loader_factory() { |
92 return &url_loader_factory_; | 95 return &url_loader_factory_; |
93 } | 96 } |
94 | 97 |
95 const FilePath& file_system_root() const { | 98 const FilePath& file_system_root() const { |
96 return file_system_root_.path(); | 99 return file_system_root_.path(); |
97 } | 100 } |
98 | 101 |
99 // Mock out the WebAudioDevice since the real one | 102 // Mock out the WebAudioDevice since the real one |
100 // talks with the browser process. | 103 // talks with the browser process. |
101 virtual double audioHardwareSampleRate(); | 104 virtual double audioHardwareSampleRate() OVERRIDE; |
102 virtual size_t audioHardwareBufferSize(); | 105 virtual size_t audioHardwareBufferSize() OVERRIDE; |
103 virtual WebKit::WebAudioDevice* createAudioDevice(size_t bufferSize, | 106 virtual WebKit::WebAudioDevice* createAudioDevice(size_t bufferSize, |
104 unsigned numberOfChannels, double sampleRate, | 107 unsigned numberOfChannels, double sampleRate, |
105 WebKit::WebAudioDevice::RenderCallback*); | 108 WebKit::WebAudioDevice::RenderCallback*) OVERRIDE; |
106 | 109 |
107 virtual void sampleGamepads(WebKit::WebGamepads& data); | 110 virtual void sampleGamepads(WebKit::WebGamepads& data); |
108 void setGamepadData(const WebKit::WebGamepads& data); | 111 void setGamepadData(const WebKit::WebGamepads& data); |
109 | 112 |
| 113 virtual string16 GetLocalizedString(int message_id) OVERRIDE; |
| 114 virtual base::StringPiece GetDataResource(int resource_id) OVERRIDE; |
| 115 virtual void GetPlugins(bool refresh, |
| 116 std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE; |
| 117 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( |
| 118 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) |
| 119 OVERRIDE; |
| 120 virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( |
| 121 WebKit::WebSocketStreamHandle* handle, |
| 122 webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; |
| 123 |
110 private: | 124 private: |
111 TestShellWebMimeRegistryImpl mime_registry_; | 125 TestShellWebMimeRegistryImpl mime_registry_; |
112 MockWebClipboardImpl mock_clipboard_; | 126 MockWebClipboardImpl mock_clipboard_; |
113 webkit_glue::WebFileUtilitiesImpl file_utilities_; | 127 webkit_glue::WebFileUtilitiesImpl file_utilities_; |
114 ScopedTempDir appcache_dir_; | 128 ScopedTempDir appcache_dir_; |
115 SimpleAppCacheSystem appcache_system_; | 129 SimpleAppCacheSystem appcache_system_; |
116 SimpleDatabaseSystem database_system_; | 130 SimpleDatabaseSystem database_system_; |
117 SimpleWebCookieJarImpl cookie_jar_; | 131 SimpleWebCookieJarImpl cookie_jar_; |
118 scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_; | 132 scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_; |
119 SimpleFileSystem file_system_; | 133 SimpleFileSystem file_system_; |
120 ScopedTempDir file_system_root_; | 134 ScopedTempDir file_system_root_; |
121 WebURLLoaderMockFactory url_loader_factory_; | 135 WebURLLoaderMockFactory url_loader_factory_; |
122 bool unit_test_mode_; | 136 bool unit_test_mode_; |
123 WebKit::WebGamepads gamepad_data_; | 137 WebKit::WebGamepads gamepad_data_; |
124 | 138 |
125 #if defined(OS_WIN) || defined(OS_MACOSX) | 139 #if defined(OS_WIN) || defined(OS_MACOSX) |
126 WebKit::WebThemeEngine* active_theme_engine_; | 140 WebKit::WebThemeEngine* active_theme_engine_; |
127 #endif | 141 #endif |
128 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport); | 142 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport); |
129 }; | 143 }; |
130 | 144 |
131 #endif // WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ | 145 #endif // WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ |
OLD | NEW |