| 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| 10 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 { |
| 48 const std::string& content = *content::Details<std::string>(details).ptr(); | 48 const std::string& content = *content::Details<std::string>(details).ptr(); |
| 49 const std::string expected_message = StringPrintf("%s:%s", | 49 const std::string expected_message = |
| 50 kSetInputMethodMessage, | 50 base::StringPrintf("%s:%s", kSetInputMethodMessage, kNewInputMethod); |
| 51 kNewInputMethod); | |
| 52 if (content == expected_message) { | 51 if (content == expected_message) { |
| 53 chromeos::input_method::GetInputMethodManager()-> | 52 chromeos::input_method::GetInputMethodManager()-> |
| 54 ChangeInputMethod(StringPrintf("xkb:%s", kNewInputMethod)); | 53 ChangeInputMethod(base::StringPrintf("xkb:%s", kNewInputMethod)); |
| 55 | 54 |
| 56 extensions::TestSendMessageFunction* function = | 55 extensions::TestSendMessageFunction* function = |
| 57 content::Source<extensions::TestSendMessageFunction>( | 56 content::Source<extensions::TestSendMessageFunction>( |
| 58 source).ptr(); | 57 source).ptr(); |
| 59 EXPECT_GT(count_--, 0); | 58 EXPECT_GT(count_--, 0); |
| 60 function->Reply(kSetInputMethodDone); | 59 function->Reply(kSetInputMethodDone); |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 | 62 |
| 64 private: | 63 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace | 77 } // namespace |
| 79 | 78 |
| 80 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { | 79 IN_PROC_BROWSER_TEST_F(ExtensionInputMethodApiTest, Basic) { |
| 81 // Two test, two calls. See JS code for more info. | 80 // Two test, two calls. See JS code for more info. |
| 82 SetInputMethodListener listener(2); | 81 SetInputMethodListener listener(2); |
| 83 | 82 |
| 84 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; | 83 ASSERT_TRUE(RunExtensionTest("input_method")) << message_; |
| 85 } | 84 } |
| OLD | NEW |