| 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/ime/input_method_menu_item.h" | 5 #include "ash/ime/input_method_menu_item.h" |
| 6 #include "ash/ime/input_method_menu_manager.h" | 6 #include "ash/ime/input_method_menu_manager.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 false); | 64 false); |
| 65 extension_ = LoadExtensionWithType("input_ime", GetParam()); | 65 extension_ = LoadExtensionWithType("input_ime", GetParam()); |
| 66 ASSERT_TRUE(extension_); | 66 ASSERT_TRUE(extension_); |
| 67 ASSERT_TRUE(ime_ready_listener.WaitUntilSatisfied()); | 67 ASSERT_TRUE(ime_ready_listener.WaitUntilSatisfied()); |
| 68 | 68 |
| 69 // Extension IMEs are not enabled by default. | 69 // Extension IMEs are not enabled by default. |
| 70 std::vector<std::string> extension_ime_ids; | 70 std::vector<std::string> extension_ime_ids; |
| 71 extension_ime_ids.push_back(kIdentityIMEID); | 71 extension_ime_ids.push_back(kIdentityIMEID); |
| 72 extension_ime_ids.push_back(kToUpperIMEID); | 72 extension_ime_ids.push_back(kToUpperIMEID); |
| 73 extension_ime_ids.push_back(kAPIArgumentIMEID); | 73 extension_ime_ids.push_back(kAPIArgumentIMEID); |
| 74 InputMethodManager::Get()->SetEnabledExtensionImes(&extension_ime_ids); | 74 InputMethodManager::Get()->GetActiveIMEState()->SetEnabledExtensionImes( |
| 75 &extension_ime_ids); |
| 75 | 76 |
| 76 InputMethodDescriptors extension_imes; | 77 InputMethodDescriptors extension_imes; |
| 77 InputMethodManager::Get()->GetInputMethodExtensions(&extension_imes); | 78 InputMethodManager::Get()->GetActiveIMEState()->GetInputMethodExtensions( |
| 79 &extension_imes); |
| 78 | 80 |
| 79 // Test IME has two input methods, thus InputMethodManager should have two | 81 // Test IME has two input methods, thus InputMethodManager should have two |
| 80 // extension IME. | 82 // extension IME. |
| 81 // Note: Even extension is loaded by LoadExtensionAsComponent as above, the | 83 // Note: Even extension is loaded by LoadExtensionAsComponent as above, the |
| 82 // IME does not managed by ComponentExtensionIMEManager or it's id won't | 84 // IME does not managed by ComponentExtensionIMEManager or it's id won't |
| 83 // start with __comp__. The component extension IME is whitelisted and | 85 // start with __comp__. The component extension IME is whitelisted and |
| 84 // managed by ComponentExtensionIMEManager, but its framework is same as | 86 // managed by ComponentExtensionIMEManager, but its framework is same as |
| 85 // normal extension IME. | 87 // normal extension IME. |
| 86 EXPECT_EQ(3U, extension_imes.size()); | 88 EXPECT_EQ(3U, extension_imes.size()); |
| 87 } | 89 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 InputMethodEngineBrowserTest, | 140 InputMethodEngineBrowserTest, |
| 139 ::testing::Values(kTestTypeIncognito)); | 141 ::testing::Values(kTestTypeIncognito)); |
| 140 INSTANTIATE_TEST_CASE_P(InputMethodEngineComponentExtensionBrowserTest, | 142 INSTANTIATE_TEST_CASE_P(InputMethodEngineComponentExtensionBrowserTest, |
| 141 InputMethodEngineBrowserTest, | 143 InputMethodEngineBrowserTest, |
| 142 ::testing::Values(kTestTypeComponent)); | 144 ::testing::Values(kTestTypeComponent)); |
| 143 | 145 |
| 144 IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, | 146 IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, |
| 145 BasicScenarioTest) { | 147 BasicScenarioTest) { |
| 146 LoadTestInputMethod(); | 148 LoadTestInputMethod(); |
| 147 | 149 |
| 148 InputMethodManager::Get()->ChangeInputMethod(kIdentityIMEID); | 150 InputMethodManager::Get()->GetActiveIMEState()->ChangeInputMethod( |
| 151 kIdentityIMEID, false /* show_message */); |
| 149 | 152 |
| 150 scoped_ptr<MockIMEInputContextHandler> mock_input_context( | 153 scoped_ptr<MockIMEInputContextHandler> mock_input_context( |
| 151 new MockIMEInputContextHandler()); | 154 new MockIMEInputContextHandler()); |
| 152 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( | 155 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( |
| 153 new MockIMECandidateWindowHandler()); | 156 new MockIMECandidateWindowHandler()); |
| 154 | 157 |
| 155 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); | 158 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); |
| 156 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); | 159 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); |
| 157 | 160 |
| 158 IMEEngineHandlerInterface* engine_handler = | 161 IMEEngineHandlerInterface* engine_handler = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ASSERT_TRUE(disabled_listener.was_satisfied()); | 221 ASSERT_TRUE(disabled_listener.was_satisfied()); |
| 219 | 222 |
| 220 IMEBridge::Get()->SetInputContextHandler(NULL); | 223 IMEBridge::Get()->SetInputContextHandler(NULL); |
| 221 IMEBridge::Get()->SetCandidateWindowHandler(NULL); | 224 IMEBridge::Get()->SetCandidateWindowHandler(NULL); |
| 222 } | 225 } |
| 223 | 226 |
| 224 IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, | 227 IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, |
| 225 APIArgumentTest) { | 228 APIArgumentTest) { |
| 226 LoadTestInputMethod(); | 229 LoadTestInputMethod(); |
| 227 | 230 |
| 228 InputMethodManager::Get()->ChangeInputMethod(kAPIArgumentIMEID); | 231 InputMethodManager::Get()->GetActiveIMEState()->ChangeInputMethod( |
| 232 kAPIArgumentIMEID, false /* show_message */); |
| 229 | 233 |
| 230 scoped_ptr<MockIMEInputContextHandler> mock_input_context( | 234 scoped_ptr<MockIMEInputContextHandler> mock_input_context( |
| 231 new MockIMEInputContextHandler()); | 235 new MockIMEInputContextHandler()); |
| 232 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( | 236 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( |
| 233 new MockIMECandidateWindowHandler()); | 237 new MockIMECandidateWindowHandler()); |
| 234 | 238 |
| 235 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); | 239 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); |
| 236 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); | 240 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); |
| 237 | 241 |
| 238 IMEEngineHandlerInterface* engine_handler = | 242 IMEEngineHandlerInterface* engine_handler = |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 928 } |
| 925 } | 929 } |
| 926 | 930 |
| 927 IMEBridge::Get()->SetInputContextHandler(NULL); | 931 IMEBridge::Get()->SetInputContextHandler(NULL); |
| 928 IMEBridge::Get()->SetCandidateWindowHandler(NULL); | 932 IMEBridge::Get()->SetCandidateWindowHandler(NULL); |
| 929 } | 933 } |
| 930 | 934 |
| 931 } // namespace | 935 } // namespace |
| 932 } // namespace input_method | 936 } // namespace input_method |
| 933 } // namespace chromeos | 937 } // namespace chromeos |
| OLD | NEW |