Chromium Code Reviews| Index: ash/wm/window_state_unittest.cc |
| diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc |
| index d816cf7d11ba78e0f66a6fd659b7367f98e785fa..cbb6ab5855a18491e24607adc79beaa64b1ec1cb 100644 |
| --- a/ash/wm/window_state_unittest.cc |
| +++ b/ash/wm/window_state_unittest.cc |
| @@ -12,6 +12,7 @@ |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/test/test_window_delegate.h" |
| #include "ui/aura/window.h" |
| +#include "ui/views/widget/widget.h" |
| namespace ash { |
| namespace wm { |
| @@ -337,5 +338,32 @@ TEST_F(WindowStateTest, RestoredWindowBoundsShrink) { |
| // TODO(skuhne): Add more unit test to verify the correctness for the restore |
| // operation. |
| +// Tests for correct ownership of window sublayers during crossfade transitions. |
| +TEST_F(WindowStateTest, RecreateLayersDuringCrossfade) { |
|
sky
2015/11/30 16:52:09
This test is ok, but you're relying on maximize re
tapted
2015/12/01 04:34:43
I did this in Patchset 4, but it made the connecti
|
| + views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
| + nullptr, CurrentContext(), gfx::Rect(100, 100, 100, 100)); |
| + |
| + views::View* view = new views::View; |
| + view->SetBounds(20, 20, 20, 20); |
| + widget->GetContentsView()->AddChildView(view); |
| + widget->Show(); |
| + |
| + EXPECT_EQ(0u, widget->GetRootLayers().size()); |
| + view->SetPaintToLayer(true); |
| + EXPECT_EQ(1u, widget->GetRootLayers().size()); |
| + ui::Layer* old_layer = widget->GetRootLayers()[0]; |
| + |
| + // On Ash, Maximize will trigger WindowState::SetBoundsDirectCrossFade() to |
| + // start a crossfade animation after invoking ::wm::RecreateLayers(). |
| + widget->Maximize(); |
| + |
| + EXPECT_EQ(1u, widget->GetRootLayers().size()); |
| + |
| + // The layer should be different, since the old layer is in the crossfade. |
| + EXPECT_NE(old_layer, widget->GetRootLayers()[0]); |
| + |
| + widget->CloseNow(); |
| +} |
| + |
| } // namespace wm |
| } // namespace ash |