| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 8 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| 9 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 10 #include "chrome/browser/extensions/extension_test_api.h" | 11 #include "chrome/browser/extensions/extension_test_api.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/common/chrome_switches.h" |
| 12 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 const char kNewInputMethod[] = "ru::rus"; | 21 const char kNewInputMethod[] = "ru::rus"; |
| 20 const char kSetInputMethodMessage[] = "setInputMethod"; | 22 const char kSetInputMethodMessage[] = "setInputMethod"; |
| 21 const char kSetInputMethodDone[] = "done"; | 23 const char kSetInputMethodDone[] = "done"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 52 function->Reply(kSetInputMethodDone); | 54 function->Reply(kSetInputMethodDone); |
| 53 } | 55 } |
| 54 } | 56 } |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 content::NotificationRegistrar registrar_; | 59 content::NotificationRegistrar registrar_; |
| 58 | 60 |
| 59 int count_; | 61 int count_; |
| 60 }; | 62 }; |
| 61 | 63 |
| 64 class ExtensionInputMethodApiTest : public ExtensionApiTest { |
| 65 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 66 ExtensionApiTest::SetUpCommandLine(command_line); |
| 67 command_line->AppendSwitchASCII( |
| 68 switches::kWhitelistedExtensionID, "ilanclmaeigfpnmdlgelmhkpkegdioip"); |
| 69 } |
| 70 }; |
| 71 |
| 62 } // namespace | 72 } // namespace |
| 63 | 73 |
| 64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, InputMethodApiBasic) { | 74 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| 65 // Two test, two calls. See JS code for more info. | 75 // Two test, two calls. See JS code for more info. |
| 66 SetInputMethodListener listener(2); | 76 SetInputMethodListener listener(2); |
| 67 | 77 |
| 68 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 78 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| 69 } | 79 } |
| OLD | NEW |