| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "ash/display/virtual_keyboard_window_controller.h" | 5 #include "ash/display/virtual_keyboard_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 RootWindowController* root_window_controller() { | 32 RootWindowController* root_window_controller() { |
| 33 return virtual_keyboard_window_controller_-> | 33 return virtual_keyboard_window_controller_-> |
| 34 root_window_controller_for_test(); | 34 root_window_controller_for_test(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 VirtualKeyboardWindowController* virtual_keyboard_window_controller_; | 38 VirtualKeyboardWindowController* virtual_keyboard_window_controller_; |
| 39 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardWindowControllerTest); | 39 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardWindowControllerTest); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class VirtualKeyboardUsabilityExperimentTest | |
| 43 : public VirtualKeyboardWindowControllerTest { | |
| 44 public: | |
| 45 VirtualKeyboardUsabilityExperimentTest() | |
| 46 : VirtualKeyboardWindowControllerTest() {} | |
| 47 virtual ~VirtualKeyboardUsabilityExperimentTest() {} | |
| 48 | |
| 49 virtual void SetUp() OVERRIDE { | |
| 50 if (SupportsMultipleDisplays()) { | |
| 51 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 52 switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300"); | |
| 53 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 54 keyboard::switches::kKeyboardUsabilityExperiment); | |
| 55 } | |
| 56 test::AshTestBase::SetUp(); | |
| 57 } | |
| 58 | |
| 59 private: | |
| 60 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardUsabilityExperimentTest); | |
| 61 }; | |
| 62 | |
| 63 TEST_F(VirtualKeyboardUsabilityExperimentTest, VirtualKeyboardWindowTest) { | |
| 64 if (!SupportsMultipleDisplays()) | |
| 65 return; | |
| 66 RunAllPendingInMessageLoop(); | |
| 67 set_virtual_keyboard_window_controller( | |
| 68 Shell::GetInstance()->display_controller()-> | |
| 69 virtual_keyboard_window_controller()); | |
| 70 EXPECT_TRUE(root_window_controller()); | |
| 71 aura::Window* container = root_window_controller()->GetContainer( | |
| 72 kShellWindowId_VirtualKeyboardContainer); | |
| 73 // Keyboard container is added to virtual keyboard window and its bounds is | |
| 74 // the same as root window. | |
| 75 EXPECT_TRUE(container); | |
| 76 EXPECT_EQ(container->bounds(), | |
| 77 root_window_controller()->GetRootWindow()->bounds()); | |
| 78 } | |
| 79 | |
| 80 // Tests that the onscreen keyboard becomes enabled when maximize mode is | 42 // Tests that the onscreen keyboard becomes enabled when maximize mode is |
| 81 // enabled. | 43 // enabled. |
| 82 TEST_F(VirtualKeyboardWindowControllerTest, EnabledDuringMaximizeMode) { | 44 TEST_F(VirtualKeyboardWindowControllerTest, EnabledDuringMaximizeMode) { |
| 83 set_virtual_keyboard_window_controller( | 45 set_virtual_keyboard_window_controller( |
| 84 Shell::GetInstance()->display_controller()-> | 46 Shell::GetInstance()->display_controller()-> |
| 85 virtual_keyboard_window_controller()); | 47 virtual_keyboard_window_controller()); |
| 86 | 48 |
| 87 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | 49 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); |
| 88 Shell::GetInstance()->maximize_mode_controller()-> | 50 Shell::GetInstance()->maximize_mode_controller()-> |
| 89 EnableMaximizeModeWindowManager(true); | 51 EnableMaximizeModeWindowManager(true); |
| 90 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); | 52 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); |
| 91 Shell::GetInstance()->maximize_mode_controller()-> | 53 Shell::GetInstance()->maximize_mode_controller()-> |
| 92 EnableMaximizeModeWindowManager(false); | 54 EnableMaximizeModeWindowManager(false); |
| 93 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | 55 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
| 94 } | 56 } |
| 95 | 57 |
| 96 } // namespace test | 58 } // namespace test |
| 97 } // namespace ash | 59 } // namespace ash |
| OLD | NEW |