| 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/extensions/api/test/test_api.h" | 14 #include "chrome/browser/extensions/api/test/test_api.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chromeos/ime/extension_ime_util.h" |
| 16 #include "chromeos/ime/input_method_manager.h" | 17 #include "chromeos/ime/input_method_manager.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const char kLoginScreenUILanguage[] = "fr"; | 25 const char kLoginScreenUILanguage[] = "fr"; |
| 25 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng"; | 26 const char kInitialInputMethodOnLoginScreen[] = "xkb:us::eng"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 source).ptr(); | 62 source).ptr(); |
| 62 EXPECT_GT(count_--, 0); | 63 EXPECT_GT(count_--, 0); |
| 63 function->Reply(kSetInputMethodDone); | 64 function->Reply(kSetInputMethodDone); |
| 64 } | 65 } |
| 65 } | 66 } |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 content::NotificationRegistrar registrar_; | 69 content::NotificationRegistrar registrar_; |
| 69 | 70 |
| 70 int count_; | 71 int count_; |
| 72 bool use_ext_xkb_flag_; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 class ExtensionInputMethodApiTest : public ExtensionApiTest { | 75 class ExtensionInputMethodApiTest : public ExtensionApiTest { |
| 74 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 76 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 75 ExtensionApiTest::SetUpCommandLine(command_line); | 77 ExtensionApiTest::SetUpCommandLine(command_line); |
| 76 command_line->AppendSwitchASCII( | 78 command_line->AppendSwitchASCII( |
| 77 switches::kWhitelistedExtensionID, "ilanclmaeigfpnmdlgelmhkpkegdioip"); | 79 switches::kWhitelistedExtensionID, "ilanclmaeigfpnmdlgelmhkpkegdioip"); |
| 78 } | 80 } |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace | 83 } // namespace |
| 82 | 84 |
| 83 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 85 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| 86 chromeos::extension_ime_util::ScopedUseExtensionKeyboardFlagForTesting(false); |
| 87 |
| 84 // Two test, two calls. See JS code for more info. | 88 // Two test, two calls. See JS code for more info. |
| 85 SetInputMethodListener listener(2); | 89 SetInputMethodListener listener(2); |
| 86 | 90 |
| 87 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 91 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| 88 } | 92 } |
| OLD | NEW |