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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/skia_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DCHECK(CalledOnValidThread()); 84 DCHECK(CalledOnValidThread());
85 is_ready_ = true; 85 is_ready_ = true;
86 } 86 }
87 87
88 bool is_ready() const { 88 bool is_ready() const {
89 return is_ready_; 89 return is_ready_;
90 } 90 }
91 91
92 void TestOnBeginFrame() { 92 void TestOnBeginFrame() {
93 DCHECK(CalledOnValidThread()); 93 DCHECK(CalledOnValidThread());
94 CallOnBeginFrame(CreateBeginFrameArgsForTesting()); 94 CallOnBeginFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
95 } 95 }
96 96
97 private: 97 private:
98 double milliseconds_per_frame_; 98 double milliseconds_per_frame_;
99 bool is_ready_; 99 bool is_ready_;
100 base::WeakPtrFactory<ExternalBeginFrameSourceForTest> weak_ptr_factory_; 100 base::WeakPtrFactory<ExternalBeginFrameSourceForTest> weak_ptr_factory_;
101 }; 101 };
102 102
103 // Adapts ThreadProxy for test. Injects test hooks for testing. 103 // Adapts ThreadProxy for test. Injects test hooks for testing.
104 class ThreadProxyForTest : public ThreadProxy { 104 class ThreadProxyForTest : public ThreadProxy {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void ScheduledActionCommit() override { 146 void ScheduledActionCommit() override {
147 ThreadProxy::ScheduledActionCommit(); 147 ThreadProxy::ScheduledActionCommit();
148 test_hooks_->ScheduledActionCommit(); 148 test_hooks_->ScheduledActionCommit();
149 } 149 }
150 150
151 void ScheduledActionBeginOutputSurfaceCreation() override { 151 void ScheduledActionBeginOutputSurfaceCreation() override {
152 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); 152 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation();
153 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); 153 test_hooks_->ScheduledActionBeginOutputSurfaceCreation();
154 } 154 }
155 155
156 void ScheduledActionManageTiles() override {
157 ThreadProxy::ScheduledActionManageTiles();
158 test_hooks_->ScheduledActionManageTiles();
159 }
160
156 ThreadProxyForTest( 161 ThreadProxyForTest(
157 TestHooks* test_hooks, 162 TestHooks* test_hooks,
158 LayerTreeHost* host, 163 LayerTreeHost* host,
159 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 164 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
160 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 165 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
161 scoped_ptr<BeginFrameSource> external_begin_frame_source) 166 scoped_ptr<BeginFrameSource> external_begin_frame_source)
162 : ThreadProxy(host, main_task_runner, 167 : ThreadProxy(host, main_task_runner,
163 impl_task_runner, 168 impl_task_runner,
164 external_begin_frame_source.Pass()), 169 external_begin_frame_source.Pass()),
165 test_hooks_(test_hooks) {} 170 test_hooks_(test_hooks) {}
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 FAIL() << "Test timed out"; 778 FAIL() << "Test timed out";
774 return; 779 return;
775 } 780 }
776 AfterTest(); 781 AfterTest();
777 } 782 }
778 783
779 void LayerTreeTest::RunTestWithImplSidePainting() { 784 void LayerTreeTest::RunTestWithImplSidePainting() {
780 RunTest(true, false, true); 785 RunTest(true, false, true);
781 } 786 }
782 787
788 void LayerTreeTest::RunTestWithMainThreadLowLatency() {
789 settings_.main_thread_should_always_be_low_latency = true;
790 RunTest(false, false, false);
791 }
792
783 void LayerTreeTest::RequestNewOutputSurface(bool fallback) { 793 void LayerTreeTest::RequestNewOutputSurface(bool fallback) {
784 layer_tree_host_->SetOutputSurface(CreateOutputSurface(fallback)); 794 layer_tree_host_->SetOutputSurface(CreateOutputSurface(fallback));
785 } 795 }
786 796
787 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { 797 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) {
788 scoped_ptr<FakeOutputSurface> output_surface = 798 scoped_ptr<FakeOutputSurface> output_surface =
789 CreateFakeOutputSurface(fallback); 799 CreateFakeOutputSurface(fallback);
790 if (output_surface) { 800 if (output_surface) {
791 DCHECK_EQ(delegating_renderer_, 801 DCHECK_EQ(delegating_renderer_,
792 output_surface->capabilities().delegated_rendering); 802 output_surface->capabilities().delegated_rendering);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 return -1; 834 return -1;
825 } 835 }
826 836
827 void LayerTreeTest::DestroyLayerTreeHost() { 837 void LayerTreeTest::DestroyLayerTreeHost() {
828 if (layer_tree_host_ && layer_tree_host_->root_layer()) 838 if (layer_tree_host_ && layer_tree_host_->root_layer())
829 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 839 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
830 layer_tree_host_ = nullptr; 840 layer_tree_host_ = nullptr;
831 } 841 }
832 842
833 } // namespace cc 843 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/skia_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698