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_blink_web_unit_test_support.h" | 5 #include "content/test/test_blink_web_unit_test_support.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 15 #include "cc/blink/web_layer_impl.h" |
| 16 #include "cc/layers/layer_settings.h" |
| 17 #include "cc/trees/layer_tree_settings.h" |
15 #include "components/scheduler/renderer/renderer_scheduler_impl.h" | 18 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
16 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 19 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
17 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" | 20 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" |
18 #include "content/test/mock_webclipboard_impl.h" | 21 #include "content/test/mock_webclipboard_impl.h" |
19 #include "content/test/web_gesture_curve_mock.h" | 22 #include "content/test/web_gesture_curve_mock.h" |
20 #include "content/test/web_layer_tree_view_impl_for_testing.h" | 23 #include "content/test/web_layer_tree_view_impl_for_testing.h" |
21 #include "content/test/weburl_loader_mock_factory.h" | 24 #include "content/test/weburl_loader_mock_factory.h" |
22 #include "media/base/media.h" | 25 #include "media/base/media.h" |
23 #include "net/cookies/cookie_monster.h" | 26 #include "net/cookies/cookie_monster.h" |
24 #include "storage/browser/database/vfs_backend.h" | 27 #include "storage/browser/database/vfs_backend.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 scheduler::LazySchedulerMessageLoopDelegateForTests::Create())); | 115 scheduler::LazySchedulerMessageLoopDelegateForTests::Create())); |
113 web_thread_ = renderer_scheduler_->CreateMainThread(); | 116 web_thread_ = renderer_scheduler_->CreateMainThread(); |
114 | 117 |
115 blink::initialize(this); | 118 blink::initialize(this); |
116 blink::setLayoutTestMode(true); | 119 blink::setLayoutTestMode(true); |
117 blink::WebRuntimeFeatures::enableApplicationCache(true); | 120 blink::WebRuntimeFeatures::enableApplicationCache(true); |
118 blink::WebRuntimeFeatures::enableDatabase(true); | 121 blink::WebRuntimeFeatures::enableDatabase(true); |
119 blink::WebRuntimeFeatures::enableNotifications(true); | 122 blink::WebRuntimeFeatures::enableNotifications(true); |
120 blink::WebRuntimeFeatures::enableTouch(true); | 123 blink::WebRuntimeFeatures::enableTouch(true); |
121 | 124 |
| 125 // External cc::AnimationHost is enabled for unit tests. |
| 126 cc::LayerSettings layer_settings; |
| 127 layer_settings.use_compositor_animation_timelines = true; |
| 128 cc_blink::WebLayerImpl::SetLayerSettings(layer_settings); |
| 129 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); |
| 130 |
122 // Initialize libraries for media and enable the media player. | 131 // Initialize libraries for media and enable the media player. |
123 media::InitializeMediaLibrary(); | 132 media::InitializeMediaLibrary(); |
124 blink::WebRuntimeFeatures::enableMediaPlayer(true); | 133 blink::WebRuntimeFeatures::enableMediaPlayer(true); |
125 | 134 |
126 file_utilities_.set_sandbox_enabled(false); | 135 file_utilities_.set_sandbox_enabled(false); |
127 | 136 |
128 if (!file_system_root_.CreateUniqueTempDir()) { | 137 if (!file_system_root_.CreateUniqueTempDir()) { |
129 LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 138 LOG(WARNING) << "Failed to create a temp dir for the filesystem." |
130 "FileSystem feature will be disabled."; | 139 "FileSystem feature will be disabled."; |
131 DCHECK(file_system_root_.path().empty()); | 140 DCHECK(file_system_root_.path().empty()); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 base::MessageLoop::current()->QuitWhenIdle(); | 378 base::MessageLoop::current()->QuitWhenIdle(); |
370 } | 379 } |
371 | 380 |
372 void TestBlinkWebUnitTestSupport::getPluginList( | 381 void TestBlinkWebUnitTestSupport::getPluginList( |
373 bool refresh, blink::WebPluginListBuilder* builder) { | 382 bool refresh, blink::WebPluginListBuilder* builder) { |
374 builder->addPlugin("pdf", "pdf", "pdf-files"); | 383 builder->addPlugin("pdf", "pdf", "pdf-files"); |
375 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 384 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
376 } | 385 } |
377 | 386 |
378 } // namespace content | 387 } // namespace content |
OLD | NEW |