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 "ash/host/ash_window_tree_host_x11.h" | 5 #include "ash/host/ash_window_tree_host_x11.h" |
6 | 6 |
7 #undef None | 7 #undef None |
8 #undef Bool | 8 #undef Bool |
9 | 9 |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #if defined(OS_CHROMEOS) | 86 #if defined(OS_CHROMEOS) |
87 #define MAYBE_DispatchTouchEventToOneRootWindow DISABLED_DispatchTouchEventToOne
RootWindow | 87 #define MAYBE_DispatchTouchEventToOneRootWindow DISABLED_DispatchTouchEventToOne
RootWindow |
88 #else | 88 #else |
89 #define MAYBE_DispatchTouchEventToOneRootWindow DispatchTouchEventToOneRootWindo
w | 89 #define MAYBE_DispatchTouchEventToOneRootWindow DispatchTouchEventToOneRootWindo
w |
90 #endif | 90 #endif |
91 | 91 |
92 // Send X touch events to one WindowTreeHost. The WindowTreeHost's | 92 // Send X touch events to one WindowTreeHost. The WindowTreeHost's |
93 // delegate will get corresponding ui::TouchEvent if the touch events | 93 // delegate will get corresponding ui::TouchEvent if the touch events |
94 // are targeting this WindowTreeHost. | 94 // are targeting this WindowTreeHost. |
95 TEST_F(AshWindowTreeHostX11Test, MAYBE_DispatchTouchEventToOneRootWindow) { | 95 TEST_F(AshWindowTreeHostX11Test, MAYBE_DispatchTouchEventToOneRootWindow) { |
96 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( | 96 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host( |
97 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 97 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
98 window_tree_host->InitHost(); | 98 window_tree_host->InitHost(); |
99 scoped_ptr<RootWindowEventHandler> handler( | 99 std::unique_ptr<RootWindowEventHandler> handler( |
100 new RootWindowEventHandler(window_tree_host.get())); | 100 new RootWindowEventHandler(window_tree_host.get())); |
101 | 101 |
102 std::vector<int> devices; | 102 std::vector<int> devices; |
103 devices.push_back(0); | 103 devices.push_back(0); |
104 ui::SetUpTouchDevicesForTest(devices); | 104 ui::SetUpTouchDevicesForTest(devices); |
105 std::vector<ui::Valuator> valuators; | 105 std::vector<ui::Valuator> valuators; |
106 | 106 |
107 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 107 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
108 EXPECT_EQ(-1, handler->last_touch_id()); | 108 EXPECT_EQ(-1, handler->last_touch_id()); |
109 | 109 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 EXPECT_EQ(0, handler->last_touch_id()); | 142 EXPECT_EQ(0, handler->last_touch_id()); |
143 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); | 143 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); |
144 | 144 |
145 handler.reset(); | 145 handler.reset(); |
146 } | 146 } |
147 | 147 |
148 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is | 148 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is |
149 // the event target of the X touch events should generate the corresponding | 149 // the event target of the X touch events should generate the corresponding |
150 // ui::TouchEvent for its delegate. | 150 // ui::TouchEvent for its delegate. |
151 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { | 151 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { |
152 scoped_ptr<aura::WindowTreeHostX11> window_tree_host1( | 152 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host1( |
153 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 153 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
154 window_tree_host1->InitHost(); | 154 window_tree_host1->InitHost(); |
155 scoped_ptr<RootWindowEventHandler> handler1( | 155 std::unique_ptr<RootWindowEventHandler> handler1( |
156 new RootWindowEventHandler(window_tree_host1.get())); | 156 new RootWindowEventHandler(window_tree_host1.get())); |
157 | 157 |
158 int host2_y_offset = 1700; | 158 int host2_y_offset = 1700; |
159 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( | 159 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host2( |
160 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 160 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
161 window_tree_host2->InitHost(); | 161 window_tree_host2->InitHost(); |
162 scoped_ptr<RootWindowEventHandler> handler2( | 162 std::unique_ptr<RootWindowEventHandler> handler2( |
163 new RootWindowEventHandler(window_tree_host2.get())); | 163 new RootWindowEventHandler(window_tree_host2.get())); |
164 | 164 |
165 std::vector<int> devices; | 165 std::vector<int> devices; |
166 devices.push_back(0); | 166 devices.push_back(0); |
167 ui::SetUpTouchDevicesForTest(devices); | 167 ui::SetUpTouchDevicesForTest(devices); |
168 std::vector<ui::Valuator> valuators; | 168 std::vector<ui::Valuator> valuators; |
169 | 169 |
170 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 170 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
171 EXPECT_EQ(-1, handler1->last_touch_id()); | 171 EXPECT_EQ(-1, handler1->last_touch_id()); |
172 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); | 172 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 250 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
251 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 251 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
252 EXPECT_EQ(1, handler2->last_touch_id()); | 252 EXPECT_EQ(1, handler2->last_touch_id()); |
253 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); | 253 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
254 | 254 |
255 handler1.reset(); | 255 handler1.reset(); |
256 handler2.reset(); | 256 handler2.reset(); |
257 } | 257 } |
258 | 258 |
259 } // namespace aura | 259 } // namespace aura |
OLD | NEW |