Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 12 matching lines...) Expand all
23 23
24 namespace { 24 namespace {
25 25
26 const char kLoginScreenUILanguage[] = "fr"; 26 const char kLoginScreenUILanguage[] = "fr";
27 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng"; 27 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng";
28 const char kBackgroundReady[] = "ready"; 28 const char kBackgroundReady[] = "ready";
29 29
30 // Class that listens for the JS message. 30 // Class that listens for the JS message.
31 class TestListener : public content::NotificationObserver { 31 class TestListener : public content::NotificationObserver {
32 public: 32 public:
33 explicit TestListener() { 33 TestListener() {
34 registrar_.Add(this, 34 registrar_.Add(this,
35 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, 35 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
36 content::NotificationService::AllSources()); 36 content::NotificationService::AllSources());
37 } 37 }
38 38
39 virtual ~TestListener() {} 39 virtual ~TestListener() {}
40 40
41 // Implements the content::NotificationObserver interface. 41 // Implements the content::NotificationObserver interface.
42 virtual void Observe(int type, 42 virtual void Observe(int type,
43 const content::NotificationSource& source, 43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) OVERRIDE { 44 const content::NotificationDetails& details) OVERRIDE {
45 const std::string& content = *content::Details<std::string>(details).ptr(); 45 const std::string& content = *content::Details<std::string>(details).ptr();
46 if (content == kBackgroundReady) { 46 if (content == kBackgroundReady) {
47 // Initializes IMF for testing when receives ready message from 47 // Initializes IMF for testing when receives ready message from
48 // background. 48 // background.
49 chromeos::input_method::InputMethodManager* manager = 49 chromeos::input_method::InputMethodManager* manager =
50 chromeos::input_method::InputMethodManager::Get(); 50 chromeos::input_method::InputMethodManager::Get();
51 manager->GetInputMethodUtil()->InitXkbInputMethodsForTesting(); 51 manager->GetInputMethodUtil()->InitXkbInputMethodsForTesting();
52 52
53 std::vector<std::string> keyboard_layouts; 53 std::vector<std::string> keyboard_layouts;
54 keyboard_layouts.push_back( 54 keyboard_layouts.push_back(
55 chromeos::extension_ime_util::GetInputMethodIDByEngineID( 55 chromeos::extension_ime_util::GetInputMethodIDByEngineID(
56 kInitialInputMethodOnLoginScreen)); 56 kInitialInputMethodOnLoginScreen));
57 manager->EnableLoginLayouts(kLoginScreenUILanguage, keyboard_layouts); 57 manager->GetActiveIMEState()->EnableLoginLayouts(kLoginScreenUILanguage,
58 keyboard_layouts);
58 } 59 }
59 } 60 }
60 61
61 private: 62 private:
62 content::NotificationRegistrar registrar_; 63 content::NotificationRegistrar registrar_;
63 }; 64 };
64 65
65 class ExtensionInputMethodApiTest : public ExtensionApiTest { 66 class ExtensionInputMethodApiTest : public ExtensionApiTest {
66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 67 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
67 ExtensionApiTest::SetUpCommandLine(command_line); 68 ExtensionApiTest::SetUpCommandLine(command_line);
68 command_line->AppendSwitchASCII( 69 command_line->AppendSwitchASCII(
69 extensions::switches::kWhitelistedExtensionID, 70 extensions::switches::kWhitelistedExtensionID,
70 "ilanclmaeigfpnmdlgelmhkpkegdioip"); 71 "ilanclmaeigfpnmdlgelmhkpkegdioip");
71 } 72 }
72 }; 73 };
73 74
74 } // namespace 75 } // namespace
75 76
76 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { 77 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) {
77 // Listener for extension's background ready. 78 // Listener for extension's background ready.
78 TestListener listener; 79 TestListener listener;
79 80
80 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; 81 ASSERT_TRUE(RunExtensionTest("input_method")) << message_;
81 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698