OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/test/scoped_feature_list.h" | |
11 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 12 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
12 #include "chrome/common/chrome_features.h" | 13 #include "chrome/common/chrome_features.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "chromeos/chromeos_switches.h" | 15 #include "chromeos/chromeos_switches.h" |
15 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
19 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
20 #include "extensions/browser/api/test/test_api.h" | 21 #include "extensions/browser/api/test/test_api.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 manager->GetActiveIMEState()->EnableLoginLayouts(kLoginScreenUILanguage, | 70 manager->GetActiveIMEState()->EnableLoginLayouts(kLoginScreenUILanguage, |
70 keyboard_layouts); | 71 keyboard_layouts); |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 private: | 75 private: |
75 content::NotificationRegistrar registrar_; | 76 content::NotificationRegistrar registrar_; |
76 }; | 77 }; |
77 | 78 |
78 class ExtensionInputMethodApiTest : public ExtensionApiTest { | 79 class ExtensionInputMethodApiTest : public ExtensionApiTest { |
80 public: | |
79 void SetUpCommandLine(base::CommandLine* command_line) override { | 81 void SetUpCommandLine(base::CommandLine* command_line) override { |
80 ExtensionApiTest::SetUpCommandLine(command_line); | 82 ExtensionApiTest::SetUpCommandLine(command_line); |
81 command_line->AppendSwitchASCII( | 83 command_line->AppendSwitchASCII( |
82 extensions::switches::kWhitelistedExtensionID, | 84 extensions::switches::kWhitelistedExtensionID, |
83 "ilanclmaeigfpnmdlgelmhkpkegdioip"); | 85 "ilanclmaeigfpnmdlgelmhkpkegdioip"); |
84 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 86 scoped_feature_list_.InitAndEnableFeature(features::kOptInImeMenu); |
Ilya Sherman
2017/06/12 21:50:29
Does this need to be done as part of SetUpCommandL
chaopeng
2017/06/28 19:21:22
Move all calls to SetUp
| |
85 features::kOptInImeMenu.name); | |
86 } | 87 } |
88 | |
89 private: | |
90 base::test::ScopedFeatureList scoped_feature_list_; | |
87 }; | 91 }; |
88 | 92 |
89 } // namespace | 93 } // namespace |
90 | 94 |
91 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 95 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
92 // Listener for extension's background ready. | 96 // Listener for extension's background ready. |
93 TestListener listener; | 97 TestListener listener; |
94 | 98 |
95 ASSERT_TRUE(RunExtensionTest("input_method/basic")) << message_; | 99 ASSERT_TRUE(RunExtensionTest("input_method/basic")) << message_; |
96 } | 100 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 | 148 |
145 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()) << message_; | 149 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()) << message_; |
146 ASSERT_TRUE(menu_listener.WaitUntilSatisfied()) << message_; | 150 ASSERT_TRUE(menu_listener.WaitUntilSatisfied()) << message_; |
147 ASSERT_TRUE(item_activated_listenter.WaitUntilSatisfied()) << message_; | 151 ASSERT_TRUE(item_activated_listenter.WaitUntilSatisfied()) << message_; |
148 | 152 |
149 InputMethodManager::Get()->GetActiveIMEState()->ChangeInputMethod( | 153 InputMethodManager::Get()->GetActiveIMEState()->ChangeInputMethod( |
150 kTestIMEID2, false /* show_message */); | 154 kTestIMEID2, false /* show_message */); |
151 engine_handler->Enable("test2"); | 155 engine_handler->Enable("test2"); |
152 ASSERT_TRUE(list_listenter.WaitUntilSatisfied()) << message_; | 156 ASSERT_TRUE(list_listenter.WaitUntilSatisfied()) << message_; |
153 } | 157 } |
OLD | NEW |