| 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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "ui/aura/scoped_window_targeter.h" | 8 #include "ui/aura/scoped_window_targeter.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/events/event_handler.h" | 10 #include "ui/events/event_handler.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // Tests that touch event ids are released correctly. See | 290 // Tests that touch event ids are released correctly. See |
| 291 // crbug.com/439051 for details. When the ids aren't managed | 291 // crbug.com/439051 for details. When the ids aren't managed |
| 292 // correctly, we get stuck down touches. | 292 // correctly, we get stuck down touches. |
| 293 TEST_F(MenuControllerTest, TouchIdsReleasedCorrectly) { | 293 TEST_F(MenuControllerTest, TouchIdsReleasedCorrectly) { |
| 294 scoped_ptr<Widget> owner(CreateOwnerWidget()); | 294 scoped_ptr<Widget> owner(CreateOwnerWidget()); |
| 295 TestEventHandler test_event_handler; | 295 TestEventHandler test_event_handler; |
| 296 owner->GetNativeWindow()->GetRootWindow()->AddPreTargetHandler( | 296 owner->GetNativeWindow()->GetRootWindow()->AddPreTargetHandler( |
| 297 &test_event_handler); | 297 &test_event_handler); |
| 298 | 298 |
| 299 std::vector<unsigned int> devices; | 299 std::vector<int> devices; |
| 300 devices.push_back(1); | 300 devices.push_back(1); |
| 301 ui::SetUpTouchDevicesForTest(devices); | 301 ui::SetUpTouchDevicesForTest(devices); |
| 302 | 302 |
| 303 DispatchTouch(XI_TouchBegin, 0); | 303 DispatchTouch(XI_TouchBegin, 0); |
| 304 DispatchTouch(XI_TouchBegin, 1); | 304 DispatchTouch(XI_TouchBegin, 1); |
| 305 DispatchTouch(XI_TouchEnd, 0); | 305 DispatchTouch(XI_TouchEnd, 0); |
| 306 | 306 |
| 307 message_loop()->PostTask(FROM_HERE, | 307 message_loop()->PostTask(FROM_HERE, |
| 308 base::Bind(&MenuControllerTest::DispatchTouch, | 308 base::Bind(&MenuControllerTest::DispatchTouch, |
| 309 base::Unretained(this), XI_TouchEnd, 1)); | 309 base::Unretained(this), XI_TouchEnd, 1)); |
| 310 | 310 |
| 311 message_loop()->PostTask( | 311 message_loop()->PostTask( |
| 312 FROM_HERE, | 312 FROM_HERE, |
| 313 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, | 313 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, |
| 314 base::Unretained(this), MenuController::EXIT_OUTERMOST)); | 314 base::Unretained(this), MenuController::EXIT_OUTERMOST)); |
| 315 | 315 |
| 316 RunMenu(owner.get()); | 316 RunMenu(owner.get()); |
| 317 EXPECT_EQ(0, test_event_handler.outstanding_touches()); | 317 EXPECT_EQ(0, test_event_handler.outstanding_touches()); |
| 318 | 318 |
| 319 owner->GetNativeWindow()->GetRootWindow()->RemovePreTargetHandler( | 319 owner->GetNativeWindow()->GetRootWindow()->RemovePreTargetHandler( |
| 320 &test_event_handler); | 320 &test_event_handler); |
| 321 } | 321 } |
| 322 #endif // defined(USE_X11) | 322 #endif // defined(USE_X11) |
| 323 | 323 |
| 324 } // namespace views | 324 } // namespace views |
| OLD | NEW |