Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/aura/test/aura_test_utils.h" | 5 #include "ui/aura/test/aura_test_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| 11 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 12 | 12 |
| 13 namespace aura { | 13 namespace aura { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 class WindowTreeHostTestApi { | 16 class WindowTreeHostTestApi { |
| 17 public: | 17 public: |
| 18 explicit WindowTreeHostTestApi(WindowTreeHost* host) : host_(host) {} | 18 explicit WindowTreeHostTestApi(WindowTreeHost* host) : host_(host) {} |
| 19 | 19 |
| 20 const gfx::Point& last_cursor_request_position_in_host() { | 20 const gfx::Point& last_cursor_request_position_in_host() { |
| 21 return host_->last_cursor_request_position_in_host_; | 21 return host_->last_cursor_request_position_in_host_; |
| 22 } | 22 } |
| 23 | 23 |
| 24 void set_dispatcher(std::unique_ptr<WindowEventDispatcher> dispatcher) { | 24 void set_dispatcher(std::unique_ptr<WindowEventDispatcher> dispatcher) { |
| 25 host_->dispatcher_ = std::move(dispatcher); | 25 host_->dispatcher_ = std::move(dispatcher); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void disable_ime() { host_->dispatcher_->set_skip_ime(true); } | |
|
sadrul
2017/05/15 18:14:54
I think this can break after the first key event d
| |
| 29 | |
| 28 private: | 30 private: |
| 29 WindowTreeHost* host_; | 31 WindowTreeHost* host_; |
| 30 | 32 |
| 31 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostTestApi); | 33 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostTestApi); |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 const gfx::Point& QueryLatestMousePositionRequestInHost(WindowTreeHost* host) { | 36 const gfx::Point& QueryLatestMousePositionRequestInHost(WindowTreeHost* host) { |
| 35 WindowTreeHostTestApi host_test_api(host); | 37 WindowTreeHostTestApi host_test_api(host); |
| 36 return host_test_api.last_cursor_request_position_in_host(); | 38 return host_test_api.last_cursor_request_position_in_host(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void SetHostDispatcher(WindowTreeHost* host, | 41 void SetHostDispatcher(WindowTreeHost* host, |
| 40 std::unique_ptr<WindowEventDispatcher> dispatcher) { | 42 std::unique_ptr<WindowEventDispatcher> dispatcher) { |
| 41 WindowTreeHostTestApi host_test_api(host); | 43 WindowTreeHostTestApi host_test_api(host); |
| 42 host_test_api.set_dispatcher(std::move(dispatcher)); | 44 host_test_api.set_dispatcher(std::move(dispatcher)); |
| 43 } | 45 } |
| 44 | 46 |
| 47 void DisableIME(WindowTreeHost* host) { | |
| 48 WindowTreeHostTestApi host_test_api(host); | |
| 49 host_test_api.disable_ime(); | |
| 50 } | |
| 51 | |
| 45 } // namespace test | 52 } // namespace test |
| 46 } // namespace aura | 53 } // namespace aura |
| OLD | NEW |