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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 10 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
11 #include "chrome/browser/extensions/api/test/test_api.h" | 11 #include "chrome/browser/extensions/api/test/test_api.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chromeos/ime/input_method_manager.h" | 13 #include "chromeos/ime/input_method_manager.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const char kLoginScreenUILanguage[] = "ru"; | 21 const char kLoginScreenUILanguage[] = "fr"; |
22 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng"; | 22 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng"; |
23 const char kNewInputMethod[] = "ru::rus"; | 23 const char kNewInputMethod[] = "fr::fra"; |
24 const char kSetInputMethodMessage[] = "setInputMethod"; | 24 const char kSetInputMethodMessage[] = "setInputMethod"; |
25 const char kSetInputMethodDone[] = "done"; | 25 const char kSetInputMethodDone[] = "done"; |
26 | 26 |
27 // Class that listens for the JS message then changes input method and replies | 27 // Class that listens for the JS message then changes input method and replies |
28 // back. | 28 // back. |
29 class SetInputMethodListener : public content::NotificationObserver { | 29 class SetInputMethodListener : public content::NotificationObserver { |
30 public: | 30 public: |
31 // Creates listener, which should reply exactly |count_| times. | 31 // Creates listener, which should reply exactly |count_| times. |
32 explicit SetInputMethodListener(int count) : count_(count) { | 32 explicit SetInputMethodListener(int count) : count_(count) { |
33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 }; | 74 }; |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 78 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
79 // Two test, two calls. See JS code for more info. | 79 // Two test, two calls. See JS code for more info. |
80 SetInputMethodListener listener(2); | 80 SetInputMethodListener listener(2); |
81 | 81 |
82 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 82 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
83 } | 83 } |
OLD | NEW |