OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ |
6 #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
11 #include "base/stats_counters.h" | 11 #include "base/stats_counters.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "media/base/media.h" | 13 #include "media/base/media.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
24 #include "webkit/appcache/web_application_cache_host_impl.h" | 25 #include "webkit/appcache/web_application_cache_host_impl.h" |
(...skipping 26 matching lines...) Expand all Loading... |
51 WebKit::WebString::fromUTF8("test-shell-resource")); | 52 WebKit::WebString::fromUTF8("test-shell-resource")); |
52 WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( | 53 WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( |
53 WebKit::WebString::fromUTF8("test-shell-resource")); | 54 WebKit::WebString::fromUTF8("test-shell-resource")); |
54 WebKit::WebScriptController::enableV8SingleThreadMode(); | 55 WebKit::WebScriptController::enableV8SingleThreadMode(); |
55 WebKit::WebScriptController::registerExtension( | 56 WebKit::WebScriptController::registerExtension( |
56 extensions_v8::GearsExtension::Get()); | 57 extensions_v8::GearsExtension::Get()); |
57 WebKit::WebScriptController::registerExtension( | 58 WebKit::WebScriptController::registerExtension( |
58 extensions_v8::IntervalExtension::Get()); | 59 extensions_v8::IntervalExtension::Get()); |
59 WebKit::WebRuntimeFeatures::enableSockets(true); | 60 WebKit::WebRuntimeFeatures::enableSockets(true); |
60 WebKit::WebRuntimeFeatures::enableApplicationCache(true); | 61 WebKit::WebRuntimeFeatures::enableApplicationCache(true); |
| 62 WebKit::WebRuntimeFeatures::enableDatabase(true); |
61 | 63 |
62 // Load libraries for media and enable the media player. | 64 // Load libraries for media and enable the media player. |
63 FilePath module_path; | 65 FilePath module_path; |
64 WebKit::WebRuntimeFeatures::enableMediaPlayer( | 66 WebKit::WebRuntimeFeatures::enableMediaPlayer( |
65 PathService::Get(base::DIR_MODULE, &module_path) && | 67 PathService::Get(base::DIR_MODULE, &module_path) && |
66 media::InitializeMediaLibrary(module_path)); | 68 media::InitializeMediaLibrary(module_path)); |
67 | 69 |
68 // Construct and initialize an appcache system for this scope. | 70 // Construct and initialize an appcache system for this scope. |
69 // A new empty temp directory is created to house any cached | 71 // A new empty temp directory is created to house any cached |
70 // content during the run. Upon exit that directory is deleted. | 72 // content during the run. Upon exit that directory is deleted. |
71 if (appcache_dir_.CreateUniqueTempDir()) | 73 if (appcache_dir_.CreateUniqueTempDir()) |
72 SimpleAppCacheSystem::InitializeOnUIThread(appcache_dir_.path()); | 74 SimpleAppCacheSystem::InitializeOnUIThread(appcache_dir_.path()); |
73 | 75 |
| 76 WebKit::WebDatabase::setObserver(&database_system_); |
| 77 |
74 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
75 // Ensure we pick up the default theme engine. | 79 // Ensure we pick up the default theme engine. |
76 SetThemeEngine(NULL); | 80 SetThemeEngine(NULL); |
77 #endif | 81 #endif |
78 } | 82 } |
79 | 83 |
80 ~TestShellWebKitInit() { | 84 ~TestShellWebKitInit() { |
81 WebKit::shutdown(); | 85 WebKit::shutdown(); |
82 } | 86 } |
83 | 87 |
(...skipping 13 matching lines...) Expand all Loading... |
97 | 101 |
98 virtual WebKit::WebSandboxSupport* sandboxSupport() { | 102 virtual WebKit::WebSandboxSupport* sandboxSupport() { |
99 return NULL; | 103 return NULL; |
100 } | 104 } |
101 | 105 |
102 virtual bool sandboxEnabled() { | 106 virtual bool sandboxEnabled() { |
103 return true; | 107 return true; |
104 } | 108 } |
105 | 109 |
106 virtual WebKit::WebKitClient::FileHandle databaseOpenFile( | 110 virtual WebKit::WebKitClient::FileHandle databaseOpenFile( |
107 const WebKit::WebString& file_name, int desired_flags, | 111 const WebKit::WebString& vfs_file_name, int desired_flags, |
108 WebKit::WebKitClient::FileHandle* dir_handle) { | 112 WebKit::WebKitClient::FileHandle* dir_handle) { |
109 return SimpleDatabaseSystem::GetInstance()->OpenFile( | 113 return SimpleDatabaseSystem::GetInstance()->OpenFile( |
110 webkit_glue::WebStringToFilePath(file_name), | 114 vfs_file_name, desired_flags, dir_handle); |
111 desired_flags, dir_handle); | |
112 } | 115 } |
113 | 116 |
114 virtual int databaseDeleteFile(const WebKit::WebString& file_name, | 117 virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, |
115 bool sync_dir) { | 118 bool sync_dir) { |
116 return SimpleDatabaseSystem::GetInstance()->DeleteFile( | 119 return SimpleDatabaseSystem::GetInstance()->DeleteFile( |
117 webkit_glue::WebStringToFilePath(file_name), sync_dir); | 120 vfs_file_name, sync_dir); |
118 } | 121 } |
119 | 122 |
120 virtual long databaseGetFileAttributes(const WebKit::WebString& file_name) { | 123 virtual long databaseGetFileAttributes( |
| 124 const WebKit::WebString& vfs_file_name) { |
121 return SimpleDatabaseSystem::GetInstance()->GetFileAttributes( | 125 return SimpleDatabaseSystem::GetInstance()->GetFileAttributes( |
122 webkit_glue::WebStringToFilePath(file_name)); | 126 vfs_file_name); |
123 } | 127 } |
124 | 128 |
125 virtual long long databaseGetFileSize(const WebKit::WebString& file_name) { | 129 virtual long long databaseGetFileSize( |
126 return SimpleDatabaseSystem::GetInstance()->GetFileSize( | 130 const WebKit::WebString& vfs_file_name) { |
127 webkit_glue::WebStringToFilePath(file_name)); | 131 return SimpleDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name); |
128 } | 132 } |
129 | 133 |
130 virtual bool getFileSize(const WebKit::WebString& path, long long& result) { | 134 virtual bool getFileSize(const WebKit::WebString& path, long long& result) { |
131 return file_util::GetFileSize( | 135 return file_util::GetFileSize( |
132 webkit_glue::WebStringToFilePath(path), | 136 webkit_glue::WebStringToFilePath(path), |
133 reinterpret_cast<int64*>(&result)); | 137 reinterpret_cast<int64*>(&result)); |
134 } | 138 } |
135 | 139 |
136 virtual unsigned long long visitedLinkHash(const char* canonicalURL, | 140 virtual unsigned long long visitedLinkHash(const char* canonicalURL, |
137 size_t length) { | 141 size_t length) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 SimpleAppCacheSystem appcache_system_; | 244 SimpleAppCacheSystem appcache_system_; |
241 SimpleDatabaseSystem database_system_; | 245 SimpleDatabaseSystem database_system_; |
242 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; | 246 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; |
243 | 247 |
244 #if defined(OS_WIN) | 248 #if defined(OS_WIN) |
245 WebKit::WebThemeEngine* active_theme_engine_; | 249 WebKit::WebThemeEngine* active_theme_engine_; |
246 #endif | 250 #endif |
247 }; | 251 }; |
248 | 252 |
249 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ | 253 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ |
OLD | NEW |