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.
5 #include "ui/compositor/layer_owner.h"
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"
14 TEST(LayerOwnerTest
, RecreateLayerHonorsTargetVisibilityAndOpacity
) {
16 Layer
* layer
= new Layer
;
17 layer
->SetVisible(true);
18 layer
->SetOpacity(1.0f
);
20 owner
.SetLayer(layer
);
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());
28 scoped_ptr
<Layer
> old_layer(owner
.RecreateLayer());
29 EXPECT_FALSE(owner
.layer()->visible());
30 EXPECT_EQ(0.0f
, owner
.layer()->opacity());