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

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use friend class for test code, or we need hundreds of SetSomethingForTest functions in future refa… Created 4 years, 5 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
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 void BeginTest() override { 995 void BeginTest() override {
996 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( 996 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
997 initial_scroll_); 997 initial_scroll_);
998 PostSetNeedsCommitToMainThread(); 998 PostSetNeedsCommitToMainThread();
999 } 999 }
1000 1000
1001 void WillCommit() override { 1001 void WillCommit() override {
1002 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); 1002 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
1003 switch (layer_tree_host()->source_frame_number()) { 1003 switch (layer_tree_host()->source_frame_number()) {
1004 case 0: 1004 case 0:
1005 EXPECT_TRUE( 1005 EXPECT_TRUE(scroll_layer->layer_tree_host()
1006 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( 1006 ->GetLayerTree()
1007 scroll_layer)); 1007 ->LayerNeedsPushPropertiesForTesting(scroll_layer));
1008 break; 1008 break;
1009 case 1: 1009 case 1:
1010 // Even if this layer doesn't need push properties, it should 1010 // Even if this layer doesn't need push properties, it should
1011 // still pick up scrolls that happen on the active layer during 1011 // still pick up scrolls that happen on the active layer during
1012 // commit. 1012 // commit.
1013 EXPECT_FALSE( 1013 EXPECT_FALSE(scroll_layer->layer_tree_host()
1014 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( 1014 ->GetLayerTree()
1015 scroll_layer)); 1015 ->LayerNeedsPushPropertiesForTesting(scroll_layer));
1016 break; 1016 break;
1017 } 1017 }
1018 } 1018 }
1019 1019
1020 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { 1020 void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
1021 // Scroll after the 2nd commit has started. 1021 // Scroll after the 2nd commit has started.
1022 if (impl->active_tree()->source_frame_number() == 0) { 1022 if (impl->active_tree()->source_frame_number() == 0) {
1023 LayerImpl* active_root = impl->active_tree()->root_layer_for_testing(); 1023 LayerImpl* active_root = impl->active_tree()->root_layer_for_testing();
1024 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); 1024 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer();
1025 ASSERT_TRUE(active_root); 1025 ASSERT_TRUE(active_root);
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 int num_impl_commits_; 1851 int num_impl_commits_;
1852 int num_aborted_commits_; 1852 int num_aborted_commits_;
1853 int num_impl_scrolls_; 1853 int num_impl_scrolls_;
1854 int num_draws_; 1854 int num_draws_;
1855 }; 1855 };
1856 1856
1857 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); 1857 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA);
1858 1858
1859 } // namespace 1859 } // namespace
1860 } // namespace cc 1860 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698