1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/compositor/layer_owner.h" 6 7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer_animator.h" 10 #include "ui/compositor/scoped_layer_animation_settings.h" 11 12 namespace ui { 13 TEST(LayerOwnerTest,RecreateLayerHonorsTargetVisibilityAndOpacity)14TEST(LayerOwnerTest, RecreateLayerHonorsTargetVisibilityAndOpacity) { 15 LayerOwner owner; 16 Layer* layer = new Layer; 17 layer->SetVisible(true); 18 layer->SetOpacity(1.0f); 19 20 owner.SetLayer(layer); 21 22 ScopedLayerAnimationSettings settings(layer->GetAnimator()); 23 layer->SetVisible(false); 24 layer->SetOpacity(0.0f); 25 EXPECT_TRUE(layer->visible()); 26 EXPECT_EQ(1.0f, layer->opacity()); 27 28 scoped_ptr<Layer> old_layer(owner.RecreateLayer()); 29 EXPECT_FALSE(owner.layer()->visible()); 30 EXPECT_EQ(0.0f, owner.layer()->opacity()); 31 } 32 33 } // namespace ui 34