OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/test_webkit_platform_support.h" | 5 #include "content/test/test_webkit_platform_support.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/test/spawned_test_server/spawned_test_server.h" | 21 #include "net/test/spawned_test_server/spawned_test_server.h" |
22 #include "third_party/WebKit/public/platform/WebData.h" | 22 #include "third_party/WebKit/public/platform/WebData.h" |
23 #include "third_party/WebKit/public/platform/WebFileSystem.h" | 23 #include "third_party/WebKit/public/platform/WebFileSystem.h" |
24 #include "third_party/WebKit/public/platform/WebStorageArea.h" | 24 #include "third_party/WebKit/public/platform/WebStorageArea.h" |
25 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" | 25 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" |
26 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
27 #include "third_party/WebKit/public/platform/WebURL.h" | 27 #include "third_party/WebKit/public/platform/WebURL.h" |
28 #include "third_party/WebKit/public/web/WebDatabase.h" | 28 #include "third_party/WebKit/public/web/WebDatabase.h" |
29 #include "third_party/WebKit/public/web/WebKit.h" | 29 #include "third_party/WebKit/public/web/WebKit.h" |
30 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 30 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
31 #include "third_party/WebKit/public/web/WebScriptController.h" | |
32 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 31 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
33 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" | 32 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" |
34 #include "v8/include/v8.h" | 33 #include "v8/include/v8.h" |
35 #include "webkit/browser/database/vfs_backend.h" | 34 #include "webkit/browser/database/vfs_backend.h" |
36 #include "webkit/child/webkitplatformsupport_impl.h" | 35 #include "webkit/child/webkitplatformsupport_impl.h" |
37 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" | 36 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" |
38 | 37 |
39 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
40 #include "base/mac/mac_util.h" | 39 #include "base/mac/mac_util.h" |
41 #endif | 40 #endif |
42 | 41 |
43 using blink::WebScriptController; | |
44 using webkit::WebLayerTreeViewImplForTesting; | 42 using webkit::WebLayerTreeViewImplForTesting; |
45 | 43 |
46 namespace content { | 44 namespace content { |
47 | 45 |
48 TestWebKitPlatformSupport::TestWebKitPlatformSupport() { | 46 TestWebKitPlatformSupport::TestWebKitPlatformSupport() { |
49 url_loader_factory_.reset(new WebURLLoaderMockFactory()); | 47 url_loader_factory_.reset(new WebURLLoaderMockFactory()); |
50 mock_clipboard_.reset(new MockWebClipboardImpl()); | 48 mock_clipboard_.reset(new MockWebClipboardImpl()); |
51 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); | 49 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); |
52 | 50 |
53 blink::initialize(this); | 51 blink::initialize(this); |
54 blink::setLayoutTestMode(true); | 52 blink::setLayoutTestMode(true); |
55 blink::WebSecurityPolicy::registerURLSchemeAsLocal( | 53 blink::WebSecurityPolicy::registerURLSchemeAsLocal( |
56 blink::WebString::fromUTF8("test-shell-resource")); | 54 blink::WebString::fromUTF8("test-shell-resource")); |
57 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( | 55 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( |
58 blink::WebString::fromUTF8("test-shell-resource")); | 56 blink::WebString::fromUTF8("test-shell-resource")); |
59 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( | 57 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( |
60 blink::WebString::fromUTF8("test-shell-resource")); | 58 blink::WebString::fromUTF8("test-shell-resource")); |
61 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( | 59 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( |
62 blink::WebString::fromUTF8("test-shell-resource")); | 60 blink::WebString::fromUTF8("test-shell-resource")); |
63 WebScriptController::enableV8SingleThreadMode(); | |
64 blink::WebRuntimeFeatures::enableApplicationCache(true); | 61 blink::WebRuntimeFeatures::enableApplicationCache(true); |
65 blink::WebRuntimeFeatures::enableDatabase(true); | 62 blink::WebRuntimeFeatures::enableDatabase(true); |
66 blink::WebRuntimeFeatures::enableNotifications(true); | 63 blink::WebRuntimeFeatures::enableNotifications(true); |
67 blink::WebRuntimeFeatures::enableTouch(true); | 64 blink::WebRuntimeFeatures::enableTouch(true); |
68 | 65 |
69 // Load libraries for media and enable the media player. | 66 // Load libraries for media and enable the media player. |
70 bool enable_media = false; | 67 bool enable_media = false; |
71 base::FilePath module_path; | 68 base::FilePath module_path; |
72 if (PathService::Get(base::DIR_MODULE, &module_path)) { | 69 if (PathService::Get(base::DIR_MODULE, &module_path)) { |
73 #if defined(OS_MACOSX) | 70 #if defined(OS_MACOSX) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 const blink::WebString& path) { | 308 const blink::WebString& path) { |
312 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); | 309 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); |
313 | 310 |
314 std::string buffer; | 311 std::string buffer; |
315 base::ReadFileToString(file_path, &buffer); | 312 base::ReadFileToString(file_path, &buffer); |
316 | 313 |
317 return blink::WebData(buffer.data(), buffer.size()); | 314 return blink::WebData(buffer.data(), buffer.size()); |
318 } | 315 } |
319 | 316 |
320 } // namespace content | 317 } // namespace content |
OLD | NEW |