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