OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/ui/views/frame/browser_view.h" | 6 #include "chrome/browser/ui/views/frame/browser_view.h" |
7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
10 #include "ui/base/ime/dummy_text_input_client.h" | 10 #include "ui/base/ime/dummy_text_input_client.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // window requires the text input focus. | 31 // window requires the text input focus. |
32 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 32 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
33 ui::InputMethod* input_method = | 33 ui::InputMethod* input_method = |
34 browser_view->GetNativeWindow()->GetHost()->GetInputMethod(); | 34 browser_view->GetNativeWindow()->GetHost()->GetInputMethod(); |
35 scoped_ptr<ui::DummyTextInputClient> client( | 35 scoped_ptr<ui::DummyTextInputClient> client( |
36 new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT)); | 36 new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT)); |
37 input_method->SetFocusedTextInputClient(client.get()); | 37 input_method->SetFocusedTextInputClient(client.get()); |
38 | 38 |
39 ASSERT_TRUE(RunExtensionTest("input_ime_nonchromeos")) << message_; | 39 ASSERT_TRUE(RunExtensionTest("input_ime_nonchromeos")) << message_; |
40 | 40 |
| 41 // Test the input.ime.sendKeyEvents API. |
| 42 ASSERT_EQ(client->insert_char_count(), 1); |
| 43 ASSERT_EQ(client->last_insert_char(), L'a'); |
| 44 |
41 input_method->DetachTextInputClient(client.get()); | 45 input_method->DetachTextInputClient(client.get()); |
42 } | 46 } |
43 | 47 |
44 } // namespace extensions | 48 } // namespace extensions |
OLD | NEW |