Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc |
| diff --git a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc |
| index f321bb66ad50d1dcb49e9c8bedef1ceb6a4205d0..7e29e8aaf4f59e378f1ea28c5a9d29157ec2b24c 100644 |
| --- a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc |
| +++ b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc |
| @@ -8,15 +8,19 @@ |
| #include "base/command_line.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/prefs/pref_service.h" |
| #include "base/strings/stringprintf.h" |
| #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "chromeos/chromeos_switches.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| #include "content/public/browser/notification_service.h" |
| #include "extensions/common/switches.h" |
| #include "extensions/browser/api/test/test_api.h" |
| #include "extensions/browser/notification_types.h" |
| +#include "extensions/test/extension_test_message_listener.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "ui/base/ime/chromeos/extension_ime_util.h" |
| #include "ui/base/ime/chromeos/input_method_manager.h" |
| @@ -72,6 +76,7 @@ class ExtensionInputMethodApiTest : public ExtensionApiTest { |
| command_line->AppendSwitchASCII( |
| extensions::switches::kWhitelistedExtensionID, |
| "ilanclmaeigfpnmdlgelmhkpkegdioip"); |
| + command_line->AppendSwitch(chromeos::switches::kEnableImeMenu); |
| } |
| }; |
| @@ -81,5 +86,25 @@ IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| // Listener for extension's background ready. |
| TestListener listener; |
| - ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| + ASSERT_TRUE(RunExtensionTest("input_method/basic")) << message_; |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, ImeMenuActivation) { |
| + // Listener for IME menu initial state ready. |
| + ExtensionTestMessageListener config_listener("config_ready", false); |
| + // Listener for IME menu event ready. |
| + ExtensionTestMessageListener event_listener("event_ready", false); |
| + |
| + browser()->profile()->GetPrefs()->SetBoolean(prefs::kLanguageImeMenuActivated, |
| + true); |
| + |
| + // Test the initial state and add listener for IME menu activation change. |
| + ASSERT_TRUE(RunExtensionTest("input_method/ime_menu")) << message_; |
|
Devlin
2016/01/27 20:33:27
Instead of using RunExtensionTest here, just load
Azure Wei
2016/01/28 12:24:58
Done.
|
| + ASSERT_TRUE(config_listener.WaitUntilSatisfied()) << message_; |
| + |
| + // Trigger chrome.inputMethodPrivate.onImeMenuActivationChanged() event. |
| + browser()->profile()->GetPrefs()->SetBoolean(prefs::kLanguageImeMenuActivated, |
| + false); |
| + // Test that the extension gets the IME activation change event properly. |
| + ASSERT_TRUE(event_listener.WaitUntilSatisfied()) << message_; |
| } |