8c39d2e9ce7e93bb09ed21a7b75f70565a16a84e
[platform/framework/web/crosswalk.git] / src / cc / test / fake_layer_tree_host_impl.cc
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/test/fake_layer_tree_host_impl.h"
6 #include "cc/trees/layer_tree_impl.h"
7
8 namespace cc {
9
10 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
11     : LayerTreeHostImpl(LayerTreeSettings(),
12                         &client_,
13                         proxy,
14                         &stats_instrumentation_,
15                         NULL,
16                         0) {
17   // Explicitly clear all debug settings.
18   SetDebugState(LayerTreeDebugState());
19   SetViewportSize(gfx::Size(100, 100));
20 }
21
22 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
23                                              Proxy* proxy)
24     : LayerTreeHostImpl(settings,
25                         &client_,
26                         proxy,
27                         &stats_instrumentation_,
28                         NULL,
29                         0) {
30   // Explicitly clear all debug settings.
31   SetDebugState(LayerTreeDebugState());
32 }
33
34 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
35
36 void FakeLayerTreeHostImpl::CreatePendingTree() {
37   LayerTreeHostImpl::CreatePendingTree();
38   float arbitrary_large_page_scale = 100000.f;
39   pending_tree()->SetPageScaleFactorAndLimits(
40       1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
41 }
42
43 base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() {
44   if (current_frame_time_ticks_.is_null())
45     return LayerTreeHostImpl::CurrentFrameTimeTicks();
46   return current_frame_time_ticks_;
47 }
48
49 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
50     base::TimeTicks current_frame_time_ticks) {
51   current_frame_time_ticks_ = current_frame_time_ticks;
52 }
53
54 }  // namespace cc