Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: webkit/support/test_webkit_platform_support.h

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

Powered by Google App Engine
This is Rietveld 408576698