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/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 13 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
14 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 14 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
15 #include "chrome/browser/extensions/api/test/test_api.h" | 15 #include "chrome/browser/extensions/api/test/test_api.h" |
16 #include "chrome/common/chrome_switches.h" | |
17 #include "chromeos/ime/extension_ime_util.h" | 16 #include "chromeos/ime/extension_ime_util.h" |
18 #include "chromeos/ime/input_method_manager.h" | 17 #include "chromeos/ime/input_method_manager.h" |
19 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
21 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "extensions/common/switches.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
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 kNewInputMethod[] = "fr::fra"; | 28 const char kNewInputMethod[] = "fr::fra"; |
29 const char kSetInputMethodMessage[] = "setInputMethod"; | 29 const char kSetInputMethodMessage[] = "setInputMethod"; |
30 const char kSetInputMethodDone[] = "done"; | 30 const char kSetInputMethodDone[] = "done"; |
31 const char kBackgroundReady[] = "ready"; | 31 const char kBackgroundReady[] = "ready"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 private: | 82 private: |
83 content::NotificationRegistrar registrar_; | 83 content::NotificationRegistrar registrar_; |
84 | 84 |
85 int count_; | 85 int count_; |
86 }; | 86 }; |
87 | 87 |
88 class ExtensionInputMethodApiTest : public ExtensionApiTest { | 88 class ExtensionInputMethodApiTest : public ExtensionApiTest { |
89 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 89 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
90 ExtensionApiTest::SetUpCommandLine(command_line); | 90 ExtensionApiTest::SetUpCommandLine(command_line); |
91 command_line->AppendSwitchASCII( | 91 command_line->AppendSwitchASCII( |
92 switches::kWhitelistedExtensionID, "ilanclmaeigfpnmdlgelmhkpkegdioip"); | 92 extensions::switches::kWhitelistedExtensionID, |
| 93 "ilanclmaeigfpnmdlgelmhkpkegdioip"); |
93 } | 94 } |
94 }; | 95 }; |
95 | 96 |
96 } // namespace | 97 } // namespace |
97 | 98 |
98 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 99 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
99 // Two test, two calls. See JS code for more info. | 100 // Two test, two calls. See JS code for more info. |
100 SetInputMethodListener listener(2); | 101 SetInputMethodListener listener(2); |
101 | 102 |
102 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 103 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
103 } | 104 } |
OLD | NEW |