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 "ui/aura/window_event_dispatcher.h" |
7 #include "ui/aura/window_tree_host.h" | 8 #include "ui/aura/window_tree_host.h" |
8 | 9 |
9 namespace aura { | 10 namespace aura { |
10 namespace test { | 11 namespace test { |
11 | 12 |
12 class WindowTreeHostTestApi { | 13 class WindowTreeHostTestApi { |
13 public: | 14 public: |
14 explicit WindowTreeHostTestApi(WindowTreeHost* host) : host_(host) {} | 15 explicit WindowTreeHostTestApi(WindowTreeHost* host) : host_(host) {} |
15 | 16 |
16 const gfx::Point& last_cursor_request_position_in_host() { | 17 const gfx::Point& last_cursor_request_position_in_host() { |
17 return host_->last_cursor_request_position_in_host_; | 18 return host_->last_cursor_request_position_in_host_; |
18 } | 19 } |
19 | 20 |
| 21 void set_dispatcher(scoped_ptr<WindowEventDispatcher> dispatcher) { |
| 22 host_->dispatcher_ = dispatcher.Pass(); |
| 23 } |
| 24 |
20 private: | 25 private: |
21 WindowTreeHost* host_; | 26 WindowTreeHost* host_; |
22 | 27 |
23 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostTestApi); | 28 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostTestApi); |
24 }; | 29 }; |
25 | 30 |
26 const gfx::Point& QueryLatestMousePositionRequestInHost(WindowTreeHost* host) { | 31 const gfx::Point& QueryLatestMousePositionRequestInHost(WindowTreeHost* host) { |
27 WindowTreeHostTestApi host_test_api(host); | 32 WindowTreeHostTestApi host_test_api(host); |
28 return host_test_api.last_cursor_request_position_in_host(); | 33 return host_test_api.last_cursor_request_position_in_host(); |
29 } | 34 } |
30 | 35 |
| 36 void SetHostDispatcher(WindowTreeHost* host, |
| 37 scoped_ptr<WindowEventDispatcher> dispatcher) { |
| 38 WindowTreeHostTestApi host_test_api(host); |
| 39 host_test_api.set_dispatcher(dispatcher.Pass()); |
| 40 } |
| 41 |
31 } // namespace test | 42 } // namespace test |
32 } // namespace aura | 43 } // namespace aura |
OLD | NEW |