| Index: views/view_unittest.cc
|
| diff --git a/views/view_unittest.cc b/views/view_unittest.cc
|
| index 55a20f0142c643d308722bbd8481947b8242d4e8..a9f78590798a0cd408187f0310368661110f099a 100644
|
| --- a/views/view_unittest.cc
|
| +++ b/views/view_unittest.cc
|
| @@ -15,6 +15,7 @@
|
| #include "ui/gfx/canvas_skia.h"
|
| #include "ui/gfx/compositor/compositor.h"
|
| #include "ui/gfx/compositor/layer.h"
|
| +#include "ui/gfx/compositor/layer_animator.h"
|
| #include "ui/gfx/compositor/test_compositor.h"
|
| #include "ui/gfx/compositor/test_texture.h"
|
| #include "ui/gfx/path.h"
|
| @@ -28,7 +29,6 @@
|
| #include "views/events/event.h"
|
| #include "views/focus/accelerator_handler.h"
|
| #include "views/focus/view_storage.h"
|
| -#include "views/layer_property_setter.h"
|
| #include "views/test/views_test_base.h"
|
| #include "views/touchui/gesture_manager.h"
|
| #include "views/view.h"
|
| @@ -2444,44 +2444,27 @@ TEST_F(ViewTest, GetViewByID) {
|
|
|
| namespace {
|
|
|
| -// Test implementation of LayerPropertySetter;
|
| -class TestLayerPropertySetter : public LayerPropertySetter {
|
| +// Test implementation of LayerAnimator.
|
| +class TestLayerAnimator : public ui::LayerAnimator {
|
| public:
|
| - TestLayerPropertySetter();
|
| + TestLayerAnimator();
|
|
|
| - bool installed() const { return installed_; }
|
| const gfx::Rect& last_bounds() const { return last_bounds_; }
|
|
|
| - // LayerPropertySetter:
|
| - virtual void Installed(ui::Layer* layer) OVERRIDE;
|
| - virtual void Uninstalled(ui::Layer* layer) OVERRIDE;
|
| - virtual void SetTransform(ui::Layer* layer,
|
| - const ui::Transform& transform) OVERRIDE;
|
| - virtual void SetBounds(ui::Layer* layer, const gfx::Rect& bounds) OVERRIDE;
|
| + // LayerAnimator.
|
| + virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
|
|
|
| private:
|
| - bool installed_;
|
| gfx::Rect last_bounds_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TestLayerPropertySetter);
|
| + DISALLOW_COPY_AND_ASSIGN(TestLayerAnimator);
|
| };
|
|
|
| -TestLayerPropertySetter::TestLayerPropertySetter() : installed_(false) {}
|
| -
|
| -void TestLayerPropertySetter::Installed(ui::Layer* layer) {
|
| - installed_ = true;
|
| -}
|
| -
|
| -void TestLayerPropertySetter::Uninstalled(ui::Layer* layer) {
|
| - installed_ = false;
|
| -}
|
| -
|
| -void TestLayerPropertySetter::SetTransform(ui::Layer* layer,
|
| - const ui::Transform& transform) {
|
| +TestLayerAnimator::TestLayerAnimator()
|
| + : ui::LayerAnimator(base::TimeDelta::FromMilliseconds(0)) {
|
| }
|
|
|
| -void TestLayerPropertySetter::SetBounds(ui::Layer* layer,
|
| - const gfx::Rect& bounds) {
|
| +void TestLayerAnimator::SetBounds(const gfx::Rect& bounds) {
|
| last_bounds_ = bounds;
|
| }
|
|
|
| @@ -2676,28 +2659,22 @@ TEST_F(ViewLayerTest, NestedLayerToggling) {
|
| EXPECT_EQ(v1->layer(), v3->layer()->parent());
|
| }
|
|
|
| -TEST_F(ViewLayerTest, LayerPropertySetter) {
|
| +TEST_F(ViewLayerTest, LayerAnimator) {
|
| View* content_view = new View;
|
| widget()->SetContentsView(content_view);
|
|
|
| View* v1 = new View;
|
| content_view->AddChildView(v1);
|
| v1->SetPaintToLayer(true);
|
| - TestLayerPropertySetter* setter = new TestLayerPropertySetter;
|
| - v1->SetLayerPropertySetter(setter);
|
| - EXPECT_TRUE(setter->installed());
|
| -
|
| - // Turn off the layer, which should trigger uninstall.
|
| - v1->SetPaintToLayer(false);
|
| - EXPECT_FALSE(setter->installed());
|
| + EXPECT_TRUE(v1->layer() != NULL);
|
|
|
| - v1->SetPaintToLayer(true);
|
| - EXPECT_TRUE(setter->installed());
|
| + TestLayerAnimator* animator = new TestLayerAnimator();
|
| + v1->layer()->SetAnimator(animator);
|
|
|
| gfx::Rect bounds(1, 2, 3, 4);
|
| v1->SetBoundsRect(bounds);
|
| - EXPECT_EQ(bounds, setter->last_bounds());
|
| - // TestLayerPropertySetter doesn't update the layer.
|
| + EXPECT_EQ(bounds, animator->last_bounds());
|
| + // TestLayerAnimator doesn't update the layer.
|
| EXPECT_NE(bounds, v1->layer()->bounds());
|
| }
|
|
|
|
|