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

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

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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') | webkit/compositor_bindings/web_content_layer_impl.cc » ('j') | 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/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 NullLayerDelegate delegate; 635 NullLayerDelegate delegate;
636 l1->set_delegate(&delegate); 636 l1->set_delegate(&delegate);
637 l2->set_delegate(&delegate); 637 l2->set_delegate(&delegate);
638 l3->set_delegate(&delegate); 638 l3->set_delegate(&delegate);
639 639
640 // Layers should initially be drawn. 640 // Layers should initially be drawn.
641 EXPECT_TRUE(l1->IsDrawn()); 641 EXPECT_TRUE(l1->IsDrawn());
642 EXPECT_TRUE(l2->IsDrawn()); 642 EXPECT_TRUE(l2->IsDrawn());
643 EXPECT_TRUE(l3->IsDrawn()); 643 EXPECT_TRUE(l3->IsDrawn());
644 EXPECT_TRUE(l1->cc_layer()->drawsContent()); 644 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
645 EXPECT_TRUE(l2->cc_layer()->drawsContent()); 645 EXPECT_TRUE(l2->cc_layer()->DrawsContent());
646 EXPECT_TRUE(l3->cc_layer()->drawsContent()); 646 EXPECT_TRUE(l3->cc_layer()->DrawsContent());
647 647
648 compositor()->SetRootLayer(l1.get()); 648 compositor()->SetRootLayer(l1.get());
649 649
650 Draw(); 650 Draw();
651 651
652 l1->SetVisible(false); 652 l1->SetVisible(false);
653 EXPECT_FALSE(l1->IsDrawn()); 653 EXPECT_FALSE(l1->IsDrawn());
654 EXPECT_FALSE(l2->IsDrawn()); 654 EXPECT_FALSE(l2->IsDrawn());
655 EXPECT_FALSE(l3->IsDrawn()); 655 EXPECT_FALSE(l3->IsDrawn());
656 EXPECT_FALSE(l1->cc_layer()->drawsContent()); 656 EXPECT_FALSE(l1->cc_layer()->DrawsContent());
657 EXPECT_FALSE(l2->cc_layer()->drawsContent()); 657 EXPECT_FALSE(l2->cc_layer()->DrawsContent());
658 EXPECT_FALSE(l3->cc_layer()->drawsContent()); 658 EXPECT_FALSE(l3->cc_layer()->DrawsContent());
659 659
660 l3->SetVisible(false); 660 l3->SetVisible(false);
661 EXPECT_FALSE(l1->IsDrawn()); 661 EXPECT_FALSE(l1->IsDrawn());
662 EXPECT_FALSE(l2->IsDrawn()); 662 EXPECT_FALSE(l2->IsDrawn());
663 EXPECT_FALSE(l3->IsDrawn()); 663 EXPECT_FALSE(l3->IsDrawn());
664 EXPECT_FALSE(l1->cc_layer()->drawsContent()); 664 EXPECT_FALSE(l1->cc_layer()->DrawsContent());
665 EXPECT_FALSE(l2->cc_layer()->drawsContent()); 665 EXPECT_FALSE(l2->cc_layer()->DrawsContent());
666 EXPECT_FALSE(l3->cc_layer()->drawsContent()); 666 EXPECT_FALSE(l3->cc_layer()->DrawsContent());
667 667
668 l1->SetVisible(true); 668 l1->SetVisible(true);
669 EXPECT_TRUE(l1->IsDrawn()); 669 EXPECT_TRUE(l1->IsDrawn());
670 EXPECT_TRUE(l2->IsDrawn()); 670 EXPECT_TRUE(l2->IsDrawn());
671 EXPECT_FALSE(l3->IsDrawn()); 671 EXPECT_FALSE(l3->IsDrawn());
672 EXPECT_TRUE(l1->cc_layer()->drawsContent()); 672 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
673 EXPECT_TRUE(l2->cc_layer()->drawsContent()); 673 EXPECT_TRUE(l2->cc_layer()->DrawsContent());
674 EXPECT_FALSE(l3->cc_layer()->drawsContent()); 674 EXPECT_FALSE(l3->cc_layer()->DrawsContent());
675 } 675 }
676 676
677 // Checks that stacking-related methods behave as advertised. 677 // Checks that stacking-related methods behave as advertised.
678 TEST_F(LayerWithNullDelegateTest, Stacking) { 678 TEST_F(LayerWithNullDelegateTest, Stacking) {
679 scoped_ptr<Layer> root(new Layer(LAYER_NOT_DRAWN)); 679 scoped_ptr<Layer> root(new Layer(LAYER_NOT_DRAWN));
680 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED)); 680 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
681 scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED)); 681 scoped_ptr<Layer> l2(new Layer(LAYER_TEXTURED));
682 scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED)); 682 scoped_ptr<Layer> l3(new Layer(LAYER_TEXTURED));
683 l1->set_name("1"); 683 l1->set_name("1");
684 l2->set_name("2"); 684 l2->set_name("2");
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 // Ensure that adding a layer to an existing tree causes its pending 1352 // Ensure that adding a layer to an existing tree causes its pending
1353 // animations to get dispatched. 1353 // animations to get dispatched.
1354 l2->SetOpacity(0.5f); 1354 l2->SetOpacity(0.5f);
1355 EXPECT_TRUE(l2->HasPendingThreadedAnimations()); 1355 EXPECT_TRUE(l2->HasPendingThreadedAnimations());
1356 1356
1357 l1->Add(l2.get()); 1357 l1->Add(l2.get());
1358 EXPECT_FALSE(l2->HasPendingThreadedAnimations()); 1358 EXPECT_FALSE(l2->HasPendingThreadedAnimations());
1359 } 1359 }
1360 1360
1361 } // namespace ui 1361 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | webkit/compositor_bindings/web_content_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698