| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h" | 7 #include "chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h" |
| 8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_test_notification_observer.h" | 10 #include "chrome/browser/extensions/extension_test_notification_observer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/base/ime/input_method.h" | 24 #include "ui/base/ime/input_method.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const base::FilePath::CharType kExtensionName[] = "GoogleKeyboardInput-xkb.crx"; | 28 const base::FilePath::CharType kExtensionName[] = "GoogleKeyboardInput-xkb.crx"; |
| 29 | 29 |
| 30 const base::FilePath::CharType kInputViewTestDir[] = | 30 const base::FilePath::CharType kInputViewTestDir[] = |
| 31 "chromeos/virtual_keyboard/inputview/"; | 31 "chromeos/virtual_keyboard/inputview/"; |
| 32 const base::FilePath::CharType kBaseKeyboardTestFramework[] = "test_base.js"; | 32 const base::FilePath::CharType kBaseKeyboardTestFramework[] = "test_base.js"; |
| 33 | 33 |
| 34 const char kDefaultLayout[] = "us"; |
| 35 const char kCompactLayout[] = "us.compact"; |
| 36 |
| 34 struct InputViewConfig : public VirtualKeyboardBrowserTestConfig { | 37 struct InputViewConfig : public VirtualKeyboardBrowserTestConfig { |
| 35 explicit InputViewConfig(std::string id) { | 38 explicit InputViewConfig(std::string id, std::string layout) { |
| 36 base_framework_ = kBaseKeyboardTestFramework; | 39 base_framework_ = kBaseKeyboardTestFramework; |
| 37 extension_id_ = id; | 40 extension_id_ = id; |
| 38 test_dir_ = kInputViewTestDir; | 41 test_dir_ = kInputViewTestDir; |
| 39 url_ = "chrome-extension://" + id + "/inputview.html?id=us-altgr-intl"; | 42 url_ = "chrome-extension://" + id + "/inputview.html?id=" + layout; |
| 40 } | 43 } |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } // namespace | 46 } // namespace |
| 44 | 47 |
| 45 class InputViewBrowserTest : public VirtualKeyboardBrowserTest { | 48 class InputViewBrowserTest : public VirtualKeyboardBrowserTest { |
| 46 public: | 49 public: |
| 47 // Installs the IME Extension keyboard |kExtensionName|. | 50 // Installs the IME Extension keyboard |kExtensionName|. |
| 48 std::string InstallIMEExtension() { | 51 std::string InstallIMEExtension() { |
| 49 // Loads extension. | 52 // Loads extension. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 std::string id = chromeos::extension_ime_util::GetComponentInputMethodID( | 74 std::string id = chromeos::extension_ime_util::GetComponentInputMethodID( |
| 72 extensionId, "xkb:us::eng"); | 75 extensionId, "xkb:us::eng"); |
| 73 ime->ChangeInputMethod(id); | 76 ime->ChangeInputMethod(id); |
| 74 return extensionId; | 77 return extensionId; |
| 75 } | 78 } |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, TypingTest) { | 81 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, TypingTest) { |
| 79 std::string id = InstallIMEExtension(); | 82 std::string id = InstallIMEExtension(); |
| 80 ASSERT_FALSE(id.empty()); | 83 ASSERT_FALSE(id.empty()); |
| 81 RunTest(base::FilePath("typing_test.js"), InputViewConfig(id)); | 84 RunTest(base::FilePath("typing_test.js"), |
| 85 InputViewConfig(id, kDefaultLayout)); |
| 86 } |
| 87 |
| 88 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, CompactTypingTest) { |
| 89 std::string id = InstallIMEExtension(); |
| 90 ASSERT_FALSE(id.empty()); |
| 91 RunTest(base::FilePath("typing_test.js"), |
| 92 InputViewConfig(id, kCompactLayout)); |
| 82 } | 93 } |
| 83 | 94 |
| 84 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, KeysetTransitionTest) { | 95 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, KeysetTransitionTest) { |
| 85 std::string id = InstallIMEExtension(); | 96 std::string id = InstallIMEExtension(); |
| 86 ASSERT_FALSE(id.empty()); | 97 ASSERT_FALSE(id.empty()); |
| 87 RunTest(base::FilePath("keyset_transition_test.js"), InputViewConfig(id)); | 98 RunTest(base::FilePath("keyset_transition_test.js"), |
| 99 InputViewConfig(id, kDefaultLayout)); |
| 88 } | 100 } |
| 101 |
| 102 IN_PROC_BROWSER_TEST_F(InputViewBrowserTest, CompactKeysetTransitionTest) { |
| 103 std::string id = InstallIMEExtension(); |
| 104 ASSERT_FALSE(id.empty()); |
| 105 RunTest(base::FilePath("keyset_transition_test.js"), |
| 106 InputViewConfig(id, kCompactLayout)); |
| 107 } |
| OLD | NEW |