Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5621)

Unified Diff: chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc

Issue 134133003: Fix VK animation related issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc
diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc
index 4f4da622d0a6af17a49ea7ee7c29df5d394037de..b8b2bf84119c6de3a8dd0778c0c1537e9819b3ba 100644
--- a/chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc
+++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc
@@ -131,7 +131,7 @@ TEST_F(AshKeyboardControllerProxyTest, VirtualKeyboardContainerAnimation) {
// animation starts.
EXPECT_TRUE(keyboard_container->IsVisible());
EXPECT_TRUE(proxy()->GetKeyboardWindow()->IsVisible());
- EXPECT_EQ(0.0, layer->opacity());
+ float show_start_opacity = layer->opacity();
gfx::Transform transform;
transform.Translate(0, proxy()->GetKeyboardWindow()->bounds().height());
EXPECT_EQ(transform, layer->transform());
@@ -139,18 +139,45 @@ TEST_F(AshKeyboardControllerProxyTest, VirtualKeyboardContainerAnimation) {
RunAnimationForLayer(layer);
EXPECT_TRUE(keyboard_container->IsVisible());
EXPECT_TRUE(proxy()->GetKeyboardWindow()->IsVisible());
- EXPECT_EQ(1.0, layer->opacity());
+ float show_end_opacity = layer->opacity();
+ EXPECT_LT(show_start_opacity, show_end_opacity);
EXPECT_EQ(gfx::Transform(), layer->transform());
HideKeyboard(keyboard_container);
- // Keyboard container and window should be visible before hide animation
- // finishes.
EXPECT_TRUE(keyboard_container->IsVisible());
+ EXPECT_TRUE(keyboard_container->layer()->visible());
EXPECT_TRUE(proxy()->GetKeyboardWindow()->IsVisible());
+ float hide_start_opacity = layer->opacity();
RunAnimationForLayer(layer);
EXPECT_FALSE(keyboard_container->IsVisible());
+ EXPECT_FALSE(keyboard_container->layer()->visible());
EXPECT_FALSE(proxy()->GetKeyboardWindow()->IsVisible());
- EXPECT_EQ(0.0, layer->opacity());
+ float hide_end_opacity = layer->opacity();
+ EXPECT_GT(hide_start_opacity, hide_end_opacity);
EXPECT_EQ(transform, layer->transform());
}
+
+// Test for crbug.com/333284.
James Cook 2014/01/16 17:55:03 It's great that you wrote a test specifically for
+TEST_F(AshKeyboardControllerProxyTest, VirtualKeyboardContainerShowWhileHide) {
+ // We cannot short-circuit animations for this test.
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
+
+ aura::Window* keyboard_container(controller()->GetContainerWindow());
+ ui::Layer* layer = keyboard_container->layer();
+
+ EXPECT_FALSE(keyboard_container->IsVisible());
+ ShowKeyboard(keyboard_container);
+ RunAnimationForLayer(layer);
+
+ HideKeyboard(keyboard_container);
+ // Before hide animation finishes, show keyboard again.
+ ShowKeyboard(keyboard_container);
+
+ RunAnimationForLayer(layer);
+ EXPECT_TRUE(keyboard_container->IsVisible());
+ EXPECT_TRUE(proxy()->GetKeyboardWindow()->IsVisible());
+ EXPECT_EQ(1.0, layer->opacity());
+ EXPECT_EQ(gfx::Transform(), layer->transform());
+}

Powered by Google App Engine
This is Rietveld 408576698