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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 2829853009: cc : Add DCHECKs to ensure we have valid proprety tree indices at commit (Closed)
Patch Set: Created 3 years, 8 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); 379 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
380 scrollbar_layer->SetBounds(gfx::Size(70, 10)); 380 scrollbar_layer->SetBounds(gfx::Size(70, 10));
381 scrollbar_layer->SetScrollElementId(root_layer->element_id()); 381 scrollbar_layer->SetScrollElementId(root_layer->element_id());
382 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); 382 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10));
383 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); 383 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10));
384 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); 384 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
385 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); 385 scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
386 LayerImpl* root_clip_layer_impl = nullptr; 386 LayerImpl* root_clip_layer_impl = nullptr;
387 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; 387 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
388 388
389 layer_tree_host_->BuildPropertyTreesForTesting();
389 UPDATE_AND_EXTRACT_LAYER_POINTERS(); 390 UPDATE_AND_EXTRACT_LAYER_POINTERS();
390 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), 391 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
391 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); 392 scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
392 393
393 scrollbar_layer->fake_scrollbar()->set_has_thumb(false); 394 scrollbar_layer->fake_scrollbar()->set_has_thumb(false);
394 395
395 UPDATE_AND_EXTRACT_LAYER_POINTERS(); 396 UPDATE_AND_EXTRACT_LAYER_POINTERS();
396 EXPECT_EQ(gfx::Rect(10, 0, 0, 0).ToString(), 397 EXPECT_EQ(gfx::Rect(10, 0, 0, 0).ToString(),
397 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); 398 scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
398 } 399 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 scroll_layer->SetBounds(gfx::Size(10, 10)); 747 scroll_layer->SetBounds(gfx::Size(10, 10));
747 layer_tree_host_->UpdateLayers(); 748 layer_tree_host_->UpdateLayers();
748 layer_tree_host_->CommitAndCreateLayerImplTree(); 749 layer_tree_host_->CommitAndCreateLayerImplTree();
749 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl(); 750 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl();
750 EXPECT_TRUE(host_impl->ScrollbarAnimationControllerForElementId( 751 EXPECT_TRUE(host_impl->ScrollbarAnimationControllerForElementId(
751 scroll_layer->element_id())); 752 scroll_layer->element_id()));
752 753
753 scroll_layer->SetBounds(gfx::Size(20, 20)); 754 scroll_layer->SetBounds(gfx::Size(20, 20));
754 scroll_layer->SetForceRenderSurfaceForTesting(true); 755 scroll_layer->SetForceRenderSurfaceForTesting(true);
755 layer_tree_host_->UpdateLayers(); 756 layer_tree_host_->UpdateLayers();
756 host_impl->CreatePendingTree(); 757 layer_tree_host_->CommitAndCreateLayerImplTree();
757 layer_tree_host_->CommitAndCreatePendingTree();
758 host_impl->ActivateSyncTree();
759 EffectNode* node = 758 EffectNode* node =
760 host_impl->active_tree()->property_trees()->effect_tree.Node( 759 host_impl->active_tree()->property_trees()->effect_tree.Node(
761 scrollbar_layer->effect_tree_index()); 760 scrollbar_layer->effect_tree_index());
762 EXPECT_EQ(node->opacity, 1.f); 761 EXPECT_EQ(node->opacity, 1.f);
763 } 762 }
764 763
765 class ScrollbarLayerSolidColorThumbTest : public testing::Test { 764 class ScrollbarLayerSolidColorThumbTest : public testing::Test {
766 public: 765 public:
767 ScrollbarLayerSolidColorThumbTest() { 766 ScrollbarLayerSolidColorThumbTest() {
768 LayerTreeSettings layer_tree_settings; 767 LayerTreeSettings layer_tree_settings;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1238 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1240 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1239 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1241 1240
1242 // Horizontal Scrollbars. 1241 // Horizontal Scrollbars.
1243 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1242 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1244 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1243 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1245 } 1244 }
1246 1245
1247 } // namespace 1246 } // namespace
1248 } // namespace cc 1247 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698