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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 16896017: Add a hide_layer_and_subtree() flag to cc::Layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hide-subtree-flag: SetIsDrawable on the new cc_layer 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
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 NullLayerDelegate delegate; 640 NullLayerDelegate delegate;
641 l1->set_delegate(&delegate); 641 l1->set_delegate(&delegate);
642 l2->set_delegate(&delegate); 642 l2->set_delegate(&delegate);
643 l3->set_delegate(&delegate); 643 l3->set_delegate(&delegate);
644 644
645 // Layers should initially be drawn. 645 // Layers should initially be drawn.
646 EXPECT_TRUE(l1->IsDrawn()); 646 EXPECT_TRUE(l1->IsDrawn());
647 EXPECT_TRUE(l2->IsDrawn()); 647 EXPECT_TRUE(l2->IsDrawn());
648 EXPECT_TRUE(l3->IsDrawn()); 648 EXPECT_TRUE(l3->IsDrawn());
649 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 649 EXPECT_FALSE(l1->cc_layer()->hide_layer_and_subtree());
650 EXPECT_TRUE(l2->cc_layer()->DrawsContent()); 650 EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree());
651 EXPECT_TRUE(l3->cc_layer()->DrawsContent()); 651 EXPECT_FALSE(l3->cc_layer()->hide_layer_and_subtree());
652 652
653 compositor()->SetRootLayer(l1.get()); 653 compositor()->SetRootLayer(l1.get());
654 654
655 Draw(); 655 Draw();
656 656
657 l1->SetVisible(false); 657 l1->SetVisible(false);
658 EXPECT_FALSE(l1->IsDrawn()); 658 EXPECT_FALSE(l1->IsDrawn());
659 EXPECT_FALSE(l2->IsDrawn()); 659 EXPECT_FALSE(l2->IsDrawn());
660 EXPECT_FALSE(l3->IsDrawn()); 660 EXPECT_FALSE(l3->IsDrawn());
661 EXPECT_FALSE(l1->cc_layer()->DrawsContent()); 661 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
662 EXPECT_FALSE(l2->cc_layer()->DrawsContent()); 662 EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree());
663 EXPECT_FALSE(l3->cc_layer()->DrawsContent()); 663 EXPECT_FALSE(l3->cc_layer()->hide_layer_and_subtree());
664 664
665 l3->SetVisible(false); 665 l3->SetVisible(false);
666 EXPECT_FALSE(l1->IsDrawn()); 666 EXPECT_FALSE(l1->IsDrawn());
667 EXPECT_FALSE(l2->IsDrawn()); 667 EXPECT_FALSE(l2->IsDrawn());
668 EXPECT_FALSE(l3->IsDrawn()); 668 EXPECT_FALSE(l3->IsDrawn());
669 EXPECT_FALSE(l1->cc_layer()->DrawsContent()); 669 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
670 EXPECT_FALSE(l2->cc_layer()->DrawsContent()); 670 EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree());
671 EXPECT_FALSE(l3->cc_layer()->DrawsContent()); 671 EXPECT_TRUE(l3->cc_layer()->hide_layer_and_subtree());
672 672
673 l1->SetVisible(true); 673 l1->SetVisible(true);
674 EXPECT_TRUE(l1->IsDrawn()); 674 EXPECT_TRUE(l1->IsDrawn());
675 EXPECT_TRUE(l2->IsDrawn()); 675 EXPECT_TRUE(l2->IsDrawn());
676 EXPECT_FALSE(l3->IsDrawn()); 676 EXPECT_FALSE(l3->IsDrawn());
677 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 677 EXPECT_FALSE(l1->cc_layer()->hide_layer_and_subtree());
678 EXPECT_TRUE(l2->cc_layer()->DrawsContent()); 678 EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree());
679 EXPECT_FALSE(l3->cc_layer()->DrawsContent()); 679 EXPECT_TRUE(l3->cc_layer()->hide_layer_and_subtree());
680 } 680 }
681 681
682 // Checks that stacking-related methods behave as advertised. 682 // Checks that stacking-related methods behave as advertised.
683 TEST_F(LayerWithNullDelegateTest, Stacking) { 683 TEST_F(LayerWithNullDelegateTest, Stacking) {
684 scoped_ptr<Layer> root(new Layer(LAYER_NOT_DRAWN)); 684 scoped_ptr<Layer> root(new Layer(LAYER_NOT_DRAWN));
685 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED)); 685 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
686 scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED)); 686 scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED));
687 scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED)); 687 scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED));
688 l1->set_name("1"); 688 l1->set_name("1");
689 l2->set_name("2"); 689 l2->set_name("2");
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 l1->SetOpacity(0.5f); 1375 l1->SetOpacity(0.5f);
1376 1376
1377 // Change l1's cc::Layer. 1377 // Change l1's cc::Layer.
1378 l1->SwitchCCLayerForTest(); 1378 l1->SwitchCCLayerForTest();
1379 1379
1380 // Ensure that the opacity animation completed. 1380 // Ensure that the opacity animation completed.
1381 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); 1381 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
1382 } 1382 }
1383 1383
1384 } // namespace ui 1384 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698