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 10 matching lines...) Expand all Loading... |
21 #include "ui/compositor/layer_type.h" | 21 #include "ui/compositor/layer_type.h" |
22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
23 #include "ui/compositor/test/context_factories_for_test.h" | 23 #include "ui/compositor/test/context_factories_for_test.h" |
24 #include "ui/compositor/test/layer_animator_test_controller.h" | 24 #include "ui/compositor/test/layer_animator_test_controller.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 #include "ui/keyboard/keyboard_controller.h" | 26 #include "ui/keyboard/keyboard_controller.h" |
27 #include "ui/keyboard/keyboard_controller_observer.h" | 27 #include "ui/keyboard/keyboard_controller_observer.h" |
28 #include "ui/keyboard/keyboard_controller_proxy.h" | 28 #include "ui/keyboard/keyboard_controller_proxy.h" |
29 #include "ui/keyboard/keyboard_switches.h" | 29 #include "ui/keyboard/keyboard_switches.h" |
30 #include "ui/keyboard/keyboard_util.h" | 30 #include "ui/keyboard/keyboard_util.h" |
31 #include "ui/wm/core/default_activation_client.h" | |
32 | 31 |
33 namespace keyboard { | 32 namespace keyboard { |
34 namespace { | 33 namespace { |
35 | 34 |
36 // Steps a layer animation until it is completed. Animations must be enabled. | 35 // Steps a layer animation until it is completed. Animations must be enabled. |
37 void RunAnimationForLayer(ui::Layer* layer) { | 36 void RunAnimationForLayer(ui::Layer* layer) { |
38 // Animations must be enabled for stepping to work. | 37 // Animations must be enabled for stepping to work. |
39 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 38 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
40 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 39 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
41 | 40 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 KeyboardControllerTest() {} | 161 KeyboardControllerTest() {} |
163 virtual ~KeyboardControllerTest() {} | 162 virtual ~KeyboardControllerTest() {} |
164 | 163 |
165 virtual void SetUp() OVERRIDE { | 164 virtual void SetUp() OVERRIDE { |
166 // The ContextFactory must exist before any Compositors are created. | 165 // The ContextFactory must exist before any Compositors are created. |
167 bool enable_pixel_output = false; | 166 bool enable_pixel_output = false; |
168 ui::InitializeContextFactoryForTests(enable_pixel_output); | 167 ui::InitializeContextFactoryForTests(enable_pixel_output); |
169 | 168 |
170 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 169 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
171 aura_test_helper_->SetUp(); | 170 aura_test_helper_->SetUp(); |
172 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | |
173 ui::SetUpInputMethodFactoryForTesting(); | 171 ui::SetUpInputMethodFactoryForTesting(); |
174 focus_controller_.reset(new TestFocusController(root_window())); | 172 focus_controller_.reset(new TestFocusController(root_window())); |
175 proxy_ = new TestKeyboardControllerProxy(); | 173 proxy_ = new TestKeyboardControllerProxy(); |
176 controller_.reset(new KeyboardController(proxy_)); | 174 controller_.reset(new KeyboardController(proxy_)); |
177 } | 175 } |
178 | 176 |
179 virtual void TearDown() OVERRIDE { | 177 virtual void TearDown() OVERRIDE { |
180 controller_.reset(); | 178 controller_.reset(); |
181 focus_controller_.reset(); | 179 focus_controller_.reset(); |
182 aura_test_helper_->TearDown(); | 180 aura_test_helper_->TearDown(); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 SetFocus(&input_client); | 548 SetFocus(&input_client); |
551 EXPECT_TRUE(keyboard_container->IsVisible()); | 549 EXPECT_TRUE(keyboard_container->IsVisible()); |
552 | 550 |
553 SetFocus(&no_input_client); | 551 SetFocus(&no_input_client); |
554 // Keyboard should not hide itself after lost focus. | 552 // Keyboard should not hide itself after lost focus. |
555 EXPECT_TRUE(keyboard_container->IsVisible()); | 553 EXPECT_TRUE(keyboard_container->IsVisible()); |
556 EXPECT_FALSE(WillHideKeyboard()); | 554 EXPECT_FALSE(WillHideKeyboard()); |
557 } | 555 } |
558 | 556 |
559 } // namespace keyboard | 557 } // namespace keyboard |
OLD | NEW |