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

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: Address Jochen's comments. Created 7 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 | 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 415
416 virtual void SetupTree() OVERRIDE { 416 virtual void SetupTree() OVERRIDE {
417 root_layer_ = Layer::Create(); 417 root_layer_ = Layer::Create();
418 root_layer_->SetBounds(gfx::Size(10, 20)); 418 root_layer_->SetBounds(gfx::Size(10, 20));
419 419
420 bool paint_scrollbar = true; 420 bool paint_scrollbar = true;
421 bool has_thumb = false; 421 bool has_thumb = false;
422 scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar, 422 scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar,
423 has_thumb, 423 has_thumb,
424 root_layer_->id()); 424 root_layer_->id(),
425 false);
425 scrollbar_->SetPosition(gfx::Point(0, 10)); 426 scrollbar_->SetPosition(gfx::Point(0, 10));
426 scrollbar_->SetBounds(gfx::Size(10, 10)); 427 scrollbar_->SetBounds(gfx::Size(10, 10));
427 428
428 root_layer_->AddChild(scrollbar_); 429 root_layer_->AddChild(scrollbar_);
429 430
430 layer_tree_host()->SetRootLayer(root_layer_); 431 layer_tree_host()->SetRootLayer(root_layer_);
431 LayerTreeHostTest::SetupTree(); 432 LayerTreeHostTest::SetupTree();
432 } 433 }
433 434
434 virtual void BeginTest() OVERRIDE { 435 virtual void BeginTest() OVERRIDE {
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // Linear fade animator prevents scrollbars from drawing immediately. 1139 // Linear fade animator prevents scrollbars from drawing immediately.
1139 settings->use_linear_fade_scrollbar_animator = false; 1140 settings->use_linear_fade_scrollbar_animator = false;
1140 } 1141 }
1141 1142
1142 virtual void SetupTree() OVERRIDE { 1143 virtual void SetupTree() OVERRIDE {
1143 layer_ = FakeContentLayer::Create(&client_); 1144 layer_ = FakeContentLayer::Create(&client_);
1144 layer_->SetBounds(gfx::Size(10, 20)); 1145 layer_->SetBounds(gfx::Size(10, 20));
1145 1146
1146 bool paint_scrollbar = true; 1147 bool paint_scrollbar = true;
1147 bool has_thumb = false; 1148 bool has_thumb = false;
1148 scrollbar_ = 1149 scrollbar_ = FakeScrollbarLayer::Create(
1149 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, layer_->id()); 1150 paint_scrollbar, has_thumb, layer_->id(), false);
1150 scrollbar_->SetPosition(gfx::Point(0, 10)); 1151 scrollbar_->SetPosition(gfx::Point(0, 10));
1151 scrollbar_->SetBounds(gfx::Size(10, 10)); 1152 scrollbar_->SetBounds(gfx::Size(10, 10));
1152 1153
1153 layer_->AddChild(scrollbar_); 1154 layer_->AddChild(scrollbar_);
1154 1155
1155 layer_tree_host()->SetRootLayer(layer_); 1156 layer_tree_host()->SetRootLayer(layer_);
1156 LayerTreeHostTest::SetupTree(); 1157 LayerTreeHostTest::SetupTree();
1157 } 1158 }
1158 1159
1159 virtual void BeginTest() OVERRIDE { 1160 virtual void BeginTest() OVERRIDE {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 virtual void SetupTree() OVERRIDE { 1270 virtual void SetupTree() OVERRIDE {
1270 parent_ = FakeContentLayer::Create(&client_); 1271 parent_ = FakeContentLayer::Create(&client_);
1271 parent_->SetBounds(gfx::Size(10, 20)); 1272 parent_->SetBounds(gfx::Size(10, 20));
1272 1273
1273 child_ = FakeContentLayer::Create(&client_); 1274 child_ = FakeContentLayer::Create(&client_);
1274 child_->SetPosition(gfx::Point(0, 10)); 1275 child_->SetPosition(gfx::Point(0, 10));
1275 child_->SetBounds(gfx::Size(3, 10)); 1276 child_->SetBounds(gfx::Size(3, 10));
1276 1277
1277 bool paint_scrollbar = true; 1278 bool paint_scrollbar = true;
1278 bool has_thumb = false; 1279 bool has_thumb = false;
1279 scrollbar_with_paints_ = 1280 scrollbar_with_paints_ = FakeScrollbarLayer::Create(
1280 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, parent_->id()); 1281 paint_scrollbar, has_thumb, parent_->id(), false);
1281 scrollbar_with_paints_->SetPosition(gfx::Point(3, 10)); 1282 scrollbar_with_paints_->SetPosition(gfx::Point(3, 10));
1282 scrollbar_with_paints_->SetBounds(gfx::Size(3, 10)); 1283 scrollbar_with_paints_->SetBounds(gfx::Size(3, 10));
1283 1284
1284 paint_scrollbar = false; 1285 paint_scrollbar = false;
1285 scrollbar_without_paints_ = 1286 scrollbar_without_paints_ = FakeScrollbarLayer::Create(
1286 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, parent_->id()); 1287 paint_scrollbar, has_thumb, parent_->id(), false);
1287 scrollbar_without_paints_->SetPosition(gfx::Point(6, 10)); 1288 scrollbar_without_paints_->SetPosition(gfx::Point(6, 10));
1288 scrollbar_without_paints_->SetBounds(gfx::Size(3, 10)); 1289 scrollbar_without_paints_->SetBounds(gfx::Size(3, 10));
1289 1290
1290 parent_->AddChild(child_); 1291 parent_->AddChild(child_);
1291 parent_->AddChild(scrollbar_with_paints_); 1292 parent_->AddChild(scrollbar_with_paints_);
1292 parent_->AddChild(scrollbar_without_paints_); 1293 parent_->AddChild(scrollbar_without_paints_);
1293 1294
1294 layer_tree_host()->SetRootLayer(parent_); 1295 layer_tree_host()->SetRootLayer(parent_);
1295 LayerTreeHostTest::SetupTree(); 1296 LayerTreeHostTest::SetupTree();
1296 } 1297 }
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 2881
2881 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) { 2882 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) {
2882 RunTest(true, false, true); 2883 RunTest(true, false, true);
2883 } 2884 }
2884 2885
2885 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { 2886 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
2886 public: 2887 public:
2887 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 2888 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2888 // PictureLayer can only be used with impl side painting enabled. 2889 // PictureLayer can only be used with impl side painting enabled.
2889 settings->impl_side_painting = true; 2890 settings->impl_side_painting = true;
2890 settings->solid_color_scrollbars = true; 2891 settings->force_solid_color_scrollbars = true;
2891 } 2892 }
2892 2893
2893 virtual void SetupTree() OVERRIDE { 2894 virtual void SetupTree() OVERRIDE {
2894 layer_ = FakePictureLayer::Create(&client_); 2895 layer_ = FakePictureLayer::Create(&client_);
2895 layer_tree_host()->SetRootLayer(layer_); 2896 layer_tree_host()->SetRootLayer(layer_);
2896 LayerTreeHostTest::SetupTree(); 2897 LayerTreeHostTest::SetupTree();
2897 } 2898 }
2898 2899
2899 virtual void BeginTest() OVERRIDE { 2900 virtual void BeginTest() OVERRIDE {
2900 initialized_gl_ = false; 2901 initialized_gl_ = false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 private: 2949 private:
2949 FakeContentLayerClient client_; 2950 FakeContentLayerClient client_;
2950 scoped_refptr<FakePictureLayer> layer_; 2951 scoped_refptr<FakePictureLayer> layer_;
2951 bool initialized_gl_; 2952 bool initialized_gl_;
2952 }; 2953 };
2953 2954
2954 MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize); 2955 MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize);
2955 2956
2956 } // namespace 2957 } // namespace
2957 } // namespace cc 2958 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698