| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 ui::ScopedXI2Event scoped_xevent; | 155 ui::ScopedXI2Event scoped_xevent; |
| 156 scoped_xevent.InitTouchEvent( | 156 scoped_xevent.InitTouchEvent( |
| 157 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); | 157 0, XI_TouchBegin, 5, gfx::Point(1500, 2500), valuators); |
| 158 window_tree_host1->DispatchEvent(scoped_xevent); | 158 window_tree_host1->DispatchEvent(scoped_xevent); |
| 159 window_tree_host2->DispatchEvent(scoped_xevent); | 159 window_tree_host2->DispatchEvent(scoped_xevent); |
| 160 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 160 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 161 EXPECT_EQ(-1, handler1->last_touch_id()); | 161 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 162 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 162 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 163 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 163 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 164 EXPECT_EQ(0, handler2->last_touch_id()); | 164 EXPECT_EQ(0, handler2->last_touch_id()); |
| 165 EXPECT_EQ(gfx::Point(1500, 2500 - host2_y_offset), | 165 EXPECT_EQ(gfx::Point(1500, 2500), handler2->last_touch_location()); |
| 166 handler2->last_touch_location()); | |
| 167 | 166 |
| 168 scoped_xevent.InitTouchEvent( | 167 scoped_xevent.InitTouchEvent( |
| 169 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators); | 168 0, XI_TouchBegin, 6, gfx::Point(1600, 2600), valuators); |
| 170 window_tree_host1->DispatchEvent(scoped_xevent); | 169 window_tree_host1->DispatchEvent(scoped_xevent); |
| 171 window_tree_host2->DispatchEvent(scoped_xevent); | 170 window_tree_host2->DispatchEvent(scoped_xevent); |
| 172 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 171 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 173 EXPECT_EQ(-1, handler1->last_touch_id()); | 172 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 174 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 173 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 175 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); | 174 EXPECT_EQ(ui::ET_TOUCH_PRESSED, handler2->last_touch_type()); |
| 176 EXPECT_EQ(1, handler2->last_touch_id()); | 175 EXPECT_EQ(1, handler2->last_touch_id()); |
| 177 EXPECT_EQ(gfx::Point(1600, 2600 - host2_y_offset), | 176 EXPECT_EQ(gfx::Point(1600, 2600), handler2->last_touch_location()); |
| 178 handler2->last_touch_location()); | |
| 179 | 177 |
| 180 scoped_xevent.InitTouchEvent( | 178 scoped_xevent.InitTouchEvent( |
| 181 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators); | 179 0, XI_TouchUpdate, 5, gfx::Point(1500, 2550), valuators); |
| 182 window_tree_host1->DispatchEvent(scoped_xevent); | 180 window_tree_host1->DispatchEvent(scoped_xevent); |
| 183 window_tree_host2->DispatchEvent(scoped_xevent); | 181 window_tree_host2->DispatchEvent(scoped_xevent); |
| 184 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 182 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 185 EXPECT_EQ(-1, handler1->last_touch_id()); | 183 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 186 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 184 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 187 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 185 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 188 EXPECT_EQ(0, handler2->last_touch_id()); | 186 EXPECT_EQ(0, handler2->last_touch_id()); |
| 189 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 187 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 190 handler2->last_touch_location()); | |
| 191 | 188 |
| 192 scoped_xevent.InitTouchEvent( | 189 scoped_xevent.InitTouchEvent( |
| 193 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators); | 190 0, XI_TouchUpdate, 6, gfx::Point(1600, 2650), valuators); |
| 194 window_tree_host1->DispatchEvent(scoped_xevent); | 191 window_tree_host1->DispatchEvent(scoped_xevent); |
| 195 window_tree_host2->DispatchEvent(scoped_xevent); | 192 window_tree_host2->DispatchEvent(scoped_xevent); |
| 196 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 193 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 197 EXPECT_EQ(-1, handler1->last_touch_id()); | 194 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 198 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 195 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 199 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); | 196 EXPECT_EQ(ui::ET_TOUCH_MOVED, handler2->last_touch_type()); |
| 200 EXPECT_EQ(1, handler2->last_touch_id()); | 197 EXPECT_EQ(1, handler2->last_touch_id()); |
| 201 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 198 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 202 handler2->last_touch_location()); | |
| 203 | 199 |
| 204 scoped_xevent.InitTouchEvent( | 200 scoped_xevent.InitTouchEvent( |
| 205 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators); | 201 0, XI_TouchEnd, 5, gfx::Point(1500, 2550), valuators); |
| 206 window_tree_host1->DispatchEvent(scoped_xevent); | 202 window_tree_host1->DispatchEvent(scoped_xevent); |
| 207 window_tree_host2->DispatchEvent(scoped_xevent); | 203 window_tree_host2->DispatchEvent(scoped_xevent); |
| 208 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 204 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 209 EXPECT_EQ(-1, handler1->last_touch_id()); | 205 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 210 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 206 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 211 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 207 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 212 EXPECT_EQ(0, handler2->last_touch_id()); | 208 EXPECT_EQ(0, handler2->last_touch_id()); |
| 213 EXPECT_EQ(gfx::Point(1500, 2550 - host2_y_offset), | 209 EXPECT_EQ(gfx::Point(1500, 2550), handler2->last_touch_location()); |
| 214 handler2->last_touch_location()); | 210 |
| 215 scoped_xevent.InitTouchEvent( | 211 scoped_xevent.InitTouchEvent( |
| 216 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators); | 212 0, XI_TouchEnd, 6, gfx::Point(1600, 2650), valuators); |
| 217 window_tree_host1->DispatchEvent(scoped_xevent); | 213 window_tree_host1->DispatchEvent(scoped_xevent); |
| 218 window_tree_host2->DispatchEvent(scoped_xevent); | 214 window_tree_host2->DispatchEvent(scoped_xevent); |
| 219 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 215 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| 220 EXPECT_EQ(-1, handler1->last_touch_id()); | 216 EXPECT_EQ(-1, handler1->last_touch_id()); |
| 221 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 217 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
| 222 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 218 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
| 223 EXPECT_EQ(1, handler2->last_touch_id()); | 219 EXPECT_EQ(1, handler2->last_touch_id()); |
| 224 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), | 220 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
| 225 handler2->last_touch_location()); | |
| 226 | 221 |
| 227 handler1.reset(); | 222 handler1.reset(); |
| 228 handler2.reset(); | 223 handler2.reset(); |
| 229 | 224 |
| 230 // Revert the CrOS testing env otherwise the following non-CrOS aura | 225 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 231 // tests will fail. | 226 // tests will fail. |
| 232 // Fake a ChromeOS running env. | 227 // Fake a ChromeOS running env. |
| 233 kLsbRelease = ""; | 228 kLsbRelease = ""; |
| 234 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 229 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 235 } | 230 } |
| 236 | 231 |
| 237 } // namespace aura | 232 } // namespace aura |
| OLD | NEW |