| 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" | |
| 13 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 12 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| 14 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 13 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 15 #include "chromeos/ime/extension_ime_util.h" | 14 #include "chromeos/ime/extension_ime_util.h" |
| 16 #include "chromeos/ime/input_method_manager.h" | 15 #include "chromeos/ime/input_method_manager.h" |
| 17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 20 #include "extensions/common/switches.h" | 19 #include "extensions/common/switches.h" |
| 21 #include "extensions/browser/api/test/test_api.h" | 20 #include "extensions/browser/api/test/test_api.h" |
| 21 #include "extensions/browser/notification_types.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 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 explicit TestListener() { |
| 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 34 registrar_.Add(this, |
| 35 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
| 35 content::NotificationService::AllSources()); | 36 content::NotificationService::AllSources()); |
| 36 } | 37 } |
| 37 | 38 |
| 38 virtual ~TestListener() {} | 39 virtual ~TestListener() {} |
| 39 | 40 |
| 40 // Implements the content::NotificationObserver interface. | 41 // Implements the content::NotificationObserver interface. |
| 41 virtual void Observe(int type, | 42 virtual void Observe(int type, |
| 42 const content::NotificationSource& source, | 43 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) OVERRIDE { | 44 const content::NotificationDetails& details) OVERRIDE { |
| 44 const std::string& content = *content::Details<std::string>(details).ptr(); | 45 const std::string& content = *content::Details<std::string>(details).ptr(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace | 74 } // namespace |
| 74 | 75 |
| 75 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 76 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| 76 // Listener for extension's background ready. | 77 // Listener for extension's background ready. |
| 77 TestListener listener; | 78 TestListener listener; |
| 78 | 79 |
| 79 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 80 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| 80 } | 81 } |
| OLD | NEW |