| 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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char kSetInputMethodDone[] = "done"; | 26 const char kSetInputMethodDone[] = "done"; |
| 27 | 27 |
| 28 // Class that listens for the JS message then changes input method and replies | 28 // Class that listens for the JS message then changes input method and replies |
| 29 // back. | 29 // back. |
| 30 class SetInputMethodListener : public content::NotificationObserver { | 30 class SetInputMethodListener : public content::NotificationObserver { |
| 31 public: | 31 public: |
| 32 // Creates listener, which should reply exactly |count_| times. | 32 // Creates listener, which should reply exactly |count_| times. |
| 33 explicit SetInputMethodListener(int count) : count_(count) { | 33 explicit SetInputMethodListener(int count) : count_(count) { |
| 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
| 35 content::NotificationService::AllSources()); | 35 content::NotificationService::AllSources()); |
| 36 chromeos::input_method::InputMethodManager::Get()-> | 36 chromeos::input_method::InputMethodManager::Get()->EnableLoginLayouts( |
| 37 EnableLayouts(kLoginScreenUILanguage, kInitialInputMethodOnLoginScreen); | 37 kLoginScreenUILanguage, kInitialInputMethodOnLoginScreen); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual ~SetInputMethodListener() { | 40 virtual ~SetInputMethodListener() { |
| 41 EXPECT_EQ(0, count_); | 41 EXPECT_EQ(0, count_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Implements the content::NotificationObserver interface. | 44 // Implements the content::NotificationObserver interface. |
| 45 virtual void Observe(int type, | 45 virtual void Observe(int type, |
| 46 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
| 47 const content::NotificationDetails& details) OVERRIDE { | 47 const content::NotificationDetails& details) OVERRIDE { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| 79 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 79 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| 80 // Two test, two calls. See JS code for more info. | 80 // Two test, two calls. See JS code for more info. |
| 81 SetInputMethodListener listener(2); | 81 SetInputMethodListener listener(2); |
| 82 | 82 |
| 83 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 83 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| 84 } | 84 } |
| OLD | NEW |