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

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

Issue 17550008: Make IsSolidColor() a property on CC scrollbar layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use DCHECK(layer_tree_host()) instead. Created 7 years, 6 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
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 322
323 virtual void SetupTree() OVERRIDE { 323 virtual void SetupTree() OVERRIDE {
324 root_layer_ = Layer::Create(); 324 root_layer_ = Layer::Create();
325 root_layer_->SetBounds(gfx::Size(10, 20)); 325 root_layer_->SetBounds(gfx::Size(10, 20));
326 326
327 bool paint_scrollbar = true; 327 bool paint_scrollbar = true;
328 bool has_thumb = false; 328 bool has_thumb = false;
329 scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar, 329 scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar,
330 has_thumb, 330 has_thumb,
331 root_layer_->id()); 331 root_layer_->id(),
332 false);
332 scrollbar_->SetPosition(gfx::Point(0, 10)); 333 scrollbar_->SetPosition(gfx::Point(0, 10));
333 scrollbar_->SetBounds(gfx::Size(10, 10)); 334 scrollbar_->SetBounds(gfx::Size(10, 10));
334 335
335 root_layer_->AddChild(scrollbar_); 336 root_layer_->AddChild(scrollbar_);
336 337
337 layer_tree_host()->SetRootLayer(root_layer_); 338 layer_tree_host()->SetRootLayer(root_layer_);
338 LayerTreeHostTest::SetupTree(); 339 LayerTreeHostTest::SetupTree();
339 } 340 }
340 341
341 virtual void BeginTest() OVERRIDE { 342 virtual void BeginTest() OVERRIDE {
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 // Linear fade animator prevents scrollbars from drawing immediately. 1047 // Linear fade animator prevents scrollbars from drawing immediately.
1047 settings->use_linear_fade_scrollbar_animator = false; 1048 settings->use_linear_fade_scrollbar_animator = false;
1048 } 1049 }
1049 1050
1050 virtual void SetupTree() OVERRIDE { 1051 virtual void SetupTree() OVERRIDE {
1051 layer_ = FakeContentLayer::Create(&client_); 1052 layer_ = FakeContentLayer::Create(&client_);
1052 layer_->SetBounds(gfx::Size(10, 20)); 1053 layer_->SetBounds(gfx::Size(10, 20));
1053 1054
1054 bool paint_scrollbar = true; 1055 bool paint_scrollbar = true;
1055 bool has_thumb = false; 1056 bool has_thumb = false;
1056 scrollbar_ = 1057 scrollbar_ = FakeScrollbarLayer::Create(
1057 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, layer_->id()); 1058 paint_scrollbar, has_thumb, layer_->id(), false);
1058 scrollbar_->SetPosition(gfx::Point(0, 10)); 1059 scrollbar_->SetPosition(gfx::Point(0, 10));
1059 scrollbar_->SetBounds(gfx::Size(10, 10)); 1060 scrollbar_->SetBounds(gfx::Size(10, 10));
1060 1061
1061 layer_->AddChild(scrollbar_); 1062 layer_->AddChild(scrollbar_);
1062 1063
1063 layer_tree_host()->SetRootLayer(layer_); 1064 layer_tree_host()->SetRootLayer(layer_);
1064 LayerTreeHostTest::SetupTree(); 1065 LayerTreeHostTest::SetupTree();
1065 } 1066 }
1066 1067
1067 virtual void BeginTest() OVERRIDE { 1068 virtual void BeginTest() OVERRIDE {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 virtual void SetupTree() OVERRIDE { 1178 virtual void SetupTree() OVERRIDE {
1178 parent_ = FakeContentLayer::Create(&client_); 1179 parent_ = FakeContentLayer::Create(&client_);
1179 parent_->SetBounds(gfx::Size(10, 20)); 1180 parent_->SetBounds(gfx::Size(10, 20));
1180 1181
1181 child_ = FakeContentLayer::Create(&client_); 1182 child_ = FakeContentLayer::Create(&client_);
1182 child_->SetPosition(gfx::Point(0, 10)); 1183 child_->SetPosition(gfx::Point(0, 10));
1183 child_->SetBounds(gfx::Size(3, 10)); 1184 child_->SetBounds(gfx::Size(3, 10));
1184 1185
1185 bool paint_scrollbar = true; 1186 bool paint_scrollbar = true;
1186 bool has_thumb = false; 1187 bool has_thumb = false;
1187 scrollbar_with_paints_ = 1188 scrollbar_with_paints_ = FakeScrollbarLayer::Create(
1188 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, parent_->id()); 1189 paint_scrollbar, has_thumb, parent_->id(), false);
1189 scrollbar_with_paints_->SetPosition(gfx::Point(3, 10)); 1190 scrollbar_with_paints_->SetPosition(gfx::Point(3, 10));
1190 scrollbar_with_paints_->SetBounds(gfx::Size(3, 10)); 1191 scrollbar_with_paints_->SetBounds(gfx::Size(3, 10));
1191 1192
1192 paint_scrollbar = false; 1193 paint_scrollbar = false;
1193 scrollbar_without_paints_ = 1194 scrollbar_without_paints_ = FakeScrollbarLayer::Create(
1194 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, parent_->id()); 1195 paint_scrollbar, has_thumb, parent_->id(), false);
1195 scrollbar_without_paints_->SetPosition(gfx::Point(6, 10)); 1196 scrollbar_without_paints_->SetPosition(gfx::Point(6, 10));
1196 scrollbar_without_paints_->SetBounds(gfx::Size(3, 10)); 1197 scrollbar_without_paints_->SetBounds(gfx::Size(3, 10));
1197 1198
1198 parent_->AddChild(child_); 1199 parent_->AddChild(child_);
1199 parent_->AddChild(scrollbar_with_paints_); 1200 parent_->AddChild(scrollbar_with_paints_);
1200 parent_->AddChild(scrollbar_without_paints_); 1201 parent_->AddChild(scrollbar_without_paints_);
1201 1202
1202 layer_tree_host()->SetRootLayer(parent_); 1203 layer_tree_host()->SetRootLayer(parent_);
1203 LayerTreeHostTest::SetupTree(); 1204 LayerTreeHostTest::SetupTree();
1204 } 1205 }
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 2791
2791 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) { 2792 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) {
2792 RunTest(true, false, true); 2793 RunTest(true, false, true);
2793 } 2794 }
2794 2795
2795 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { 2796 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
2796 public: 2797 public:
2797 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 2798 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2798 // PictureLayer can only be used with impl side painting enabled. 2799 // PictureLayer can only be used with impl side painting enabled.
2799 settings->impl_side_painting = true; 2800 settings->impl_side_painting = true;
2800 settings->solid_color_scrollbars = true; 2801 settings->force_solid_color_scrollbars = true;
2801 } 2802 }
2802 2803
2803 virtual void SetupTree() OVERRIDE { 2804 virtual void SetupTree() OVERRIDE {
2804 layer_ = FakePictureLayer::Create(&client_); 2805 layer_ = FakePictureLayer::Create(&client_);
2805 layer_tree_host()->SetRootLayer(layer_); 2806 layer_tree_host()->SetRootLayer(layer_);
2806 LayerTreeHostTest::SetupTree(); 2807 LayerTreeHostTest::SetupTree();
2807 } 2808 }
2808 2809
2809 virtual void BeginTest() OVERRIDE { 2810 virtual void BeginTest() OVERRIDE {
2810 initialized_gl_ = false; 2811 initialized_gl_ = false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 private: 2859 private:
2859 FakeContentLayerClient client_; 2860 FakeContentLayerClient client_;
2860 scoped_refptr<FakePictureLayer> layer_; 2861 scoped_refptr<FakePictureLayer> layer_;
2861 bool initialized_gl_; 2862 bool initialized_gl_;
2862 }; 2863 };
2863 2864
2864 MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize); 2865 MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize);
2865 2866
2866 } // namespace 2867 } // namespace
2867 } // namespace cc 2868 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698