| 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" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/aura/test/aura_test_base.h" | 12 #include "ui/aura/test/aura_test_base.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/aura/window_tree_host_x11.h" |
| 15 #include "ui/events/event_processor.h" | 16 #include "ui/events/event_processor.h" |
| 16 #include "ui/events/event_target.h" | 17 #include "ui/events/event_target.h" |
| 17 #include "ui/events/event_target_iterator.h" | 18 #include "ui/events/event_target_iterator.h" |
| 18 #include "ui/events/test/events_test_utils_x11.h" | 19 #include "ui/events/test/events_test_utils_x11.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 class RootWindowEventHandler : public ui::EventHandler { | 23 class RootWindowEventHandler : public ui::EventHandler { |
| 23 public: | 24 public: |
| 24 explicit RootWindowEventHandler(aura::WindowTreeHost* host) | 25 explicit RootWindowEventHandler(aura::WindowTreeHost* host) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 int last_touch_id_; | 50 int last_touch_id_; |
| 50 gfx::Point last_touch_location_; | 51 gfx::Point last_touch_location_; |
| 51 | 52 |
| 52 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler); | 53 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace | 56 } // namespace |
| 56 | 57 |
| 57 namespace ash { | 58 namespace ash { |
| 58 | 59 |
| 59 typedef aura::test::AuraTestBase WindowTreeHostX11Test; | 60 typedef aura::test::AuraTestBase AshWindowTreeHostX11Test; |
| 60 | 61 |
| 61 // Send X touch events to one WindowTreeHost. The WindowTreeHost's | 62 // Send X touch events to one WindowTreeHost. The WindowTreeHost's |
| 62 // delegate will get corresponding ui::TouchEvent if the touch events | 63 // delegate will get corresponding ui::TouchEvent if the touch events |
| 63 // are winthin the bound of the WindowTreeHost. | 64 // are targeting this WindowTreeHost. |
| 64 TEST_F(WindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { | 65 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { |
| 65 // Fake a ChromeOS running env. | 66 // Fake a ChromeOS running env. |
| 66 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 67 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 67 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 68 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 68 | 69 |
| 69 scoped_ptr<AshWindowTreeHostX11> window_tree_host( | 70 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( |
| 70 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 71 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
| 71 window_tree_host->InitHost(); | 72 window_tree_host->InitHost(); |
| 73 ::Window target = DefaultRootWindow(gfx::GetXDisplay()); |
| 72 scoped_ptr<RootWindowEventHandler> handler( | 74 scoped_ptr<RootWindowEventHandler> handler( |
| 73 new RootWindowEventHandler(window_tree_host.get())); | 75 new RootWindowEventHandler(window_tree_host.get())); |
| 74 | 76 |
| 75 std::vector<unsigned int> devices; | 77 std::vector<unsigned int> devices; |
| 76 devices.push_back(0); | 78 devices.push_back(0); |
| 77 ui::SetUpTouchDevicesForTest(devices); | 79 ui::SetUpTouchDevicesForTest(devices); |
| 78 std::vector<ui::Valuator> valuators; | 80 std::vector<ui::Valuator> valuators; |
| 79 | 81 |
| 80 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 82 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| 81 EXPECT_EQ(-1, handler->last_touch_id()); | 83 EXPECT_EQ(-1, handler->last_touch_id()); |
| 82 | 84 |
| 83 ui::ScopedXI2Event scoped_xevent; | 85 ui::ScopedXI2Event scoped_xevent; |
| 84 // This touch is out of bounds. | 86 // This touch is out of bounds. |
| 85 scoped_xevent.InitTouchEvent( | 87 scoped_xevent.InitTouchEvent( |
| 86 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); | 88 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators, target); |
| 87 window_tree_host->DispatchEvent(scoped_xevent); | 89 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 90 window_tree_host->DispatchEvent(scoped_xevent); |
| 88 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 91 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| 89 EXPECT_EQ(-1, handler->last_touch_id()); | 92 EXPECT_EQ(-1, handler->last_touch_id()); |
| 90 EXPECT_EQ(gfx::Point(0, 0), handler->last_touch_location()); | 93 EXPECT_EQ(gfx::Point(0, 0), handler->last_touch_location()); |
| 91 | 94 |
| 92 // Following touchs are within bounds and are passed to delegate. | 95 // Following touchs are within bounds and are passed to delegate. |
| 93 scoped_xevent.InitTouchEvent( | 96 scoped_xevent.InitTouchEvent( |
| 94 0, XI_TouchBegin, 5, gfx::Point(1500, 1500), valuators); | 97 0, XI_TouchBegin, 5, gfx::Point(1500, 1500), valuators, target); |
| 95 window_tree_host->DispatchEvent(scoped_xevent); | 98 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 99 window_tree_host->DispatchEvent(scoped_xevent); |
| 96 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler->last_touch_type()); | 100 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler->last_touch_type()); |
| 97 EXPECT_EQ(0, handler->last_touch_id()); | 101 EXPECT_EQ(0, handler->last_touch_id()); |
| 98 EXPECT_EQ(gfx::Point(1500, 1500), handler->last_touch_location()); | 102 EXPECT_EQ(gfx::Point(1500, 1500), handler->last_touch_location()); |
| 99 | 103 |
| 100 scoped_xevent.InitTouchEvent( | 104 scoped_xevent.InitTouchEvent( |
| 101 0, XI_TouchUpdate, 5, gfx::Point(1500, 1600), valuators); | 105 0, XI_TouchUpdate, 5, gfx::Point(1500, 1600), valuators, target); |
| 102 window_tree_host->DispatchEvent(scoped_xevent); | 106 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 107 window_tree_host->DispatchEvent(scoped_xevent); |
| 103 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler->last_touch_type()); | 108 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler->last_touch_type()); |
| 104 EXPECT_EQ(0, handler->last_touch_id()); | 109 EXPECT_EQ(0, handler->last_touch_id()); |
| 105 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); | 110 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); |
| 106 | 111 |
| 107 scoped_xevent.InitTouchEvent( | 112 scoped_xevent.InitTouchEvent( |
| 108 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators); | 113 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators, target); |
| 109 window_tree_host->DispatchEvent(scoped_xevent); | 114 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 115 window_tree_host->DispatchEvent(scoped_xevent); |
| 110 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type()); | 116 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type()); |
| 111 EXPECT_EQ(0, handler->last_touch_id()); | 117 EXPECT_EQ(0, handler->last_touch_id()); |
| 112 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); | 118 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); |
| 113 | 119 |
| 114 handler.reset(); | 120 handler.reset(); |
| 115 | 121 |
| 116 // Revert the CrOS testing env otherwise the following non-CrOS aura | 122 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 117 // tests will fail. | 123 // tests will fail. |
| 118 // Fake a ChromeOS running env. | 124 // Fake a ChromeOS running env. |
| 119 kLsbRelease = ""; | 125 kLsbRelease = ""; |
| 120 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 126 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 121 } | 127 } |
| 122 | 128 |
| 123 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is | 129 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is |
| 124 // the event target of the X touch events should generate the corresponding | 130 // the event target of the X touch events should generate the corresponding |
| 125 // ui::TouchEvent for its delegate. | 131 // ui::TouchEvent for its delegate. |
| 126 TEST_F(WindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { | 132 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { |
| 127 // Fake a ChromeOS running env. | 133 // Fake a ChromeOS running env. |
| 128 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 134 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 129 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 135 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 130 | 136 |
| 131 scoped_ptr<AshWindowTreeHostX11> window_tree_host1( | 137 scoped_ptr<aura::WindowTreeHostX11> window_tree_host1( |
| 132 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 138 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
| 133 window_tree_host1->InitHost(); | 139 window_tree_host1->InitHost(); |
| 134 scoped_ptr<RootWindowEventHandler> handler1( | 140 scoped_ptr<RootWindowEventHandler> handler1( |
| 135 new RootWindowEventHandler(window_tree_host1.get())); | 141 new RootWindowEventHandler(window_tree_host1.get())); |
| 136 | 142 |
| 137 int host2_y_offset = 1700; | 143 int host2_y_offset = 1700; |
| 138 scoped_ptr<AshWindowTreeHostX11> window_tree_host2( | 144 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( |
| 139 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 145 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
| 140 window_tree_host2->InitHost(); | 146 window_tree_host2->InitHost(); |
| 141 scoped_ptr<RootWindowEventHandler> handler2( | 147 scoped_ptr<RootWindowEventHandler> handler2( |
| 142 new RootWindowEventHandler(window_tree_host2.get())); | 148 new RootWindowEventHandler(window_tree_host2.get())); |
| 143 | 149 |
| 150 ::Window target = DefaultRootWindow(gfx::GetXDisplay()); |
| 151 |
| 144 std::vector<unsigned int> devices; | 152 std::vector<unsigned int> devices; |
| 145 devices.push_back(0); | 153 devices.push_back(0); |
| 146 ui::SetUpTouchDevicesForTest(devices); | 154 ui::SetUpTouchDevicesForTest(devices); |
| 147 std::vector<ui::Valuator> valuators; | 155 std::vector<ui::Valuator> valuators; |
| 148 | 156 |
| 149 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 157 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 150 EXPECT_EQ(-1, handler1->last_touch_id()); | 158 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 151 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); | 159 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); |
| 152 EXPECT_EQ(-1, handler2->last_touch_id()); | 160 EXPECT_EQ(-1, handler2->last_touch_id()); |
| 153 | 161 |
| 154 // 2 Touch events are targeted at the second WindowTreeHost. | 162 // 2 Touch events are targeted at the second WindowTreeHost. |
| 155 ui::ScopedXI2Event scoped_xevent; | 163 ui::ScopedXI2Event scoped_xevent; |
| 156 scoped_xevent.InitTouchEvent( | 164 scoped_xevent.InitTouchEvent( |
| 157 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); | 165 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators, target); |
| 158 window_tree_host1->DispatchEvent(scoped_xevent); | 166 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 159 window_tree_host2->DispatchEvent(scoped_xevent); | 167 window_tree_host1->DispatchEvent(scoped_xevent); |
| 168 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 169 window_tree_host2->DispatchEvent(scoped_xevent); |
| 160 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 170 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 161 EXPECT_EQ(-1, handler1->last_touch_id()); | 171 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 162 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 172 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 163 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 173 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 164 EXPECT_EQ(0, handler2->last_touch_id()); | 174 EXPECT_EQ(0, handler2->last_touch_id()); |
| 165 EXPECT_EQ(gfx::Point(1500, 2500 - host2_y_offset), | 175 EXPECT_EQ(gfx::Point(1500, 2500), handler2->last_touch_location()); |
| 166 handler2->last_touch_location()); | |
| 167 | 176 |
| 168 scoped_xevent.InitTouchEvent( | 177 scoped_xevent.InitTouchEvent( |
| 169 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators); | 178 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators, target); |
| 170 window_tree_host1->DispatchEvent(scoped_xevent); | 179 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 171 window_tree_host2->DispatchEvent(scoped_xevent); | 180 window_tree_host1->DispatchEvent(scoped_xevent); |
| 181 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 182 window_tree_host2->DispatchEvent(scoped_xevent); |
| 172 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 183 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 173 EXPECT_EQ(-1, handler1->last_touch_id()); | 184 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 174 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 185 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 175 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 186 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 176 EXPECT_EQ(1, handler2->last_touch_id()); | 187 EXPECT_EQ(1, handler2->last_touch_id()); |
| 177 EXPECT_EQ(gfx::Point(1600, 2600 - host2_y_offset), | 188 EXPECT_EQ(gfx::Point(1600, 2600), handler2->last_touch_location()); |
| 178 handler2->last_touch_location()); | |
| 179 | 189 |
| 180 scoped_xevent.InitTouchEvent( | 190 scoped_xevent.InitTouchEvent( |
| 181 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators); | 191 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators, target); |
| 182 window_tree_host1->DispatchEvent(scoped_xevent); | 192 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 183 window_tree_host2->DispatchEvent(scoped_xevent); | 193 window_tree_host1->DispatchEvent(scoped_xevent); |
| 194 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 195 window_tree_host2->DispatchEvent(scoped_xevent); |
| 184 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 196 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 185 EXPECT_EQ(-1, handler1->last_touch_id()); | 197 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 186 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 198 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 187 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 199 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 188 EXPECT_EQ(0, handler2->last_touch_id()); | 200 EXPECT_EQ(0, handler2->last_touch_id()); |
| 189 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 201 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 190 handler2->last_touch_location()); | |
| 191 | 202 |
| 192 scoped_xevent.InitTouchEvent( | 203 scoped_xevent.InitTouchEvent( |
| 193 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators); | 204 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators, target); |
| 194 window_tree_host1->DispatchEvent(scoped_xevent); | 205 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 195 window_tree_host2->DispatchEvent(scoped_xevent); | 206 window_tree_host1->DispatchEvent(scoped_xevent); |
| 207 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 208 window_tree_host2->DispatchEvent(scoped_xevent); |
| 196 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 209 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 197 EXPECT_EQ(-1, handler1->last_touch_id()); | 210 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 198 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 211 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 199 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 212 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 200 EXPECT_EQ(1, handler2->last_touch_id()); | 213 EXPECT_EQ(1, handler2->last_touch_id()); |
| 201 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 214 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 202 handler2->last_touch_location()); | |
| 203 | 215 |
| 204 scoped_xevent.InitTouchEvent( | 216 scoped_xevent.InitTouchEvent( |
| 205 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators); | 217 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators, target); |
| 206 window_tree_host1->DispatchEvent(scoped_xevent); | 218 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 207 window_tree_host2->DispatchEvent(scoped_xevent); | 219 window_tree_host1->DispatchEvent(scoped_xevent); |
| 220 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 221 window_tree_host2->DispatchEvent(scoped_xevent); |
| 208 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 222 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 209 EXPECT_EQ(-1, handler1->last_touch_id()); | 223 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 210 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 224 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 211 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 225 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 212 EXPECT_EQ(0, handler2->last_touch_id()); | 226 EXPECT_EQ(0, handler2->last_touch_id()); |
| 213 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 227 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 214 handler2->last_touch_location()); | 228 |
| 215 scoped_xevent.InitTouchEvent( | 229 scoped_xevent.InitTouchEvent( |
| 216 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators); | 230 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators, target); |
| 217 window_tree_host1->DispatchEvent(scoped_xevent); | 231 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 218 window_tree_host2->DispatchEvent(scoped_xevent); | 232 window_tree_host1->DispatchEvent(scoped_xevent); |
| 233 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 234 window_tree_host2->DispatchEvent(scoped_xevent); |
| 219 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 235 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 220 EXPECT_EQ(-1, handler1->last_touch_id()); | 236 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 221 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 237 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 222 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 238 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 223 EXPECT_EQ(1, handler2->last_touch_id()); | 239 EXPECT_EQ(1, handler2->last_touch_id()); |
| 224 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 240 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 225 handler2->last_touch_location()); | |
| 226 | 241 |
| 227 handler1.reset(); | 242 handler1.reset(); |
| 228 handler2.reset(); | 243 handler2.reset(); |
| 229 | 244 |
| 230 // Revert the CrOS testing env otherwise the following non-CrOS aura | 245 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 231 // tests will fail. | 246 // tests will fail. |
| 232 // Fake a ChromeOS running env. | 247 // Fake a ChromeOS running env. |
| 233 kLsbRelease = ""; | 248 kLsbRelease = ""; |
| 234 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 249 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 235 } | 250 } |
| 236 | 251 |
| 237 } // namespace aura | 252 } // namespace aura |
| OLD | NEW |