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/api/input_ime/input_ime_api_nonchromeos.h" | 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/ui/views/frame/browser_view.h" | 7 #include "chrome/browser/ui/views/frame/browser_view.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 private: | 26 private: |
27 DISALLOW_COPY_AND_ASSIGN(InputImeApiTest); | 27 DISALLOW_COPY_AND_ASSIGN(InputImeApiTest); |
28 }; | 28 }; |
29 | 29 |
30 IN_PROC_BROWSER_TEST_F(InputImeApiTest, CreateWindowTest) { | 30 IN_PROC_BROWSER_TEST_F(InputImeApiTest, CreateWindowTest) { |
31 // Manipulates the focused text input client because the follow cursor | 31 // Manipulates the focused text input client because the follow cursor |
32 // window requires the text input focus. | 32 // window requires the text input focus. |
33 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 33 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
34 ui::InputMethod* input_method = | 34 ui::InputMethod* input_method = |
35 browser_view->GetNativeWindow()->GetHost()->GetInputMethod(); | 35 browser_view->GetNativeWindow()->GetHost()->GetInputMethod(); |
36 scoped_ptr<ui::DummyTextInputClient> client( | 36 std::unique_ptr<ui::DummyTextInputClient> client( |
37 new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT)); | 37 new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT)); |
38 input_method->SetFocusedTextInputClient(client.get()); | 38 input_method->SetFocusedTextInputClient(client.get()); |
39 ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture; | 39 ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture; |
40 InputImeActivateFunction::disable_bubble_for_testing_ = true; | 40 InputImeActivateFunction::disable_bubble_for_testing_ = true; |
41 | 41 |
42 ASSERT_TRUE(RunExtensionTest("input_ime_nonchromeos")) << message_; | 42 ASSERT_TRUE(RunExtensionTest("input_ime_nonchromeos")) << message_; |
43 | 43 |
44 // Test the input.ime.sendKeyEvents API. | 44 // Test the input.ime.sendKeyEvents API. |
45 ASSERT_EQ(client->insert_char_count(), 1); | 45 ASSERT_EQ(client->insert_char_count(), 1); |
46 ASSERT_EQ(client->last_insert_char(), L'a'); | 46 ASSERT_EQ(client->last_insert_char(), L'a'); |
47 | 47 |
48 input_method->DetachTextInputClient(client.get()); | 48 input_method->DetachTextInputClient(client.get()); |
49 } | 49 } |
50 | 50 |
51 } // namespace extensions | 51 } // namespace extensions |
OLD | NEW |