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 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 5 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
6 | 6 |
7 #include "base/metrics/stats_counters.h" | 7 #include "base/metrics/stats_counters.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "media/base/media.h" | 9 #include "media/base/media.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 WebKit::WebRuntimeFeatures::enableFileSystem(true); | 45 WebKit::WebRuntimeFeatures::enableFileSystem(true); |
46 | 46 |
47 // TODO(hwennborg): Enable this once the implementation supports it. | 47 // TODO(hwennborg): Enable this once the implementation supports it. |
48 WebKit::WebRuntimeFeatures::enableDeviceMotion(false); | 48 WebKit::WebRuntimeFeatures::enableDeviceMotion(false); |
49 WebKit::WebRuntimeFeatures::enableDeviceOrientation(true); | 49 WebKit::WebRuntimeFeatures::enableDeviceOrientation(true); |
50 | 50 |
51 // Enable experimental I18N API for testing. | 51 // Enable experimental I18N API for testing. |
52 WebKit::WebRuntimeFeatures::enableJavaScriptI18NAPI(true); | 52 WebKit::WebRuntimeFeatures::enableJavaScriptI18NAPI(true); |
53 | 53 |
54 // Load libraries for media and enable the media player. | 54 // Load libraries for media and enable the media player. |
55 FilePath module_path; | 55 base::FilePath module_path; |
56 WebKit::WebRuntimeFeatures::enableMediaPlayer( | 56 WebKit::WebRuntimeFeatures::enableMediaPlayer( |
57 PathService::Get(base::DIR_MODULE, &module_path) && | 57 PathService::Get(base::DIR_MODULE, &module_path) && |
58 media::InitializeMediaLibrary(module_path)); | 58 media::InitializeMediaLibrary(module_path)); |
59 | 59 |
60 WebKit::WebRuntimeFeatures::enableGeolocation(true); | 60 WebKit::WebRuntimeFeatures::enableGeolocation(true); |
61 | 61 |
62 // Construct and initialize an appcache system for this scope. | 62 // Construct and initialize an appcache system for this scope. |
63 // A new empty temp directory is created to house any cached | 63 // A new empty temp directory is created to house any cached |
64 // content during the run. Upon exit that directory is deleted. | 64 // content during the run. Upon exit that directory is deleted. |
65 // If we can't create a tempdir, we'll use in-memory storage. | 65 // If we can't create a tempdir, we'll use in-memory storage. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 attributes, false); | 270 attributes, false); |
271 } | 271 } |
272 | 272 |
273 void TestShellWebKitInit::GetPlugins( | 273 void TestShellWebKitInit::GetPlugins( |
274 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { | 274 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { |
275 if (refresh) | 275 if (refresh) |
276 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 276 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
277 webkit::npapi::PluginList::Singleton()->GetPlugins(plugins); | 277 webkit::npapi::PluginList::Singleton()->GetPlugins(plugins); |
278 // Don't load the forked TestNetscapePlugIn in the chromium code, use | 278 // Don't load the forked TestNetscapePlugIn in the chromium code, use |
279 // the copy in webkit.org's repository instead. | 279 // the copy in webkit.org's repository instead. |
280 const FilePath::StringType kPluginBlackList[] = { | 280 const base::FilePath::StringType kPluginBlackList[] = { |
281 FILE_PATH_LITERAL("npapi_layout_test_plugin.dll"), | 281 FILE_PATH_LITERAL("npapi_layout_test_plugin.dll"), |
282 FILE_PATH_LITERAL("WebKitTestNetscapePlugIn.plugin"), | 282 FILE_PATH_LITERAL("WebKitTestNetscapePlugIn.plugin"), |
283 FILE_PATH_LITERAL("libnpapi_layout_test_plugin.so"), | 283 FILE_PATH_LITERAL("libnpapi_layout_test_plugin.so"), |
284 }; | 284 }; |
285 for (int i = plugins->size() - 1; i >= 0; --i) { | 285 for (int i = plugins->size() - 1; i >= 0; --i) { |
286 webkit::WebPluginInfo plugin_info = plugins->at(i); | 286 webkit::WebPluginInfo plugin_info = plugins->at(i); |
287 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | 287 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { |
288 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | 288 if (plugin_info.path.BaseName() == base::FilePath(kPluginBlackList[j])) { |
289 plugins->erase(plugins->begin() + i); | 289 plugins->erase(plugins->begin() + i); |
290 } | 290 } |
291 } | 291 } |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 webkit_glue::ResourceLoaderBridge* | 295 webkit_glue::ResourceLoaderBridge* |
296 TestShellWebKitInit::CreateResourceLoader( | 296 TestShellWebKitInit::CreateResourceLoader( |
297 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 297 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
298 return SimpleResourceLoaderBridge::Create(request_info); | 298 return SimpleResourceLoaderBridge::Create(request_info); |
299 } | 299 } |
300 | 300 |
301 webkit_glue::WebSocketStreamHandleBridge* | 301 webkit_glue::WebSocketStreamHandleBridge* |
302 TestShellWebKitInit::CreateWebSocketBridge( | 302 TestShellWebKitInit::CreateWebSocketBridge( |
303 WebKit::WebSocketStreamHandle* handle, | 303 WebKit::WebSocketStreamHandle* handle, |
304 webkit_glue::WebSocketStreamHandleDelegate* delegate) { | 304 webkit_glue::WebSocketStreamHandleDelegate* delegate) { |
305 return SimpleSocketStreamBridge::Create(handle, delegate); | 305 return SimpleSocketStreamBridge::Create(handle, delegate); |
306 } | 306 } |
OLD | NEW |