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 22 matching lines...) Expand all Loading... | |
33 namespace keyboard { | 33 namespace keyboard { |
34 namespace { | 34 namespace { |
35 | 35 |
36 // Steps a layer animation until it is completed. Animations must be enabled. | 36 // Steps a layer animation until it is completed. Animations must be enabled. |
37 void RunAnimationForLayer(ui::Layer* layer) { | 37 void RunAnimationForLayer(ui::Layer* layer) { |
38 // Animations must be enabled for stepping to work. | 38 // Animations must be enabled for stepping to work. |
39 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 39 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
40 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 40 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
41 | 41 |
42 ui::LayerAnimatorTestController controller(layer->GetAnimator()); | 42 ui::LayerAnimatorTestController controller(layer->GetAnimator()); |
43 gfx::AnimationContainerElement* element = layer->GetAnimator(); | |
44 // Multiple steps are required to complete complex animations. | 43 // Multiple steps are required to complete complex animations. |
45 // TODO(vollick): This should not be necessary. crbug.com/154017 | 44 // TODO(vollick): This should not be necessary. crbug.com/154017 |
46 while (controller.animator()->is_animating()) { | 45 while (controller.animator()->is_animating()) { |
47 controller.StartThreadedAnimationsIfNeeded(); | 46 controller.StartThreadedAnimationsIfNeeded(); |
48 base::TimeTicks step_time = controller.animator()->last_step_time(); | 47 base::TimeTicks step_time = controller.animator()->last_step_time(); |
49 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); | 48 layer->GetAnimator()->Step(step_time + |
ajuma
2014/05/23 17:10:00
controller.animator()->Step(...)
is more consisten
sadrul
2014/05/23 18:02:42
Done.
| |
49 base::TimeDelta::FromMilliseconds(1000)); | |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 // An event handler that focuses a window when it is clicked/touched on. This is | 53 // An event handler that focuses a window when it is clicked/touched on. This is |
54 // used to match the focus manger behaviour in ash and views. | 54 // used to match the focus manger behaviour in ash and views. |
55 class TestFocusController : public ui::EventHandler { | 55 class TestFocusController : public ui::EventHandler { |
56 public: | 56 public: |
57 explicit TestFocusController(aura::Window* root) | 57 explicit TestFocusController(aura::Window* root) |
58 : root_(root) { | 58 : root_(root) { |
59 root_->AddPreTargetHandler(this); | 59 root_->AddPreTargetHandler(this); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 SetFocus(&input_client); | 551 SetFocus(&input_client); |
552 EXPECT_TRUE(keyboard_container->IsVisible()); | 552 EXPECT_TRUE(keyboard_container->IsVisible()); |
553 | 553 |
554 SetFocus(&no_input_client); | 554 SetFocus(&no_input_client); |
555 // Keyboard should not hide itself after lost focus. | 555 // Keyboard should not hide itself after lost focus. |
556 EXPECT_TRUE(keyboard_container->IsVisible()); | 556 EXPECT_TRUE(keyboard_container->IsVisible()); |
557 EXPECT_FALSE(WillHideKeyboard()); | 557 EXPECT_FALSE(WillHideKeyboard()); |
558 } | 558 } |
559 | 559 |
560 } // namespace keyboard | 560 } // namespace keyboard |
OLD | NEW |