Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: cc/test/fake_layer_tree_host_impl.cc

Issue 444053004: cc: Prevent unit tests from using Now() as the impl frame time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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 "cc/test/fake_layer_tree_host_impl.h" 5 #include "cc/test/fake_layer_tree_host_impl.h"
6 #include "cc/test/test_shared_bitmap_manager.h" 6 #include "cc/test/test_shared_bitmap_manager.h"
7 #include "cc/trees/layer_tree_impl.h" 7 #include "cc/trees/layer_tree_impl.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy, 11 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
12 SharedBitmapManager* manager) 12 SharedBitmapManager* manager)
13 : LayerTreeHostImpl(LayerTreeSettings(), 13 : LayerTreeHostImpl(LayerTreeSettings(),
14 &client_, 14 &client_,
15 proxy, 15 proxy,
16 &stats_instrumentation_, 16 &stats_instrumentation_,
17 manager, 17 manager,
18 0) { 18 0) {
19 // Explicitly clear all debug settings. 19 // Explicitly clear all debug settings.
20 SetDebugState(LayerTreeDebugState()); 20 SetDebugState(LayerTreeDebugState());
21 SetViewportSize(gfx::Size(100, 100)); 21 SetViewportSize(gfx::Size(100, 100));
22
23 // Avoid using Now() as the frame time in unit tests.
enne (OOO) 2014/08/06 23:49:38 Random thought: is this something we could/should
danakj 2014/08/07 03:36:11 Well. Its not the tests doing Now() explicitly. It
24 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
25 SetCurrentFrameTimeTicks(time_ticks);
22 } 26 }
23 27
24 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings, 28 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
25 Proxy* proxy, 29 Proxy* proxy,
26 SharedBitmapManager* manager) 30 SharedBitmapManager* manager)
27 : LayerTreeHostImpl(settings, 31 : LayerTreeHostImpl(settings,
28 &client_, 32 &client_,
29 proxy, 33 proxy,
30 &stats_instrumentation_, 34 &stats_instrumentation_,
31 manager, 35 manager,
32 0) { 36 0) {
33 // Explicitly clear all debug settings. 37 // Explicitly clear all debug settings.
34 SetDebugState(LayerTreeDebugState()); 38 SetDebugState(LayerTreeDebugState());
39
40 // Avoid using Now() as the frame time in unit tests.
41 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
42 SetCurrentFrameTimeTicks(time_ticks);
35 } 43 }
36 44
37 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {} 45 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
38 46
39 void FakeLayerTreeHostImpl::CreatePendingTree() { 47 void FakeLayerTreeHostImpl::CreatePendingTree() {
40 LayerTreeHostImpl::CreatePendingTree(); 48 LayerTreeHostImpl::CreatePendingTree();
41 float arbitrary_large_page_scale = 100000.f; 49 float arbitrary_large_page_scale = 100000.f;
42 pending_tree()->SetPageScaleFactorAndLimits( 50 pending_tree()->SetPageScaleFactorAndLimits(
43 1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale); 51 1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
44 } 52 }
45 53
46 base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() { 54 base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() {
47 if (current_frame_time_ticks_.is_null()) 55 if (current_frame_time_ticks_.is_null())
48 return LayerTreeHostImpl::CurrentFrameTimeTicks(); 56 return LayerTreeHostImpl::CurrentFrameTimeTicks();
49 return current_frame_time_ticks_; 57 return current_frame_time_ticks_;
50 } 58 }
51 59
52 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks( 60 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
53 base::TimeTicks current_frame_time_ticks) { 61 base::TimeTicks current_frame_time_ticks) {
54 current_frame_time_ticks_ = current_frame_time_ticks; 62 current_frame_time_ticks_ = current_frame_time_ticks;
55 } 63 }
56 64
57 } // namespace cc 65 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698