| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 DispatchTouchEventToOneRootWindow | 91 DispatchTouchEventToOneRootWindow |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 // Send X touch events to one WindowTreeHost. The WindowTreeHost's | 94 // Send X touch events to one WindowTreeHost. The WindowTreeHost's |
| 95 // delegate will get corresponding ui::TouchEvent if the touch events | 95 // delegate will get corresponding ui::TouchEvent if the touch events |
| 96 // are targeting this WindowTreeHost. | 96 // are targeting this WindowTreeHost. |
| 97 TEST_F(AshWindowTreeHostX11Test, MAYBE_DispatchTouchEventToOneRootWindow) { | 97 TEST_F(AshWindowTreeHostX11Test, MAYBE_DispatchTouchEventToOneRootWindow) { |
| 98 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host( | 98 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host( |
| 99 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 99 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
| 100 window_tree_host->InitHost(); | 100 window_tree_host->InitHost(); |
| 101 window_tree_host->window()->Show(); |
| 101 std::unique_ptr<RootWindowEventHandler> handler( | 102 std::unique_ptr<RootWindowEventHandler> handler( |
| 102 new RootWindowEventHandler(window_tree_host.get())); | 103 new RootWindowEventHandler(window_tree_host.get())); |
| 103 | 104 |
| 104 std::vector<int> devices; | 105 std::vector<int> devices; |
| 105 devices.push_back(0); | 106 devices.push_back(0); |
| 106 ui::SetUpTouchDevicesForTest(devices); | 107 ui::SetUpTouchDevicesForTest(devices); |
| 107 std::vector<ui::Valuator> valuators; | 108 std::vector<ui::Valuator> valuators; |
| 108 | 109 |
| 109 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 110 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| 110 EXPECT_EQ(-1, handler->last_touch_id()); | 111 EXPECT_EQ(-1, handler->last_touch_id()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 handler.reset(); | 148 handler.reset(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is | 151 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is |
| 151 // the event target of the X touch events should generate the corresponding | 152 // the event target of the X touch events should generate the corresponding |
| 152 // ui::TouchEvent for its delegate. | 153 // ui::TouchEvent for its delegate. |
| 153 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { | 154 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { |
| 154 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host1( | 155 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host1( |
| 155 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 156 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
| 156 window_tree_host1->InitHost(); | 157 window_tree_host1->InitHost(); |
| 158 window_tree_host1->window()->Show(); |
| 157 std::unique_ptr<RootWindowEventHandler> handler1( | 159 std::unique_ptr<RootWindowEventHandler> handler1( |
| 158 new RootWindowEventHandler(window_tree_host1.get())); | 160 new RootWindowEventHandler(window_tree_host1.get())); |
| 159 | 161 |
| 160 int host2_y_offset = 1700; | 162 int host2_y_offset = 1700; |
| 161 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host2( | 163 std::unique_ptr<aura::WindowTreeHostX11> window_tree_host2( |
| 162 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 164 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
| 163 window_tree_host2->InitHost(); | 165 window_tree_host2->InitHost(); |
| 166 window_tree_host2->window()->Show(); |
| 164 std::unique_ptr<RootWindowEventHandler> handler2( | 167 std::unique_ptr<RootWindowEventHandler> handler2( |
| 165 new RootWindowEventHandler(window_tree_host2.get())); | 168 new RootWindowEventHandler(window_tree_host2.get())); |
| 166 | 169 |
| 167 std::vector<int> devices; | 170 std::vector<int> devices; |
| 168 devices.push_back(0); | 171 devices.push_back(0); |
| 169 ui::SetUpTouchDevicesForTest(devices); | 172 ui::SetUpTouchDevicesForTest(devices); |
| 170 std::vector<ui::Valuator> valuators; | 173 std::vector<ui::Valuator> valuators; |
| 171 | 174 |
| 172 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 175 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 173 EXPECT_EQ(-1, handler1->last_touch_id()); | 176 EXPECT_EQ(-1, handler1->last_touch_id()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 255 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 253 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 256 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 254 EXPECT_EQ(1, handler2->last_touch_id()); | 257 EXPECT_EQ(1, handler2->last_touch_id()); |
| 255 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); | 258 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 256 | 259 |
| 257 handler1.reset(); | 260 handler1.reset(); |
| 258 handler2.reset(); | 261 handler2.reset(); |
| 259 } | 262 } |
| 260 | 263 |
| 261 } // namespace aura | 264 } // namespace aura |
| OLD | NEW |