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

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

Issue 314053002: Fix comparisons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: directly compare Point3F objects rather than the output of .ToString Created 6 years, 6 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 | « no previous file | 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/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 *run = true; 666 *run = true;
667 } 667 }
668 668
669 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { 669 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
670 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, 670 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED,
671 gfx::Rect(20, 20, 400, 400))); 671 gfx::Rect(20, 20, 400, 400)));
672 l1->SetFillsBoundsOpaquely(true); 672 l1->SetFillsBoundsOpaquely(true);
673 l1->SetForceRenderSurface(true); 673 l1->SetForceRenderSurface(true);
674 l1->SetVisible(false); 674 l1->SetVisible(false);
675 675
676 EXPECT_EQ(gfx::PointF().ToString(), 676 EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin());
677 l1->cc_layer()->transform_origin().ToString());
678 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 677 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
679 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 678 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
680 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 679 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
681 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 680 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
682 681
683 cc::Layer* before_layer = l1->cc_layer(); 682 cc::Layer* before_layer = l1->cc_layer();
684 683
685 bool callback1_run = false; 684 bool callback1_run = false;
686 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0); 685 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0);
687 l1->SetTextureMailbox(mailbox, 686 l1->SetTextureMailbox(mailbox,
688 cc::SingleReleaseCallback::Create( 687 cc::SingleReleaseCallback::Create(
689 base::Bind(ReturnMailbox, &callback1_run)), 688 base::Bind(ReturnMailbox, &callback1_run)),
690 gfx::Size(1, 1)); 689 gfx::Size(1, 1));
691 690
692 EXPECT_NE(before_layer, l1->cc_layer()); 691 EXPECT_NE(before_layer, l1->cc_layer());
693 692
694 EXPECT_EQ(gfx::PointF().ToString(), 693 EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin());
695 l1->cc_layer()->transform_origin().ToString());
696 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 694 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
697 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 695 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
698 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 696 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
699 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 697 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
700 EXPECT_FALSE(callback1_run); 698 EXPECT_FALSE(callback1_run);
701 699
702 bool callback2_run = false; 700 bool callback2_run = false;
703 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0); 701 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0);
704 l1->SetTextureMailbox(mailbox, 702 l1->SetTextureMailbox(mailbox,
705 cc::SingleReleaseCallback::Create( 703 cc::SingleReleaseCallback::Create(
706 base::Bind(ReturnMailbox, &callback2_run)), 704 base::Bind(ReturnMailbox, &callback2_run)),
707 gfx::Size(1, 1)); 705 gfx::Size(1, 1));
708 EXPECT_TRUE(callback1_run); 706 EXPECT_TRUE(callback1_run);
709 EXPECT_FALSE(callback2_run); 707 EXPECT_FALSE(callback2_run);
710 708
711 l1->SetShowPaintedContent(); 709 l1->SetShowPaintedContent();
712 EXPECT_EQ(gfx::PointF().ToString(), 710 EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin());
713 l1->cc_layer()->transform_origin().ToString());
714 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 711 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
715 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 712 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
716 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 713 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
717 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 714 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
718 EXPECT_TRUE(callback2_run); 715 EXPECT_TRUE(callback2_run);
719 } 716 }
720 717
721 // Various visibile/drawn assertions. 718 // Various visibile/drawn assertions.
722 TEST_F(LayerWithNullDelegateTest, Visibility) { 719 TEST_F(LayerWithNullDelegateTest, Visibility) {
723 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED)); 720 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 1548
1552 child->SetAnimator(LayerAnimator::CreateImplicitAnimator()); 1549 child->SetAnimator(LayerAnimator::CreateImplicitAnimator());
1553 child->SetOpacity(0.5f); 1550 child->SetOpacity(0.5f);
1554 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators()); 1551 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
1555 1552
1556 child.reset(); 1553 child.reset();
1557 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators()); 1554 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators());
1558 } 1555 }
1559 1556
1560 } // namespace ui 1557 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698