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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Send X touch events to one WindowTreeHost. The WindowTreeHost's | 85 // Send X touch events to one WindowTreeHost. The WindowTreeHost's |
86 // delegate will get corresponding ui::TouchEvent if the touch events | 86 // delegate will get corresponding ui::TouchEvent if the touch events |
87 // are targeting this WindowTreeHost. | 87 // are targeting this WindowTreeHost. |
88 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { | 88 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { |
89 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( | 89 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( |
90 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 90 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
91 window_tree_host->InitHost(); | 91 window_tree_host->InitHost(); |
92 scoped_ptr<RootWindowEventHandler> handler( | 92 scoped_ptr<RootWindowEventHandler> handler( |
93 new RootWindowEventHandler(window_tree_host.get())); | 93 new RootWindowEventHandler(window_tree_host.get())); |
94 | 94 |
95 std::vector<unsigned int> devices; | 95 std::vector<int> devices; |
96 devices.push_back(0); | 96 devices.push_back(0); |
97 ui::SetUpTouchDevicesForTest(devices); | 97 ui::SetUpTouchDevicesForTest(devices); |
98 std::vector<ui::Valuator> valuators; | 98 std::vector<ui::Valuator> valuators; |
99 | 99 |
100 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 100 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
101 EXPECT_EQ(-1, handler->last_touch_id()); | 101 EXPECT_EQ(-1, handler->last_touch_id()); |
102 | 102 |
103 ui::ScopedXI2Event scoped_xevent; | 103 ui::ScopedXI2Event scoped_xevent; |
104 // This touch is out of bounds. | 104 // This touch is out of bounds. |
105 scoped_xevent.InitTouchEvent( | 105 scoped_xevent.InitTouchEvent( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 scoped_ptr<RootWindowEventHandler> handler1( | 148 scoped_ptr<RootWindowEventHandler> handler1( |
149 new RootWindowEventHandler(window_tree_host1.get())); | 149 new RootWindowEventHandler(window_tree_host1.get())); |
150 | 150 |
151 int host2_y_offset = 1700; | 151 int host2_y_offset = 1700; |
152 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( | 152 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( |
153 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 153 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
154 window_tree_host2->InitHost(); | 154 window_tree_host2->InitHost(); |
155 scoped_ptr<RootWindowEventHandler> handler2( | 155 scoped_ptr<RootWindowEventHandler> handler2( |
156 new RootWindowEventHandler(window_tree_host2.get())); | 156 new RootWindowEventHandler(window_tree_host2.get())); |
157 | 157 |
158 std::vector<unsigned int> devices; | 158 std::vector<int> devices; |
159 devices.push_back(0); | 159 devices.push_back(0); |
160 ui::SetUpTouchDevicesForTest(devices); | 160 ui::SetUpTouchDevicesForTest(devices); |
161 std::vector<ui::Valuator> valuators; | 161 std::vector<ui::Valuator> valuators; |
162 | 162 |
163 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 163 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
164 EXPECT_EQ(-1, handler1->last_touch_id()); | 164 EXPECT_EQ(-1, handler1->last_touch_id()); |
165 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); | 165 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); |
166 EXPECT_EQ(-1, handler2->last_touch_id()); | 166 EXPECT_EQ(-1, handler2->last_touch_id()); |
167 | 167 |
168 // 2 Touch events are targeted at the second WindowTreeHost. | 168 // 2 Touch events are targeted at the second WindowTreeHost. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
245 EXPECT_EQ(1, handler2->last_touch_id()); | 245 EXPECT_EQ(1, handler2->last_touch_id()); |
246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); | 246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
247 | 247 |
248 handler1.reset(); | 248 handler1.reset(); |
249 handler2.reset(); | 249 handler2.reset(); |
250 } | 250 } |
251 | 251 |
252 } // namespace aura | 252 } // namespace aura |
OLD | NEW |