| 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/web_layer_tree_view_impl_for_testing.h" | 5 #include "content/test/web_layer_tree_view_impl_for_testing.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "cc/animation/animation_host.h" | 11 #include "cc/animation/animation_host.h" |
| 12 #include "cc/animation/animation_timeline.h" | 12 #include "cc/animation/animation_timeline.h" |
| 13 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
| 14 #include "cc/blink/web_compositor_animation_timeline_impl.h" | 14 #include "cc/blink/web_compositor_animation_timeline_impl.h" |
| 15 #include "cc/blink/web_layer_impl.h" | 15 #include "cc/blink/web_layer_impl.h" |
| 16 #include "cc/input/input_handler.h" | 16 #include "cc/input/input_handler.h" |
| 17 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
| 18 #include "cc/scheduler/begin_frame_source.h" | 18 #include "cc/scheduler/begin_frame_source.h" |
| 19 #include "cc/trees/layer_tree_host.h" | 19 #include "cc/trees/layer_tree_host.h" |
| 20 #include "content/test/test_blink_web_unit_test_support.h" | 20 #include "content/test/test_blink_web_unit_test_support.h" |
| 21 #include "third_party/WebKit/public/platform/Platform.h" | 21 #include "third_party/WebKit/public/platform/Platform.h" |
| 22 #include "third_party/WebKit/public/platform/WebLayer.h" | 22 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 23 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 23 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
| 24 #include "third_party/WebKit/public/platform/WebSize.h" | 24 #include "third_party/WebKit/public/platform/WebSize.h" |
| 25 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 25 | 26 |
| 26 using blink::WebColor; | 27 using blink::WebColor; |
| 27 using blink::WebRect; | 28 using blink::WebRect; |
| 28 using blink::WebSize; | 29 using blink::WebSize; |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} | 33 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} |
| 33 | 34 |
| 34 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 35 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
| 35 | 36 |
| 36 void WebLayerTreeViewImplForTesting::Initialize() { | 37 void WebLayerTreeViewImplForTesting::Initialize() { |
| 37 cc::LayerTreeSettings settings; | 38 cc::LayerTreeSettings settings; |
| 38 | 39 |
| 39 // For web contents, layer transforms should scale up the contents of layers | 40 // For web contents, layer transforms should scale up the contents of layers |
| 40 // to keep content always crisp when possible. | 41 // to keep content always crisp when possible. |
| 41 settings.layer_transforms_should_scale_layer_contents = true; | 42 settings.layer_transforms_should_scale_layer_contents = true; |
| 42 | 43 |
| 43 // Accelerated animations are enabled for unit tests. | 44 // Accelerated animations are enabled for unit tests. |
| 44 settings.accelerated_animation_enabled = true; | 45 settings.accelerated_animation_enabled = true; |
| 46 // External cc::AnimationHost is enabled for unit tests. |
| 47 settings.use_compositor_animation_timelines = true; |
| 48 |
| 45 cc::LayerTreeHost::InitParams params; | 49 cc::LayerTreeHost::InitParams params; |
| 46 params.client = this; | 50 params.client = this; |
| 47 params.settings = &settings; | 51 params.settings = &settings; |
| 48 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 52 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 49 params.task_graph_runner = &task_graph_runner_; | 53 params.task_graph_runner = &task_graph_runner_; |
| 50 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); | 54 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
| 51 DCHECK(layer_tree_host_); | 55 DCHECK(layer_tree_host_); |
| 52 } | 56 } |
| 53 | 57 |
| 54 void WebLayerTreeViewImplForTesting::setRootLayer( | 58 void WebLayerTreeViewImplForTesting::setRootLayer( |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 194 } |
| 191 | 195 |
| 192 void WebLayerTreeViewImplForTesting::registerSelection( | 196 void WebLayerTreeViewImplForTesting::registerSelection( |
| 193 const blink::WebSelection& selection) { | 197 const blink::WebSelection& selection) { |
| 194 } | 198 } |
| 195 | 199 |
| 196 void WebLayerTreeViewImplForTesting::clearSelection() { | 200 void WebLayerTreeViewImplForTesting::clearSelection() { |
| 197 } | 201 } |
| 198 | 202 |
| 199 } // namespace content | 203 } // namespace content |
| OLD | NEW |