| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 EXPECT_TRUE(keyboard_container->IsVisible()); | 331 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 class KeyboardControllerUsabilityTest : public KeyboardControllerTest { | 334 class KeyboardControllerUsabilityTest : public KeyboardControllerTest { |
| 335 public: | 335 public: |
| 336 KeyboardControllerUsabilityTest() {} | 336 KeyboardControllerUsabilityTest() {} |
| 337 virtual ~KeyboardControllerUsabilityTest() {} | 337 virtual ~KeyboardControllerUsabilityTest() {} |
| 338 | 338 |
| 339 virtual void SetUp() OVERRIDE { | 339 virtual void SetUp() OVERRIDE { |
| 340 CommandLine::ForCurrentProcess()->AppendSwitch( | 340 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 341 switches::kKeyboardUsabilityExperiment); | 341 switches::kKeyboardUsabilityTest); |
| 342 KeyboardControllerTest::SetUp(); | 342 KeyboardControllerTest::SetUp(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 private: | 345 private: |
| 346 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerUsabilityTest); | 346 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerUsabilityTest); |
| 347 }; | 347 }; |
| 348 | 348 |
| 349 TEST_F(KeyboardControllerUsabilityTest, KeyboardAlwaysVisibleInUsabilityTest) { | 349 TEST_F(KeyboardControllerUsabilityTest, KeyboardAlwaysVisibleInUsabilityTest) { |
| 350 const gfx::Rect& root_bounds = root_window()->bounds(); | 350 const gfx::Rect& root_bounds = root_window()->bounds(); |
| 351 | 351 |
| 352 ui::InputMethod* input_method = proxy()->GetInputMethod(); | 352 ui::InputMethod* input_method = proxy()->GetInputMethod(); |
| 353 TestTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT); | 353 TestTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT); |
| 354 TestTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE); | 354 TestTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE); |
| 355 input_method->SetFocusedTextInputClient(&input_client); | 355 input_method->SetFocusedTextInputClient(&input_client); |
| 356 | 356 |
| 357 aura::Window* keyboard_container(controller()->GetContainerWindow()); | 357 aura::Window* keyboard_container(controller()->GetContainerWindow()); |
| 358 keyboard_container->SetBounds(root_bounds); | 358 keyboard_container->SetBounds(root_bounds); |
| 359 root_window()->AddChild(keyboard_container); | 359 root_window()->AddChild(keyboard_container); |
| 360 | 360 |
| 361 EXPECT_TRUE(keyboard_container->IsVisible()); | 361 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 362 | 362 |
| 363 input_method->SetFocusedTextInputClient(&no_input_client); | 363 input_method->SetFocusedTextInputClient(&no_input_client); |
| 364 // Keyboard should not hide itself after lost focus. | 364 // Keyboard should not hide itself after lost focus. |
| 365 EXPECT_TRUE(keyboard_container->IsVisible()); | 365 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 366 EXPECT_FALSE(WillHideKeyboard()); | 366 EXPECT_FALSE(WillHideKeyboard()); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace keyboard | 369 } // namespace keyboard |
| OLD | NEW |