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

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

Issue 1588093004: Compute if a layer is drawn without LayerTree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return; 631 return;
632 } 632 }
633 633
634 SetAfterValues(layer_tree_host()->root_layer()); 634 SetAfterValues(layer_tree_host()->root_layer());
635 } 635 }
636 636
637 void AfterTest() override {} 637 void AfterTest() override {}
638 638
639 void VerifyBeforeValues(Layer* layer) { 639 void VerifyBeforeValues(Layer* layer) {
640 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); 640 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString());
641 EXPECT_FALSE(layer->hide_layer_and_subtree()); 641 EXPECT_NE(layer->opacity(), 0.f);
642 EXPECT_FALSE(layer->DrawsContent()); 642 EXPECT_FALSE(layer->DrawsContent());
643 } 643 }
644 644
645 void SetBeforeValues(Layer* layer) { 645 void SetBeforeValues(Layer* layer) {
646 layer->SetBounds(gfx::Size(10, 10)); 646 layer->SetBounds(gfx::Size(10, 10));
647 layer->SetHideLayerAndSubtree(false); 647 layer->SetOpacity(1.f);
648 layer->SetIsDrawable(false); 648 layer->SetIsDrawable(false);
649 } 649 }
650 650
651 void VerifyAfterValues(LayerImpl* layer) { 651 void VerifyAfterValues(LayerImpl* layer) {
652 switch (static_cast<Properties>(index_)) { 652 switch (static_cast<Properties>(index_)) {
653 case STARTUP: 653 case STARTUP:
654 case DONE: 654 case DONE:
655 break; 655 break;
656 case BOUNDS: 656 case BOUNDS:
657 EXPECT_EQ(gfx::Size(20, 20).ToString(), layer->bounds().ToString()); 657 EXPECT_EQ(gfx::Size(20, 20).ToString(), layer->bounds().ToString());
658 break; 658 break;
659 case HIDE_LAYER_AND_SUBTREE: 659 case HIDE_LAYER_AND_SUBTREE:
660 EXPECT_TRUE(layer->hide_layer_and_subtree()); 660 EXPECT_EQ(layer->opacity(), 0.f);
661 break; 661 break;
662 case DRAWS_CONTENT: 662 case DRAWS_CONTENT:
663 EXPECT_TRUE(layer->DrawsContent()); 663 EXPECT_TRUE(layer->DrawsContent());
664 break; 664 break;
665 } 665 }
666 } 666 }
667 667
668 void SetAfterValues(Layer* layer) { 668 void SetAfterValues(Layer* layer) {
669 switch (static_cast<Properties>(index_)) { 669 switch (static_cast<Properties>(index_)) {
670 case STARTUP: 670 case STARTUP:
671 case DONE: 671 case DONE:
672 break; 672 break;
673 case BOUNDS: 673 case BOUNDS:
674 layer->SetBounds(gfx::Size(20, 20)); 674 layer->SetBounds(gfx::Size(20, 20));
675 break; 675 break;
676 case HIDE_LAYER_AND_SUBTREE: 676 case HIDE_LAYER_AND_SUBTREE:
677 layer->SetHideLayerAndSubtree(true); 677 // Set opacity to 0 to hide subtree.
678 layer->SetOpacity(0.f);
678 break; 679 break;
679 case DRAWS_CONTENT: 680 case DRAWS_CONTENT:
680 layer->SetIsDrawable(true); 681 layer->SetIsDrawable(true);
681 break; 682 break;
682 } 683 }
683 } 684 }
684 685
685 int index_; 686 int index_;
686 }; 687 };
687 688
(...skipping 5904 matching lines...) Expand 10 before | Expand all | Expand 10 after
6592 EndTest(); 6593 EndTest();
6593 } 6594 }
6594 6595
6595 void AfterTest() override {} 6596 void AfterTest() override {}
6596 }; 6597 };
6597 6598
6598 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6599 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6599 6600
6600 } // namespace 6601 } // namespace
6601 } // namespace cc 6602 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698