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

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

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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 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 "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // so that those tasks will happen before the first commit. 729 // so that those tasks will happen before the first commit.
730 if (layer_tree_host_) { 730 if (layer_tree_host_) {
731 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get()) 731 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get())
732 ->set_test_started(true); 732 ->set_test_started(true);
733 } 733 }
734 } 734 }
735 735
736 void LayerTreeTest::SetupTree() { 736 void LayerTreeTest::SetupTree() {
737 if (!layer_tree_host_->root_layer()) { 737 if (!layer_tree_host_->root_layer()) {
738 scoped_refptr<Layer> root_layer = Layer::Create(); 738 scoped_refptr<Layer> root_layer = Layer::Create();
739 root_layer->SetElementId(NextTestElementId());
739 root_layer->SetBounds(gfx::Size(1, 1)); 740 root_layer->SetBounds(gfx::Size(1, 1));
740 layer_tree_host_->SetRootLayer(root_layer); 741 layer_tree_host_->SetRootLayer(root_layer);
741 } 742 }
742 743
743 gfx::Size root_bounds = layer_tree_host_->root_layer()->bounds(); 744 gfx::Size root_bounds = layer_tree_host_->root_layer()->bounds();
744 gfx::Size device_root_bounds = gfx::ScaleToCeiledSize( 745 gfx::Size device_root_bounds = gfx::ScaleToCeiledSize(
745 root_bounds, layer_tree_host_->device_scale_factor()); 746 root_bounds, layer_tree_host_->device_scale_factor());
746 layer_tree_host_->SetViewportSize(device_root_bounds); 747 layer_tree_host_->SetViewportSize(device_root_bounds);
747 layer_tree_host_->root_layer()->SetIsDrawable(true); 748 layer_tree_host_->root_layer()->SetIsDrawable(true);
748 } 749 }
749 750
750 void LayerTreeTest::Timeout() { 751 void LayerTreeTest::Timeout() {
751 timed_out_ = true; 752 timed_out_ = true;
752 EndTest(); 753 EndTest();
753 } 754 }
754 755
756 scoped_refptr<Layer> LayerTreeTest::CreateTestLayer() {
757 auto layer = Layer::Create();
758 layer->SetElementId(NextTestElementId());
759 return layer;
760 }
761
755 void LayerTreeTest::RealEndTest() { 762 void LayerTreeTest::RealEndTest() {
756 // TODO(mithro): Make this method only end when not inside an impl frame. 763 // TODO(mithro): Make this method only end when not inside an impl frame.
757 bool main_frame_will_happen; 764 bool main_frame_will_happen;
758 if (IsRemoteTest()) { 765 if (IsRemoteTest()) {
759 main_frame_will_happen = 766 main_frame_will_happen =
760 remote_client_layer_tree_host_ 767 remote_client_layer_tree_host_
761 ? remote_client_proxy()->MainFrameWillHappenForTesting() 768 ? remote_client_proxy()->MainFrameWillHappenForTesting()
762 : false; 769 : false;
763 } else { 770 } else {
764 main_frame_will_happen = 771 main_frame_will_happen =
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1035
1029 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { 1036 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const {
1030 DCHECK(IsRemoteTest()); 1037 DCHECK(IsRemoteTest());
1031 DCHECK(remote_client_layer_tree_host_); 1038 DCHECK(remote_client_layer_tree_host_);
1032 1039
1033 return static_cast<RemoteChannelImplForTest*>( 1040 return static_cast<RemoteChannelImplForTest*>(
1034 remote_client_layer_tree_host_->proxy()); 1041 remote_client_layer_tree_host_->proxy());
1035 } 1042 }
1036 1043
1037 } // namespace cc 1044 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698