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/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "ui/aura/scoped_window_targeter.h" | 8 #include "ui/aura/scoped_window_targeter.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/events/event_targeter.h" | 10 #include "ui/events/event_targeter.h" |
11 #include "ui/events/platform/platform_event_source.h" | 11 #include "ui/events/platform/platform_event_source.h" |
12 #include "ui/views/controls/menu/menu_item_view.h" | 12 #include "ui/views/controls/menu/menu_item_view.h" |
13 #include "ui/views/test/views_test_base.h" | 13 #include "ui/views/test/views_test_base.h" |
14 #include "ui/wm/public/dispatcher_client.h" | 14 #include "ui/wm/public/dispatcher_client.h" |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
17 #include "base/message_loop/message_pump_dispatcher.h" | 17 #include "base/message_loop/message_pump_dispatcher.h" |
18 #elif defined(USE_X11) | 18 #elif defined(USE_X11) |
19 #include <X11/Xlib.h> | 19 #include <X11/Xlib.h> |
20 #undef Bool | 20 #undef Bool |
21 #undef None | 21 #undef None |
22 #include "ui/events/test/events_test_utils_x11.h" | 22 #include "ui/events/test/events_test_utils_x11.h" |
| 23 #include "ui/events/x/device_data_manager_x11.h" |
23 #elif defined(USE_OZONE) | 24 #elif defined(USE_OZONE) |
24 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
25 #endif | 26 #endif |
26 | 27 |
27 namespace views { | 28 namespace views { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 class TestMenuItemView : public MenuItemView { | 32 class TestMenuItemView : public MenuItemView { |
32 public: | 33 public: |
33 TestMenuItemView() : MenuItemView(NULL) {} | 34 TestMenuItemView() : MenuItemView(NULL) {} |
34 virtual ~TestMenuItemView() {} | 35 virtual ~TestMenuItemView() {} |
35 | 36 |
36 private: | 37 private: |
37 DISALLOW_COPY_AND_ASSIGN(TestMenuItemView); | 38 DISALLOW_COPY_AND_ASSIGN(TestMenuItemView); |
38 }; | 39 }; |
39 | 40 |
40 class TestPlatformEventSource : public ui::PlatformEventSource { | 41 class TestPlatformEventSource : public ui::PlatformEventSource { |
41 public: | 42 public: |
42 TestPlatformEventSource() {} | 43 TestPlatformEventSource() { |
| 44 #if defined(USE_X11) |
| 45 ui::DeviceDataManagerX11::CreateInstance(); |
| 46 #endif |
| 47 } |
43 virtual ~TestPlatformEventSource() {} | 48 virtual ~TestPlatformEventSource() {} |
44 | 49 |
45 uint32_t Dispatch(const ui::PlatformEvent& event) { | 50 uint32_t Dispatch(const ui::PlatformEvent& event) { |
46 return DispatchEvent(event); | 51 return DispatchEvent(event); |
47 } | 52 } |
48 | 53 |
49 private: | 54 private: |
50 DISALLOW_COPY_AND_ASSIGN(TestPlatformEventSource); | 55 DISALLOW_COPY_AND_ASSIGN(TestPlatformEventSource); |
51 }; | 56 }; |
52 | 57 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 FROM_HERE, | 263 FROM_HERE, |
259 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, | 264 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, |
260 base::Unretained(this), | 265 base::Unretained(this), |
261 MenuController::EXIT_NONE)); | 266 MenuController::EXIT_NONE)); |
262 RunMenu(owner.get()); | 267 RunMenu(owner.get()); |
263 } | 268 } |
264 } | 269 } |
265 #endif | 270 #endif |
266 | 271 |
267 } // namespace views | 272 } // namespace views |
OLD | NEW |