| 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(); |
| 72 scoped_ptr<RootWindowEventHandler> handler( | 73 scoped_ptr<RootWindowEventHandler> handler( |
| 73 new RootWindowEventHandler(window_tree_host.get())); | 74 new RootWindowEventHandler(window_tree_host.get())); |
| 74 | 75 |
| 75 std::vector<unsigned int> devices; | 76 std::vector<unsigned int> devices; |
| 76 devices.push_back(0); | 77 devices.push_back(0); |
| 77 ui::SetUpTouchDevicesForTest(devices); | 78 ui::SetUpTouchDevicesForTest(devices); |
| 78 std::vector<ui::Valuator> valuators; | 79 std::vector<ui::Valuator> valuators; |
| 79 | 80 |
| 80 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 81 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| 81 EXPECT_EQ(-1, handler->last_touch_id()); | 82 EXPECT_EQ(-1, handler->last_touch_id()); |
| 82 | 83 |
| 83 ui::ScopedXI2Event scoped_xevent; | 84 ui::ScopedXI2Event scoped_xevent; |
| 84 // This touch is out of bounds. | 85 // This touch is out of bounds. |
| 85 scoped_xevent.InitTouchEvent( | 86 scoped_xevent.InitTouchEvent( |
| 86 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); | 87 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); |
| 87 window_tree_host->DispatchEvent(scoped_xevent); | 88 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 89 window_tree_host->DispatchEvent(scoped_xevent); |
| 88 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 90 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| 89 EXPECT_EQ(-1, handler->last_touch_id()); | 91 EXPECT_EQ(-1, handler->last_touch_id()); |
| 90 EXPECT_EQ(gfx::Point(0, 0), handler->last_touch_location()); | 92 EXPECT_EQ(gfx::Point(0, 0), handler->last_touch_location()); |
| 91 | 93 |
| 92 // Following touchs are within bounds and are passed to delegate. | 94 // Following touchs are within bounds and are passed to delegate. |
| 93 scoped_xevent.InitTouchEvent( | 95 scoped_xevent.InitTouchEvent( |
| 94 0, XI_TouchBegin, 5, gfx::Point(1500, 1500), valuators); | 96 0, XI_TouchBegin, 5, gfx::Point(1500, 1500), valuators); |
| 95 window_tree_host->DispatchEvent(scoped_xevent); | 97 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 98 window_tree_host->DispatchEvent(scoped_xevent); |
| 96 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler->last_touch_type()); | 99 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler->last_touch_type()); |
| 97 EXPECT_EQ(0, handler->last_touch_id()); | 100 EXPECT_EQ(0, handler->last_touch_id()); |
| 98 EXPECT_EQ(gfx::Point(1500, 1500), handler->last_touch_location()); | 101 EXPECT_EQ(gfx::Point(1500, 1500), handler->last_touch_location()); |
| 99 | 102 |
| 100 scoped_xevent.InitTouchEvent( | 103 scoped_xevent.InitTouchEvent( |
| 101 0, XI_TouchUpdate, 5, gfx::Point(1500, 1600), valuators); | 104 0, XI_TouchUpdate, 5, gfx::Point(1500, 1600), valuators); |
| 102 window_tree_host->DispatchEvent(scoped_xevent); | 105 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 106 window_tree_host->DispatchEvent(scoped_xevent); |
| 103 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler->last_touch_type()); | 107 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler->last_touch_type()); |
| 104 EXPECT_EQ(0, handler->last_touch_id()); | 108 EXPECT_EQ(0, handler->last_touch_id()); |
| 105 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); | 109 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); |
| 106 | 110 |
| 107 scoped_xevent.InitTouchEvent( | 111 scoped_xevent.InitTouchEvent( |
| 108 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators); | 112 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators); |
| 109 window_tree_host->DispatchEvent(scoped_xevent); | 113 if (window_tree_host->CanDispatchEvent(scoped_xevent)) |
| 114 window_tree_host->DispatchEvent(scoped_xevent); |
| 110 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type()); | 115 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type()); |
| 111 EXPECT_EQ(0, handler->last_touch_id()); | 116 EXPECT_EQ(0, handler->last_touch_id()); |
| 112 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); | 117 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); |
| 113 | 118 |
| 114 handler.reset(); | 119 handler.reset(); |
| 115 | 120 |
| 116 // Revert the CrOS testing env otherwise the following non-CrOS aura | 121 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 117 // tests will fail. | 122 // tests will fail. |
| 118 // Fake a ChromeOS running env. | 123 // Fake a ChromeOS running env. |
| 119 kLsbRelease = ""; | 124 kLsbRelease = ""; |
| 120 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 125 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 121 } | 126 } |
| 122 | 127 |
| 123 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is | 128 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is |
| 124 // the event target of the X touch events should generate the corresponding | 129 // the event target of the X touch events should generate the corresponding |
| 125 // ui::TouchEvent for its delegate. | 130 // ui::TouchEvent for its delegate. |
| 126 TEST_F(WindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { | 131 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { |
| 127 // Fake a ChromeOS running env. | 132 // Fake a ChromeOS running env. |
| 128 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 133 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 129 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 134 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 130 | 135 |
| 131 scoped_ptr<AshWindowTreeHostX11> window_tree_host1( | 136 scoped_ptr<aura::WindowTreeHostX11> window_tree_host1( |
| 132 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 137 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); |
| 133 window_tree_host1->InitHost(); | 138 window_tree_host1->InitHost(); |
| 134 scoped_ptr<RootWindowEventHandler> handler1( | 139 scoped_ptr<RootWindowEventHandler> handler1( |
| 135 new RootWindowEventHandler(window_tree_host1.get())); | 140 new RootWindowEventHandler(window_tree_host1.get())); |
| 136 | 141 |
| 137 int host2_y_offset = 1700; | 142 int host2_y_offset = 1700; |
| 138 scoped_ptr<AshWindowTreeHostX11> window_tree_host2( | 143 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( |
| 139 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 144 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
| 140 window_tree_host2->InitHost(); | 145 window_tree_host2->InitHost(); |
| 141 scoped_ptr<RootWindowEventHandler> handler2( | 146 scoped_ptr<RootWindowEventHandler> handler2( |
| 142 new RootWindowEventHandler(window_tree_host2.get())); | 147 new RootWindowEventHandler(window_tree_host2.get())); |
| 143 | 148 |
| 144 std::vector<unsigned int> devices; | 149 std::vector<unsigned int> devices; |
| 145 devices.push_back(0); | 150 devices.push_back(0); |
| 146 ui::SetUpTouchDevicesForTest(devices); | 151 ui::SetUpTouchDevicesForTest(devices); |
| 147 std::vector<ui::Valuator> valuators; | 152 std::vector<ui::Valuator> valuators; |
| 148 | 153 |
| 149 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 154 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 150 EXPECT_EQ(-1, handler1->last_touch_id()); | 155 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 151 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); | 156 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); |
| 152 EXPECT_EQ(-1, handler2->last_touch_id()); | 157 EXPECT_EQ(-1, handler2->last_touch_id()); |
| 153 | 158 |
| 154 // 2 Touch events are targeted at the second WindowTreeHost. | 159 // 2 Touch events are targeted at the second WindowTreeHost. |
| 155 ui::ScopedXI2Event scoped_xevent; | 160 ui::ScopedXI2Event scoped_xevent; |
| 156 scoped_xevent.InitTouchEvent( | 161 scoped_xevent.InitTouchEvent( |
| 157 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); | 162 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); |
| 158 window_tree_host1->DispatchEvent(scoped_xevent); | 163 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 159 window_tree_host2->DispatchEvent(scoped_xevent); | 164 window_tree_host1->DispatchEvent(scoped_xevent); |
| 165 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 166 window_tree_host2->DispatchEvent(scoped_xevent); |
| 160 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 167 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 161 EXPECT_EQ(-1, handler1->last_touch_id()); | 168 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 162 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 169 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 163 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 170 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 164 EXPECT_EQ(0, handler2->last_touch_id()); | 171 EXPECT_EQ(0, handler2->last_touch_id()); |
| 165 EXPECT_EQ(gfx::Point(1500, 2500 - host2_y_offset), | 172 EXPECT_EQ(gfx::Point(1500, 2500), handler2->last_touch_location()); |
| 166 handler2->last_touch_location()); | |
| 167 | 173 |
| 168 scoped_xevent.InitTouchEvent( | 174 scoped_xevent.InitTouchEvent( |
| 169 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators); | 175 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators); |
| 170 window_tree_host1->DispatchEvent(scoped_xevent); | 176 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 171 window_tree_host2->DispatchEvent(scoped_xevent); | 177 window_tree_host1->DispatchEvent(scoped_xevent); |
| 178 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 179 window_tree_host2->DispatchEvent(scoped_xevent); |
| 172 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 180 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 173 EXPECT_EQ(-1, handler1->last_touch_id()); | 181 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 174 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 182 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 175 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 183 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 176 EXPECT_EQ(1, handler2->last_touch_id()); | 184 EXPECT_EQ(1, handler2->last_touch_id()); |
| 177 EXPECT_EQ(gfx::Point(1600, 2600 - host2_y_offset), | 185 EXPECT_EQ(gfx::Point(1600, 2600), handler2->last_touch_location()); |
| 178 handler2->last_touch_location()); | |
| 179 | 186 |
| 180 scoped_xevent.InitTouchEvent( | 187 scoped_xevent.InitTouchEvent( |
| 181 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators); | 188 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators); |
| 182 window_tree_host1->DispatchEvent(scoped_xevent); | 189 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 183 window_tree_host2->DispatchEvent(scoped_xevent); | 190 window_tree_host1->DispatchEvent(scoped_xevent); |
| 191 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 192 window_tree_host2->DispatchEvent(scoped_xevent); |
| 184 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 193 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 185 EXPECT_EQ(-1, handler1->last_touch_id()); | 194 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 186 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 195 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 187 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 196 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 188 EXPECT_EQ(0, handler2->last_touch_id()); | 197 EXPECT_EQ(0, handler2->last_touch_id()); |
| 189 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 198 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 190 handler2->last_touch_location()); | |
| 191 | 199 |
| 192 scoped_xevent.InitTouchEvent( | 200 scoped_xevent.InitTouchEvent( |
| 193 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators); | 201 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators); |
| 194 window_tree_host1->DispatchEvent(scoped_xevent); | 202 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 195 window_tree_host2->DispatchEvent(scoped_xevent); | 203 window_tree_host1->DispatchEvent(scoped_xevent); |
| 204 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 205 window_tree_host2->DispatchEvent(scoped_xevent); |
| 196 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 206 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 197 EXPECT_EQ(-1, handler1->last_touch_id()); | 207 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 198 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 208 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 199 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 209 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 200 EXPECT_EQ(1, handler2->last_touch_id()); | 210 EXPECT_EQ(1, handler2->last_touch_id()); |
| 201 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 211 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 202 handler2->last_touch_location()); | |
| 203 | 212 |
| 204 scoped_xevent.InitTouchEvent( | 213 scoped_xevent.InitTouchEvent( |
| 205 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators); | 214 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators); |
| 206 window_tree_host1->DispatchEvent(scoped_xevent); | 215 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 207 window_tree_host2->DispatchEvent(scoped_xevent); | 216 window_tree_host1->DispatchEvent(scoped_xevent); |
| 217 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 218 window_tree_host2->DispatchEvent(scoped_xevent); |
| 208 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 219 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 209 EXPECT_EQ(-1, handler1->last_touch_id()); | 220 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 210 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 221 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 211 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 222 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 212 EXPECT_EQ(0, handler2->last_touch_id()); | 223 EXPECT_EQ(0, handler2->last_touch_id()); |
| 213 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 224 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 214 handler2->last_touch_location()); | 225 |
| 215 scoped_xevent.InitTouchEvent( | 226 scoped_xevent.InitTouchEvent( |
| 216 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators); | 227 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators); |
| 217 window_tree_host1->DispatchEvent(scoped_xevent); | 228 if (window_tree_host1->CanDispatchEvent(scoped_xevent)) |
| 218 window_tree_host2->DispatchEvent(scoped_xevent); | 229 window_tree_host1->DispatchEvent(scoped_xevent); |
| 230 if (window_tree_host2->CanDispatchEvent(scoped_xevent)) |
| 231 window_tree_host2->DispatchEvent(scoped_xevent); |
| 219 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 232 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 220 EXPECT_EQ(-1, handler1->last_touch_id()); | 233 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 221 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 234 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 222 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 235 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 223 EXPECT_EQ(1, handler2->last_touch_id()); | 236 EXPECT_EQ(1, handler2->last_touch_id()); |
| 224 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 237 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 225 handler2->last_touch_location()); | |
| 226 | 238 |
| 227 handler1.reset(); | 239 handler1.reset(); |
| 228 handler2.reset(); | 240 handler2.reset(); |
| 229 | 241 |
| 230 // Revert the CrOS testing env otherwise the following non-CrOS aura | 242 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 231 // tests will fail. | 243 // tests will fail. |
| 232 // Fake a ChromeOS running env. | 244 // Fake a ChromeOS running env. |
| 233 kLsbRelease = ""; | 245 kLsbRelease = ""; |
| 234 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 246 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 235 } | 247 } |
| 236 | 248 |
| 237 } // namespace aura | 249 } // namespace aura |
| OLD | NEW |