| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/test/base/in_process_browser_test.h" | 6 #include "chrome/test/base/in_process_browser_test.h" |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "ui/base/ime/dummy_text_input_client.h" | 8 #include "ui/base/ime/dummy_text_input_client.h" |
| 9 #include "ui/base/ime/input_method.h" | 9 #include "ui/base/ime/input_method.h" |
| 10 #include "ui/base/ime/input_method_factory.h" | 10 #include "ui/base/ime/input_method_factory.h" |
| 11 #include "ui/keyboard/keyboard_constants.h" | 11 #include "ui/keyboard/keyboard_constants.h" |
| 12 #include "ui/keyboard/keyboard_controller.h" | 12 #include "ui/keyboard/keyboard_controller.h" |
| 13 #include "ui/keyboard/keyboard_controller_proxy.h" | 13 #include "ui/keyboard/keyboard_controller_proxy.h" |
| 14 #include "ui/keyboard/keyboard_switches.h" | 14 #include "ui/keyboard/keyboard_switches.h" |
| 15 #include "ui/keyboard/keyboard_util.h" | 15 #include "ui/keyboard/keyboard_util.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 const int kKeyboardHeightForTest = 100; | 18 const int kKeyboardHeightForTest = 100; |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 class VirtualKeyboardWebContentTest : public InProcessBrowserTest { | 21 class VirtualKeyboardWebContentTest : public InProcessBrowserTest { |
| 22 public: | 22 public: |
| 23 VirtualKeyboardWebContentTest() {}; | 23 VirtualKeyboardWebContentTest() {}; |
| 24 virtual ~VirtualKeyboardWebContentTest() {}; | 24 ~VirtualKeyboardWebContentTest() override{}; |
| 25 | 25 |
| 26 virtual void SetUp() override { | 26 void SetUp() override { |
| 27 ui::SetUpInputMethodFactoryForTesting(); | 27 ui::SetUpInputMethodFactoryForTesting(); |
| 28 InProcessBrowserTest::SetUp(); | 28 InProcessBrowserTest::SetUp(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Ensure that the virtual keyboard is enabled. | 31 // Ensure that the virtual keyboard is enabled. |
| 32 virtual void SetUpCommandLine(base::CommandLine* command_line) override { | 32 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 33 command_line->AppendSwitch( | 33 command_line->AppendSwitch( |
| 34 keyboard::switches::kEnableVirtualKeyboard); | 34 keyboard::switches::kEnableVirtualKeyboard); |
| 35 } | 35 } |
| 36 | 36 |
| 37 keyboard::KeyboardControllerProxy* proxy() { | 37 keyboard::KeyboardControllerProxy* proxy() { |
| 38 return keyboard::KeyboardController::GetInstance()->proxy(); | 38 return keyboard::KeyboardController::GetInstance()->proxy(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 void FocusEditableNodeAndShowKeyboard() { | 42 void FocusEditableNodeAndShowKeyboard() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Simulate hide keyboard by pressing hide key on the virtual keyboard. | 100 // Simulate hide keyboard by pressing hide key on the virtual keyboard. |
| 101 keyboard::KeyboardController::GetInstance()->HideKeyboard( | 101 keyboard::KeyboardController::GetInstance()->HideKeyboard( |
| 102 keyboard::KeyboardController::HIDE_REASON_MANUAL); | 102 keyboard::KeyboardController::HIDE_REASON_MANUAL); |
| 103 EXPECT_FALSE(IsKeyboardVisible()); | 103 EXPECT_FALSE(IsKeyboardVisible()); |
| 104 | 104 |
| 105 MockEnableIMEInDifferentExtension("chrome-extension://domain-2"); | 105 MockEnableIMEInDifferentExtension("chrome-extension://domain-2"); |
| 106 // Keyboard should not become visible if previous keyboard is not, even if it | 106 // Keyboard should not become visible if previous keyboard is not, even if it |
| 107 // is currently focused on an editable node. | 107 // is currently focused on an editable node. |
| 108 EXPECT_FALSE(IsKeyboardVisible()); | 108 EXPECT_FALSE(IsKeyboardVisible()); |
| 109 } | 109 } |
| OLD | NEW |