| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/aura/client/focus_client.h" | 10 #include "ui/aura/client/focus_client.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 namespace keyboard { | 34 namespace keyboard { |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // Steps a layer animation until it is completed. Animations must be enabled. | 37 // Steps a layer animation until it is completed. Animations must be enabled. |
| 38 void RunAnimationForLayer(ui::Layer* layer) { | 38 void RunAnimationForLayer(ui::Layer* layer) { |
| 39 // Animations must be enabled for stepping to work. | 39 // Animations must be enabled for stepping to work. |
| 40 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 40 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
| 41 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 41 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
| 42 | 42 |
| 43 ui::LayerAnimatorTestController controller(layer->GetAnimator()); | 43 ui::LayerAnimatorTestController controller(layer->GetAnimator()); |
| 44 gfx::AnimationContainerElement* element = layer->GetAnimator(); | |
| 45 // Multiple steps are required to complete complex animations. | 44 // Multiple steps are required to complete complex animations. |
| 46 // TODO(vollick): This should not be necessary. crbug.com/154017 | 45 // TODO(vollick): This should not be necessary. crbug.com/154017 |
| 47 while (controller.animator()->is_animating()) { | 46 while (controller.animator()->is_animating()) { |
| 48 controller.StartThreadedAnimationsIfNeeded(); | 47 controller.StartThreadedAnimationsIfNeeded(); |
| 49 base::TimeTicks step_time = controller.animator()->last_step_time(); | 48 base::TimeTicks step_time = controller.animator()->last_step_time(); |
| 50 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); | 49 controller.animator()->Step(step_time + |
| 50 base::TimeDelta::FromMilliseconds(1000)); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 // An event handler that focuses a window when it is clicked/touched on. This is | 54 // An event handler that focuses a window when it is clicked/touched on. This is |
| 55 // used to match the focus manger behaviour in ash and views. | 55 // used to match the focus manger behaviour in ash and views. |
| 56 class TestFocusController : public ui::EventHandler { | 56 class TestFocusController : public ui::EventHandler { |
| 57 public: | 57 public: |
| 58 explicit TestFocusController(aura::Window* root) | 58 explicit TestFocusController(aura::Window* root) |
| 59 : root_(root) { | 59 : root_(root) { |
| 60 root_->AddPreTargetHandler(this); | 60 root_->AddPreTargetHandler(this); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 SetFocus(&input_client); | 553 SetFocus(&input_client); |
| 554 EXPECT_TRUE(keyboard_container->IsVisible()); | 554 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 555 | 555 |
| 556 SetFocus(&no_input_client); | 556 SetFocus(&no_input_client); |
| 557 // Keyboard should not hide itself after lost focus. | 557 // Keyboard should not hide itself after lost focus. |
| 558 EXPECT_TRUE(keyboard_container->IsVisible()); | 558 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 559 EXPECT_FALSE(WillHideKeyboard()); | 559 EXPECT_FALSE(WillHideKeyboard()); |
| 560 } | 560 } |
| 561 | 561 |
| 562 } // namespace keyboard | 562 } // namespace keyboard |
| OLD | NEW |