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

Side by Side Diff: cc/layer_unittest.cc

Issue 12648005: cc: Chromify the LayerTreeHostImpl class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/layer.h" 5 #include "cc/layer.h"
6 6
7 #include "cc/keyframed_animation_curve.h" 7 #include "cc/keyframed_animation_curve.h"
8 #include "cc/layer_impl.h" 8 #include "cc/layer_impl.h"
9 #include "cc/layer_painter.h" 9 #include "cc/layer_painter.h"
10 #include "cc/layer_tree_host.h" 10 #include "cc/layer_tree_host.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 EXPECT_FALSE(testLayer->NeedsDisplayForTesting()); 588 EXPECT_FALSE(testLayer->NeedsDisplayForTesting());
589 589
590 // Calling setBounds only invalidates on the first time. 590 // Calling setBounds only invalidates on the first time.
591 EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetBounds(gfx::Size(7, 10))); 591 EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetBounds(gfx::Size(7, 10)));
592 EXPECT_FALSE(testLayer->NeedsDisplayForTesting()); 592 EXPECT_FALSE(testLayer->NeedsDisplayForTesting());
593 } 593 }
594 594
595 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) 595 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
596 { 596 {
597 scoped_refptr<Layer> testLayer = Layer::Create(); 597 scoped_refptr<Layer> testLayer = Layer::Create();
598 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1); 598 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree() , 1);
599 599
600 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5))); 600 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)));
601 testLayer->PushPropertiesTo(implLayer.get()); 601 testLayer->PushPropertiesTo(implLayer.get());
602 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer- >update_rect()); 602 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer- >update_rect());
603 603
604 // The LayerImpl's updateRect should be accumulated here, since we did not d o anything to clear it. 604 // The LayerImpl's updateRect should be accumulated here, since we did not d o anything to clear it.
605 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5))); 605 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
606 testLayer->PushPropertiesTo(implLayer.get()); 606 testLayer->PushPropertiesTo(implLayer.get());
607 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLaye r->update_rect()); 607 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLaye r->update_rect());
608 608
609 // If we do clear the LayerImpl side, then the next updateRect should be fre sh without accumulation. 609 // If we do clear the LayerImpl side, then the next updateRect should be fre sh without accumulation.
610 implLayer->ResetAllChangeTrackingForSubtree(); 610 implLayer->ResetAllChangeTrackingForSubtree();
611 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5))); 611 testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
612 testLayer->PushPropertiesTo(implLayer.get()); 612 testLayer->PushPropertiesTo(implLayer.get());
613 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), impl Layer->update_rect()); 613 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), impl Layer->update_rect());
614 } 614 }
615 615
616 TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForTransform) 616 TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForTransform)
617 { 617 {
618 scoped_refptr<Layer> testLayer = Layer::Create(); 618 scoped_refptr<Layer> testLayer = Layer::Create();
619 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1); 619 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree() , 1);
620 620
621 gfx::Transform transform; 621 gfx::Transform transform;
622 transform.Rotate(45.0); 622 transform.Rotate(45.0);
623 testLayer->SetTransform(transform); 623 testLayer->SetTransform(transform);
624 624
625 EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged()); 625 EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
626 626
627 testLayer->PushPropertiesTo(implLayer.get()); 627 testLayer->PushPropertiesTo(implLayer.get());
628 628
629 EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged()); 629 EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged());
630 } 630 }
631 631
632 TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity) 632 TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity)
633 { 633 {
634 scoped_refptr<Layer> testLayer = Layer::Create(); 634 scoped_refptr<Layer> testLayer = Layer::Create();
635 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1); 635 scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree() , 1);
636 636
637 testLayer->SetOpacity(0.5); 637 testLayer->SetOpacity(0.5);
638 638
639 EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged()); 639 EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
640 640
641 testLayer->PushPropertiesTo(implLayer.get()); 641 testLayer->PushPropertiesTo(implLayer.get());
642 642
643 EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged()); 643 EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged());
644 } 644 }
645 645
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 layer->SetLayerTreeHost(layerTreeHost.get()); 911 layer->SetLayerTreeHost(layerTreeHost.get());
912 assertLayerTreeHostMatchesForSubtree(layer.get(), layerTreeHost.get()); 912 assertLayerTreeHostMatchesForSubtree(layer.get(), layerTreeHost.get());
913 913
914 // Case 3: with a LayerTreeHost where accelerated animation is disabled, the 914 // Case 3: with a LayerTreeHost where accelerated animation is disabled, the
915 // animation should be rejected. 915 // animation should be rejected.
916 EXPECT_FALSE(addTestAnimation(layer.get())); 916 EXPECT_FALSE(addTestAnimation(layer.get()));
917 } 917 }
918 918
919 } // namespace 919 } // namespace
920 } // namespace cc 920 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698