Index: ui/aura/window_unittest.cc |
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc |
index 320d1a61f7b052bc61c95eaa2ebe159bf019f1af..fa4c66a65e0da4b740722524e0e87fccab5fd80b 100644 |
--- a/ui/aura/window_unittest.cc |
+++ b/ui/aura/window_unittest.cc |
@@ -1531,6 +1531,33 @@ TEST_F(WindowTest, Visibility) { |
EXPECT_EQ(1, d2.shown()); |
} |
+// Verifies that IsVisible will immediately return the state set by the last |
+// call to SetVisible even if the window is animating visiblility. |
+TEST_F(WindowTest, IsVisibleRespectsSetVisible) { |
+ // We cannot short-circuit animations in this test. |
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
+ |
+ scoped_ptr<Window> w1( |
+ CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), root_window())); |
+ EXPECT_FALSE(!w1->layer()); |
sky
2013/09/13 21:46:44
ASSERT (otherwise you're going to crash on 1547).
flackr
2013/09/13 22:28:38
Done.
|
+ |
+ // Start an animation to hide the window. |
+ { |
+ ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); |
+ w1->layer()->SetVisible(false); |
+ } |
+ |
+ // Window is still visible, but is animating to be hidden. |
+ EXPECT_TRUE(w1->IsVisible()); |
+ EXPECT_FALSE(w1->layer()->GetTargetVisibility()); |
+ |
+ // Now, explicitly hide the window and verify that IsVisible corresponds to |
+ // the hidden state. |
+ w1->Hide(); |
+ EXPECT_FALSE(w1->IsVisible()); |
+} |
+ |
TEST_F(WindowTest, IgnoreEventsTest) { |
TestWindowDelegate d11; |
TestWindowDelegate d12; |