OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/display/virtual_keyboard_window_controller.h" |
| 6 |
| 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_controller.h" |
| 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" |
| 11 #include "ash/shell_window_ids.h" |
| 12 #include "ash/test/ash_test_base.h" |
| 13 #include "base/command_line.h" |
| 14 #include "ui/keyboard/keyboard_switches.h" |
| 15 |
| 16 namespace ash { |
| 17 namespace test { |
| 18 |
| 19 class VirtualKeyboardWindowControllerTest : public AshTestBase { |
| 20 public: |
| 21 VirtualKeyboardWindowControllerTest() |
| 22 : virtual_keyboard_window_controller_(NULL) {} |
| 23 virtual ~VirtualKeyboardWindowControllerTest() {} |
| 24 |
| 25 virtual void SetUp() OVERRIDE { |
| 26 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 27 switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300"); |
| 28 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 29 keyboard::switches::kKeyboardUsabilityExperiment); |
| 30 test::AshTestBase::SetUp(); |
| 31 } |
| 32 |
| 33 void set_virtual_keyboard_window_controller( |
| 34 internal::VirtualKeyboardWindowController* controller) { |
| 35 virtual_keyboard_window_controller_ = controller; |
| 36 } |
| 37 |
| 38 internal::RootWindowController* root_window_controller() { |
| 39 return virtual_keyboard_window_controller_-> |
| 40 root_window_controller_for_test(); |
| 41 } |
| 42 |
| 43 private: |
| 44 internal::VirtualKeyboardWindowController* |
| 45 virtual_keyboard_window_controller_; |
| 46 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardWindowControllerTest); |
| 47 }; |
| 48 |
| 49 |
| 50 TEST_F(VirtualKeyboardWindowControllerTest, VirtualKeyboardWindowTest) { |
| 51 if (!SupportsMultipleDisplays()) |
| 52 return; |
| 53 RunAllPendingInMessageLoop(); |
| 54 set_virtual_keyboard_window_controller( |
| 55 Shell::GetInstance()->display_controller()-> |
| 56 virtual_keyboard_window_controller()); |
| 57 EXPECT_TRUE(root_window_controller()); |
| 58 // Keyboard container is added to virtual keyboard window. |
| 59 EXPECT_TRUE(root_window_controller()->GetContainer( |
| 60 internal::kShellWindowId_VirtualKeyboardContainer)); |
| 61 } |
| 62 |
| 63 } // namespace test |
| 64 } // namespace ash |
OLD | NEW |