OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 DISALLOW_COPY_AND_ASSIGN(TestEventClient); | 283 DISALLOW_COPY_AND_ASSIGN(TestEventClient); |
284 }; | 284 }; |
285 | 285 |
286 } // namespace | 286 } // namespace |
287 | 287 |
288 TEST_F(WindowEventDispatcherTest, CanProcessEventsWithinSubtree) { | 288 TEST_F(WindowEventDispatcherTest, CanProcessEventsWithinSubtree) { |
289 TestEventClient client(root_window()); | 289 TestEventClient client(root_window()); |
290 test::TestWindowDelegate d; | 290 test::TestWindowDelegate d; |
291 | 291 |
292 ui::test::TestEventHandler* nonlock_ef = new ui::test::TestEventHandler; | 292 ui::test::TestEventHandler nonlock_ef; |
293 ui::test::TestEventHandler* lock_ef = new ui::test::TestEventHandler; | 293 ui::test::TestEventHandler lock_ef; |
294 client.GetNonLockWindow()->SetEventFilter(nonlock_ef); | 294 client.GetNonLockWindow()->AddPreTargetHandler(&nonlock_ef); |
295 client.GetLockWindow()->SetEventFilter(lock_ef); | 295 client.GetLockWindow()->AddPreTargetHandler(&lock_ef); |
296 | 296 |
297 Window* w1 = test::CreateTestWindowWithBounds(gfx::Rect(10, 10, 20, 20), | 297 Window* w1 = test::CreateTestWindowWithBounds(gfx::Rect(10, 10, 20, 20), |
298 client.GetNonLockWindow()); | 298 client.GetNonLockWindow()); |
299 w1->set_id(1); | 299 w1->set_id(1); |
300 Window* w2 = test::CreateTestWindowWithBounds(gfx::Rect(30, 30, 20, 20), | 300 Window* w2 = test::CreateTestWindowWithBounds(gfx::Rect(30, 30, 20, 20), |
301 client.GetNonLockWindow()); | 301 client.GetNonLockWindow()); |
302 w2->set_id(2); | 302 w2->set_id(2); |
303 scoped_ptr<Window> w3( | 303 scoped_ptr<Window> w3( |
304 test::CreateTestWindowWithDelegate(&d, 3, gfx::Rect(30, 30, 20, 20), | 304 test::CreateTestWindowWithDelegate(&d, 3, gfx::Rect(30, 30, 20, 20), |
305 client.GetLockWindow())); | 305 client.GetLockWindow())); |
(...skipping 15 matching lines...) Expand all Loading... |
321 generator.PressKey(ui::VKEY_SPACE, 0); | 321 generator.PressKey(ui::VKEY_SPACE, 0); |
322 EXPECT_EQ(NULL, client::GetFocusClient(w1)->GetFocusedWindow()); | 322 EXPECT_EQ(NULL, client::GetFocusClient(w1)->GetFocusedWindow()); |
323 EXPECT_FALSE(IsFocusedWindow(w1)); | 323 EXPECT_FALSE(IsFocusedWindow(w1)); |
324 } | 324 } |
325 | 325 |
326 { | 326 { |
327 // Events sent to a window not in the lock container will not be processed. | 327 // Events sent to a window not in the lock container will not be processed. |
328 // i.e. never sent to the non-lock container's event filter. | 328 // i.e. never sent to the non-lock container's event filter. |
329 test::EventGenerator generator(root_window(), w1); | 329 test::EventGenerator generator(root_window(), w1); |
330 generator.ClickLeftButton(); | 330 generator.ClickLeftButton(); |
331 EXPECT_EQ(0, nonlock_ef->num_mouse_events()); | 331 EXPECT_EQ(0, nonlock_ef.num_mouse_events()); |
332 | 332 |
333 // Events sent to a window in the lock container will be processed. | 333 // Events sent to a window in the lock container will be processed. |
334 test::EventGenerator generator3(root_window(), w3.get()); | 334 test::EventGenerator generator3(root_window(), w3.get()); |
335 generator3.PressLeftButton(); | 335 generator3.PressLeftButton(); |
336 EXPECT_EQ(1, lock_ef->num_mouse_events()); | 336 EXPECT_EQ(1, lock_ef.num_mouse_events()); |
337 } | 337 } |
338 | 338 |
339 // Prevent w3 from being deleted by the hierarchy since its delegate is owned | 339 // Prevent w3 from being deleted by the hierarchy since its delegate is owned |
340 // by this scope. | 340 // by this scope. |
341 w3->parent()->RemoveChild(w3.get()); | 341 w3->parent()->RemoveChild(w3.get()); |
342 } | 342 } |
343 | 343 |
344 TEST_F(WindowEventDispatcherTest, IgnoreUnknownKeys) { | 344 TEST_F(WindowEventDispatcherTest, IgnoreUnknownKeys) { |
345 ui::test::TestEventHandler* filter = new ConsumeKeyHandler; | 345 ConsumeKeyHandler handler; |
346 root_window()->SetEventFilter(filter); // passes ownership | 346 root_window()->AddPreTargetHandler(&handler); |
347 | 347 |
348 ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 0, false); | 348 ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 0, false); |
349 DispatchEventUsingWindowDispatcher(&unknown_event); | 349 DispatchEventUsingWindowDispatcher(&unknown_event); |
350 EXPECT_FALSE(unknown_event.handled()); | 350 EXPECT_FALSE(unknown_event.handled()); |
351 EXPECT_EQ(0, filter->num_key_events()); | 351 EXPECT_EQ(0, handler.num_key_events()); |
352 | 352 |
353 ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); | 353 ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); |
354 DispatchEventUsingWindowDispatcher(&known_event); | 354 DispatchEventUsingWindowDispatcher(&known_event); |
355 EXPECT_TRUE(known_event.handled()); | 355 EXPECT_TRUE(known_event.handled()); |
356 EXPECT_EQ(1, filter->num_key_events()); | 356 EXPECT_EQ(1, handler.num_key_events()); |
357 } | 357 } |
358 | 358 |
359 TEST_F(WindowEventDispatcherTest, NoDelegateWindowReceivesKeyEvents) { | 359 TEST_F(WindowEventDispatcherTest, NoDelegateWindowReceivesKeyEvents) { |
360 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); | 360 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); |
361 w1->Show(); | 361 w1->Show(); |
362 w1->Focus(); | 362 w1->Focus(); |
363 | 363 |
364 ui::test::TestEventHandler handler; | 364 ui::test::TestEventHandler handler; |
365 w1->AddPreTargetHandler(&handler); | 365 w1->AddPreTargetHandler(&handler); |
366 ui::KeyEvent key_press(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); | 366 ui::KeyEvent key_press(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); |
367 DispatchEventUsingWindowDispatcher(&key_press); | 367 DispatchEventUsingWindowDispatcher(&key_press); |
368 EXPECT_TRUE(key_press.handled()); | 368 EXPECT_TRUE(key_press.handled()); |
369 EXPECT_EQ(1, handler.num_key_events()); | 369 EXPECT_EQ(1, handler.num_key_events()); |
370 | 370 |
371 w1->RemovePreTargetHandler(&handler); | 371 w1->RemovePreTargetHandler(&handler); |
372 } | 372 } |
373 | 373 |
374 // Tests that touch-events that are beyond the bounds of the root-window do get | 374 // Tests that touch-events that are beyond the bounds of the root-window do get |
375 // propagated to the event filters correctly with the root as the target. | 375 // propagated to the event filters correctly with the root as the target. |
376 TEST_F(WindowEventDispatcherTest, TouchEventsOutsideBounds) { | 376 TEST_F(WindowEventDispatcherTest, TouchEventsOutsideBounds) { |
377 ui::test::TestEventHandler* filter = new ui::test::TestEventHandler; | 377 ui::test::TestEventHandler handler; |
378 root_window()->SetEventFilter(filter); // passes ownership | 378 root_window()->AddPreTargetHandler(&handler); |
379 | 379 |
380 gfx::Point position = root_window()->bounds().origin(); | 380 gfx::Point position = root_window()->bounds().origin(); |
381 position.Offset(-10, -10); | 381 position.Offset(-10, -10); |
382 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); | 382 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); |
383 DispatchEventUsingWindowDispatcher(&press); | 383 DispatchEventUsingWindowDispatcher(&press); |
384 EXPECT_EQ(1, filter->num_touch_events()); | 384 EXPECT_EQ(1, handler.num_touch_events()); |
385 | 385 |
386 position = root_window()->bounds().origin(); | 386 position = root_window()->bounds().origin(); |
387 position.Offset(root_window()->bounds().width() + 10, | 387 position.Offset(root_window()->bounds().width() + 10, |
388 root_window()->bounds().height() + 10); | 388 root_window()->bounds().height() + 10); |
389 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, position, 0, base::TimeDelta()); | 389 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, position, 0, base::TimeDelta()); |
390 DispatchEventUsingWindowDispatcher(&release); | 390 DispatchEventUsingWindowDispatcher(&release); |
391 EXPECT_EQ(2, filter->num_touch_events()); | 391 EXPECT_EQ(2, handler.num_touch_events()); |
392 } | 392 } |
393 | 393 |
394 // Tests that scroll events are dispatched correctly. | 394 // Tests that scroll events are dispatched correctly. |
395 TEST_F(WindowEventDispatcherTest, ScrollEventDispatch) { | 395 TEST_F(WindowEventDispatcherTest, ScrollEventDispatch) { |
396 base::TimeDelta now = ui::EventTimeForNow(); | 396 base::TimeDelta now = ui::EventTimeForNow(); |
397 ui::test::TestEventHandler* filter = new ui::test::TestEventHandler; | 397 ui::test::TestEventHandler handler; |
398 root_window()->SetEventFilter(filter); | 398 root_window()->AddPreTargetHandler(&handler); |
399 | 399 |
400 test::TestWindowDelegate delegate; | 400 test::TestWindowDelegate delegate; |
401 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), &delegate)); | 401 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), &delegate)); |
402 w1->SetBounds(gfx::Rect(20, 20, 40, 40)); | 402 w1->SetBounds(gfx::Rect(20, 20, 40, 40)); |
403 | 403 |
404 // A scroll event on the root-window itself is dispatched. | 404 // A scroll event on the root-window itself is dispatched. |
405 ui::ScrollEvent scroll1(ui::ET_SCROLL, | 405 ui::ScrollEvent scroll1(ui::ET_SCROLL, |
406 gfx::Point(10, 10), | 406 gfx::Point(10, 10), |
407 now, | 407 now, |
408 0, | 408 0, |
409 0, -10, | 409 0, -10, |
410 0, -10, | 410 0, -10, |
411 2); | 411 2); |
412 DispatchEventUsingWindowDispatcher(&scroll1); | 412 DispatchEventUsingWindowDispatcher(&scroll1); |
413 EXPECT_EQ(1, filter->num_scroll_events()); | 413 EXPECT_EQ(1, handler.num_scroll_events()); |
414 | 414 |
415 // Scroll event on a window should be dispatched properly. | 415 // Scroll event on a window should be dispatched properly. |
416 ui::ScrollEvent scroll2(ui::ET_SCROLL, | 416 ui::ScrollEvent scroll2(ui::ET_SCROLL, |
417 gfx::Point(25, 30), | 417 gfx::Point(25, 30), |
418 now, | 418 now, |
419 0, | 419 0, |
420 -10, 0, | 420 -10, 0, |
421 -10, 0, | 421 -10, 0, |
422 2); | 422 2); |
423 DispatchEventUsingWindowDispatcher(&scroll2); | 423 DispatchEventUsingWindowDispatcher(&scroll2); |
424 EXPECT_EQ(2, filter->num_scroll_events()); | 424 EXPECT_EQ(2, handler.num_scroll_events()); |
| 425 root_window()->RemovePreTargetHandler(&handler); |
425 } | 426 } |
426 | 427 |
427 namespace { | 428 namespace { |
428 | 429 |
429 // FilterFilter that tracks the types of events it's seen. | 430 // FilterFilter that tracks the types of events it's seen. |
430 class EventFilterRecorder : public ui::EventHandler { | 431 class EventFilterRecorder : public ui::EventHandler { |
431 public: | 432 public: |
432 typedef std::vector<ui::EventType> Events; | 433 typedef std::vector<ui::EventType> Events; |
433 typedef std::vector<gfx::Point> EventLocations; | 434 typedef std::vector<gfx::Point> EventLocations; |
434 typedef std::vector<int> EventFlags; | 435 typedef std::vector<int> EventFlags; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 584 |
584 } // namespace | 585 } // namespace |
585 | 586 |
586 // Verifies a repost mouse event targets the window with capture (if there is | 587 // Verifies a repost mouse event targets the window with capture (if there is |
587 // one). | 588 // one). |
588 TEST_F(WindowEventDispatcherTest, RepostTargetsCaptureWindow) { | 589 TEST_F(WindowEventDispatcherTest, RepostTargetsCaptureWindow) { |
589 // Set capture on |window| generate a mouse event (that is reposted) and not | 590 // Set capture on |window| generate a mouse event (that is reposted) and not |
590 // over |window| and verify |window| gets it (|window| gets it because it has | 591 // over |window| and verify |window| gets it (|window| gets it because it has |
591 // capture). | 592 // capture). |
592 EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); | 593 EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); |
| 594 EventFilterRecorder recorder; |
593 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), NULL)); | 595 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), NULL)); |
594 window->SetBounds(gfx::Rect(20, 20, 40, 30)); | 596 window->SetBounds(gfx::Rect(20, 20, 40, 30)); |
595 EventFilterRecorder* recorder = new EventFilterRecorder; | 597 window->AddPreTargetHandler(&recorder); |
596 window->SetEventFilter(recorder); // Takes ownership. | |
597 window->SetCapture(); | 598 window->SetCapture(); |
598 const ui::MouseEvent press_event( | 599 const ui::MouseEvent press_event( |
599 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 600 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
600 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 601 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
601 host()->dispatcher()->RepostEvent(press_event); | 602 host()->dispatcher()->RepostEvent(press_event); |
602 RunAllPendingInMessageLoop(); // Necessitated by RepostEvent(). | 603 RunAllPendingInMessageLoop(); // Necessitated by RepostEvent(). |
603 // Mouse moves/enters may be generated. We only care about a pressed. | 604 // Mouse moves/enters may be generated. We only care about a pressed. |
604 EXPECT_TRUE(EventTypesToString(recorder->events()).find("MOUSE_PRESSED") != | 605 EXPECT_TRUE(EventTypesToString(recorder.events()).find("MOUSE_PRESSED") != |
605 std::string::npos) << EventTypesToString(recorder->events()); | 606 std::string::npos) << EventTypesToString(recorder.events()); |
606 } | 607 } |
607 | 608 |
608 TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { | 609 TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
609 EventFilterRecorder* filter = new EventFilterRecorder; | 610 EventFilterRecorder recorder; |
610 root_window()->SetEventFilter(filter); // passes ownership | 611 root_window()->AddPreTargetHandler(&recorder); |
611 | 612 |
612 test::TestWindowDelegate delegate; | 613 test::TestWindowDelegate delegate; |
613 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 614 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
614 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 615 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
615 | 616 |
616 ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), | 617 ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), |
617 gfx::Point(0, 0), 0, 0); | 618 gfx::Point(0, 0), 0, 0); |
618 DispatchEventUsingWindowDispatcher(&mouse_move_event); | 619 DispatchEventUsingWindowDispatcher(&mouse_move_event); |
619 // Discard MOUSE_ENTER. | 620 // Discard MOUSE_ENTER. |
620 filter->Reset(); | 621 recorder.Reset(); |
621 | 622 |
622 host()->dispatcher()->HoldPointerMoves(); | 623 host()->dispatcher()->HoldPointerMoves(); |
623 | 624 |
624 // Check that we don't immediately dispatch the MOUSE_DRAGGED event. | 625 // Check that we don't immediately dispatch the MOUSE_DRAGGED event. |
625 ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), | 626 ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), |
626 gfx::Point(0, 0), 0, 0); | 627 gfx::Point(0, 0), 0, 0); |
627 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 628 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
628 EXPECT_TRUE(filter->events().empty()); | 629 EXPECT_TRUE(recorder.events().empty()); |
629 | 630 |
630 // Check that we do dispatch the held MOUSE_DRAGGED event before another type | 631 // Check that we do dispatch the held MOUSE_DRAGGED event before another type |
631 // of event. | 632 // of event. |
632 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), | 633 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), |
633 gfx::Point(0, 0), 0, 0); | 634 gfx::Point(0, 0), 0, 0); |
634 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); | 635 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
635 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", | 636 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
636 EventTypesToString(filter->events())); | 637 EventTypesToString(recorder.events())); |
637 filter->Reset(); | 638 recorder.Reset(); |
638 | 639 |
639 // Check that we coalesce held MOUSE_DRAGGED events. | 640 // Check that we coalesce held MOUSE_DRAGGED events. |
640 ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), | 641 ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), |
641 gfx::Point(10, 10), 0, 0); | 642 gfx::Point(10, 10), 0, 0); |
642 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 643 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
643 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); | 644 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
644 EXPECT_TRUE(filter->events().empty()); | 645 EXPECT_TRUE(recorder.events().empty()); |
645 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); | 646 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
646 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", | 647 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
647 EventTypesToString(filter->events())); | 648 EventTypesToString(recorder.events())); |
648 filter->Reset(); | 649 recorder.Reset(); |
649 | 650 |
650 // Check that on ReleasePointerMoves, held events are not dispatched | 651 // Check that on ReleasePointerMoves, held events are not dispatched |
651 // immediately, but posted instead. | 652 // immediately, but posted instead. |
652 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 653 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
653 host()->dispatcher()->ReleasePointerMoves(); | 654 host()->dispatcher()->ReleasePointerMoves(); |
654 EXPECT_TRUE(filter->events().empty()); | 655 EXPECT_TRUE(recorder.events().empty()); |
655 RunAllPendingInMessageLoop(); | 656 RunAllPendingInMessageLoop(); |
656 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events())); | 657 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(recorder.events())); |
657 filter->Reset(); | 658 recorder.Reset(); |
658 | 659 |
659 // However if another message comes in before the dispatch of the posted | 660 // However if another message comes in before the dispatch of the posted |
660 // event, check that the posted event is dispatched before this new event. | 661 // event, check that the posted event is dispatched before this new event. |
661 host()->dispatcher()->HoldPointerMoves(); | 662 host()->dispatcher()->HoldPointerMoves(); |
662 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 663 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
663 host()->dispatcher()->ReleasePointerMoves(); | 664 host()->dispatcher()->ReleasePointerMoves(); |
664 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); | 665 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
665 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", | 666 EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
666 EventTypesToString(filter->events())); | 667 EventTypesToString(recorder.events())); |
667 filter->Reset(); | 668 recorder.Reset(); |
668 RunAllPendingInMessageLoop(); | 669 RunAllPendingInMessageLoop(); |
669 EXPECT_TRUE(filter->events().empty()); | 670 EXPECT_TRUE(recorder.events().empty()); |
670 | 671 |
671 // Check that if the other message is another MOUSE_DRAGGED, we still coalesce | 672 // Check that if the other message is another MOUSE_DRAGGED, we still coalesce |
672 // them. | 673 // them. |
673 host()->dispatcher()->HoldPointerMoves(); | 674 host()->dispatcher()->HoldPointerMoves(); |
674 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 675 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
675 host()->dispatcher()->ReleasePointerMoves(); | 676 host()->dispatcher()->ReleasePointerMoves(); |
676 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); | 677 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
677 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events())); | 678 EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(recorder.events())); |
678 filter->Reset(); | 679 recorder.Reset(); |
679 RunAllPendingInMessageLoop(); | 680 RunAllPendingInMessageLoop(); |
680 EXPECT_TRUE(filter->events().empty()); | 681 EXPECT_TRUE(recorder.events().empty()); |
681 | 682 |
682 // Check that synthetic mouse move event has a right location when issued | 683 // Check that synthetic mouse move event has a right location when issued |
683 // while holding pointer moves. | 684 // while holding pointer moves. |
684 ui::MouseEvent mouse_dragged_event3(ui::ET_MOUSE_DRAGGED, gfx::Point(28, 28), | 685 ui::MouseEvent mouse_dragged_event3(ui::ET_MOUSE_DRAGGED, gfx::Point(28, 28), |
685 gfx::Point(28, 28), 0, 0); | 686 gfx::Point(28, 28), 0, 0); |
686 host()->dispatcher()->HoldPointerMoves(); | 687 host()->dispatcher()->HoldPointerMoves(); |
687 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); | 688 DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
688 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); | 689 DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
689 window->SetBounds(gfx::Rect(15, 15, 80, 80)); | 690 window->SetBounds(gfx::Rect(15, 15, 80, 80)); |
690 DispatchEventUsingWindowDispatcher(&mouse_dragged_event3); | 691 DispatchEventUsingWindowDispatcher(&mouse_dragged_event3); |
691 RunAllPendingInMessageLoop(); | 692 RunAllPendingInMessageLoop(); |
692 EXPECT_TRUE(filter->events().empty()); | 693 EXPECT_TRUE(recorder.events().empty()); |
693 host()->dispatcher()->ReleasePointerMoves(); | 694 host()->dispatcher()->ReleasePointerMoves(); |
694 RunAllPendingInMessageLoop(); | 695 RunAllPendingInMessageLoop(); |
695 EXPECT_EQ("MOUSE_MOVED", EventTypesToString(filter->events())); | 696 EXPECT_EQ("MOUSE_MOVED", EventTypesToString(recorder.events())); |
696 EXPECT_EQ(gfx::Point(13, 13), filter->mouse_location(0)); | 697 EXPECT_EQ(gfx::Point(13, 13), recorder.mouse_location(0)); |
697 filter->Reset(); | 698 recorder.Reset(); |
| 699 root_window()->RemovePreTargetHandler(&recorder); |
698 } | 700 } |
699 | 701 |
700 TEST_F(WindowEventDispatcherTest, TouchMovesHeld) { | 702 TEST_F(WindowEventDispatcherTest, TouchMovesHeld) { |
701 EventFilterRecorder* filter = new EventFilterRecorder; | 703 EventFilterRecorder recorder; |
702 root_window()->SetEventFilter(filter); // passes ownership | 704 root_window()->AddPreTargetHandler(&recorder); |
703 | 705 |
704 test::TestWindowDelegate delegate; | 706 test::TestWindowDelegate delegate; |
705 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 707 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
706 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 708 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
707 | 709 |
708 const gfx::Point touch_location(60, 60); | 710 const gfx::Point touch_location(60, 60); |
709 // Starting the touch and throwing out the first few events, since the system | 711 // Starting the touch and throwing out the first few events, since the system |
710 // is going to generate synthetic mouse events that are not relevant to the | 712 // is going to generate synthetic mouse events that are not relevant to the |
711 // test. | 713 // test. |
712 ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, touch_location, | 714 ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, touch_location, |
713 0, base::TimeDelta()); | 715 0, base::TimeDelta()); |
714 DispatchEventUsingWindowDispatcher(&touch_pressed_event); | 716 DispatchEventUsingWindowDispatcher(&touch_pressed_event); |
715 filter->WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS); | 717 recorder.WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS); |
716 filter->Reset(); | 718 recorder.Reset(); |
717 | 719 |
718 host()->dispatcher()->HoldPointerMoves(); | 720 host()->dispatcher()->HoldPointerMoves(); |
719 | 721 |
720 // Check that we don't immediately dispatch the TOUCH_MOVED event. | 722 // Check that we don't immediately dispatch the TOUCH_MOVED event. |
721 ui::TouchEvent touch_moved_event(ui::ET_TOUCH_MOVED, touch_location, | 723 ui::TouchEvent touch_moved_event(ui::ET_TOUCH_MOVED, touch_location, |
722 0, base::TimeDelta()); | 724 0, base::TimeDelta()); |
723 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 725 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
724 EXPECT_TRUE(filter->events().empty()); | 726 EXPECT_TRUE(recorder.events().empty()); |
725 | 727 |
726 // Check that on ReleasePointerMoves, held events are not dispatched | 728 // Check that on ReleasePointerMoves, held events are not dispatched |
727 // immediately, but posted instead. | 729 // immediately, but posted instead. |
728 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 730 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
729 host()->dispatcher()->ReleasePointerMoves(); | 731 host()->dispatcher()->ReleasePointerMoves(); |
730 EXPECT_TRUE(filter->events().empty()); | 732 EXPECT_TRUE(recorder.events().empty()); |
731 | 733 |
732 RunAllPendingInMessageLoop(); | 734 RunAllPendingInMessageLoop(); |
733 EXPECT_EQ("TOUCH_MOVED", EventTypesToString(filter->events())); | 735 EXPECT_EQ("TOUCH_MOVED", EventTypesToString(recorder.events())); |
734 filter->Reset(); | 736 recorder.Reset(); |
735 | 737 |
736 // If another touch event occurs then the held touch should be dispatched | 738 // If another touch event occurs then the held touch should be dispatched |
737 // immediately before it. | 739 // immediately before it. |
738 ui::TouchEvent touch_released_event(ui::ET_TOUCH_RELEASED, touch_location, | 740 ui::TouchEvent touch_released_event(ui::ET_TOUCH_RELEASED, touch_location, |
739 0, base::TimeDelta()); | 741 0, base::TimeDelta()); |
740 filter->Reset(); | 742 recorder.Reset(); |
741 host()->dispatcher()->HoldPointerMoves(); | 743 host()->dispatcher()->HoldPointerMoves(); |
742 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 744 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
743 DispatchEventUsingWindowDispatcher(&touch_released_event); | 745 DispatchEventUsingWindowDispatcher(&touch_released_event); |
744 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP_CANCEL GESTURE_END", | 746 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP_CANCEL GESTURE_END", |
745 EventTypesToString(filter->events())); | 747 EventTypesToString(recorder.events())); |
746 filter->Reset(); | 748 recorder.Reset(); |
747 host()->dispatcher()->ReleasePointerMoves(); | 749 host()->dispatcher()->ReleasePointerMoves(); |
748 RunAllPendingInMessageLoop(); | 750 RunAllPendingInMessageLoop(); |
749 EXPECT_TRUE(filter->events().empty()); | 751 EXPECT_TRUE(recorder.events().empty()); |
750 } | 752 } |
751 | 753 |
752 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { | 754 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { |
753 public: | 755 public: |
754 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, | 756 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, |
755 EventFilterRecorder* filter) | 757 EventFilterRecorder* filter) |
756 : dispatcher_(dispatcher), | 758 : dispatcher_(dispatcher), |
757 filter_(filter), | 759 filter_(filter), |
758 holding_moves_(false) { | 760 holding_moves_(false) { |
759 } | 761 } |
(...skipping 15 matching lines...) Expand all Loading... |
775 WindowEventDispatcher* dispatcher_; | 777 WindowEventDispatcher* dispatcher_; |
776 EventFilterRecorder* filter_; | 778 EventFilterRecorder* filter_; |
777 bool holding_moves_; | 779 bool holding_moves_; |
778 | 780 |
779 DISALLOW_COPY_AND_ASSIGN(HoldPointerOnScrollHandler); | 781 DISALLOW_COPY_AND_ASSIGN(HoldPointerOnScrollHandler); |
780 }; | 782 }; |
781 | 783 |
782 // Tests that touch-move events don't contribute to an in-progress scroll | 784 // Tests that touch-move events don't contribute to an in-progress scroll |
783 // gesture if touch-move events are being held by the dispatcher. | 785 // gesture if touch-move events are being held by the dispatcher. |
784 TEST_F(WindowEventDispatcherTest, TouchMovesHeldOnScroll) { | 786 TEST_F(WindowEventDispatcherTest, TouchMovesHeldOnScroll) { |
785 EventFilterRecorder* filter = new EventFilterRecorder; | 787 EventFilterRecorder recorder; |
786 root_window()->SetEventFilter(filter); | 788 root_window()->AddPreTargetHandler(&recorder); |
787 test::TestWindowDelegate delegate; | 789 test::TestWindowDelegate delegate; |
788 HoldPointerOnScrollHandler handler(host()->dispatcher(), filter); | 790 HoldPointerOnScrollHandler handler(host()->dispatcher(), &recorder); |
789 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 791 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
790 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 792 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
791 window->AddPreTargetHandler(&handler); | 793 window->AddPreTargetHandler(&handler); |
792 | 794 |
793 test::EventGenerator generator(root_window()); | 795 test::EventGenerator generator(root_window()); |
794 generator.GestureScrollSequence( | 796 generator.GestureScrollSequence( |
795 gfx::Point(60, 60), gfx::Point(10, 60), | 797 gfx::Point(60, 60), gfx::Point(10, 60), |
796 base::TimeDelta::FromMilliseconds(100), 25); | 798 base::TimeDelta::FromMilliseconds(100), 25); |
797 | 799 |
798 // |handler| will have reset |filter| and started holding the touch-move | 800 // |handler| will have reset |filter| and started holding the touch-move |
799 // events when scrolling started. At the end of the scroll (i.e. upon | 801 // events when scrolling started. At the end of the scroll (i.e. upon |
800 // touch-release), the held touch-move event will have been dispatched first, | 802 // touch-release), the held touch-move event will have been dispatched first, |
801 // along with the subsequent events (i.e. touch-release, scroll-end, and | 803 // along with the subsequent events (i.e. touch-release, scroll-end, and |
802 // gesture-end). | 804 // gesture-end). |
803 const EventFilterRecorder::Events& events = filter->events(); | 805 const EventFilterRecorder::Events& events = recorder.events(); |
804 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", | 806 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", |
805 EventTypesToString(events)); | 807 EventTypesToString(events)); |
806 ASSERT_EQ(2u, filter->touch_locations().size()); | 808 ASSERT_EQ(2u, recorder.touch_locations().size()); |
807 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 809 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
808 filter->touch_locations()[0].ToString()); | 810 recorder.touch_locations()[0].ToString()); |
809 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 811 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
810 filter->touch_locations()[1].ToString()); | 812 recorder.touch_locations()[1].ToString()); |
811 } | 813 } |
812 | 814 |
813 // Tests that synthetic mouse events are ignored when mouse | 815 // Tests that synthetic mouse events are ignored when mouse |
814 // events are disabled. | 816 // events are disabled. |
815 TEST_F(WindowEventDispatcherTest, DispatchSyntheticMouseEvents) { | 817 TEST_F(WindowEventDispatcherTest, DispatchSyntheticMouseEvents) { |
816 EventFilterRecorder* filter = new EventFilterRecorder; | 818 EventFilterRecorder recorder; |
817 root_window()->SetEventFilter(filter); // passes ownership | 819 root_window()->AddPreTargetHandler(&recorder); |
818 | 820 |
819 test::TestWindowDelegate delegate; | 821 test::TestWindowDelegate delegate; |
820 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 822 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
821 &delegate, 1234, gfx::Rect(5, 5, 100, 100), root_window())); | 823 &delegate, 1234, gfx::Rect(5, 5, 100, 100), root_window())); |
822 window->Show(); | 824 window->Show(); |
823 window->SetCapture(); | 825 window->SetCapture(); |
824 | 826 |
825 test::TestCursorClient cursor_client(root_window()); | 827 test::TestCursorClient cursor_client(root_window()); |
826 | 828 |
827 // Dispatch a non-synthetic mouse event when mouse events are enabled. | 829 // Dispatch a non-synthetic mouse event when mouse events are enabled. |
828 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), | 830 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
829 gfx::Point(10, 10), 0, 0); | 831 gfx::Point(10, 10), 0, 0); |
830 DispatchEventUsingWindowDispatcher(&mouse1); | 832 DispatchEventUsingWindowDispatcher(&mouse1); |
831 EXPECT_FALSE(filter->events().empty()); | 833 EXPECT_FALSE(recorder.events().empty()); |
832 filter->Reset(); | 834 recorder.Reset(); |
833 | 835 |
834 // Dispatch a synthetic mouse event when mouse events are enabled. | 836 // Dispatch a synthetic mouse event when mouse events are enabled. |
835 ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), | 837 ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
836 gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED, 0); | 838 gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED, 0); |
837 DispatchEventUsingWindowDispatcher(&mouse2); | 839 DispatchEventUsingWindowDispatcher(&mouse2); |
838 EXPECT_FALSE(filter->events().empty()); | 840 EXPECT_FALSE(recorder.events().empty()); |
839 filter->Reset(); | 841 recorder.Reset(); |
840 | 842 |
841 // Dispatch a synthetic mouse event when mouse events are disabled. | 843 // Dispatch a synthetic mouse event when mouse events are disabled. |
842 cursor_client.DisableMouseEvents(); | 844 cursor_client.DisableMouseEvents(); |
843 DispatchEventUsingWindowDispatcher(&mouse2); | 845 DispatchEventUsingWindowDispatcher(&mouse2); |
844 EXPECT_TRUE(filter->events().empty()); | 846 EXPECT_TRUE(recorder.events().empty()); |
| 847 root_window()->RemovePreTargetHandler(&recorder); |
845 } | 848 } |
846 | 849 |
847 // Tests synthetic mouse events generated when window bounds changes such that | 850 // Tests synthetic mouse events generated when window bounds changes such that |
848 // the cursor previously outside the window becomes inside, or vice versa. | 851 // the cursor previously outside the window becomes inside, or vice versa. |
849 // - Synthesize MOVED events when the mouse button is up; | 852 // - Synthesize MOVED events when the mouse button is up; |
850 // - Synthesize DRAGGED events with correct flags when mouse button is down; | 853 // - Synthesize DRAGGED events with correct flags when mouse button is down; |
851 // - Do not synthesize events if the window ignores events or is invisible. | 854 // - Do not synthesize events if the window ignores events or is invisible. |
852 TEST_F(WindowEventDispatcherTest, SynthesizeMouseEventsOnWindowBoundsChanged) { | 855 TEST_F(WindowEventDispatcherTest, SynthesizeMouseEventsOnWindowBoundsChanged) { |
853 test::TestWindowDelegate delegate; | 856 test::TestWindowDelegate delegate; |
854 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 857 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
855 &delegate, 1234, gfx::Rect(5, 5, 100, 100), root_window())); | 858 &delegate, 1234, gfx::Rect(5, 5, 100, 100), root_window())); |
856 window->Show(); | 859 window->Show(); |
857 window->SetCapture(); | 860 window->SetCapture(); |
858 | 861 |
859 EventFilterRecorder* filter = new EventFilterRecorder; | 862 EventFilterRecorder recorder; |
860 window->SetEventFilter(filter); // passes ownership | 863 window->AddPreTargetHandler(&recorder); |
861 | 864 |
862 // Dispatch a non-synthetic mouse event to place cursor inside window bounds. | 865 // Dispatch a non-synthetic mouse event to place cursor inside window bounds. |
863 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), | 866 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
864 gfx::Point(10, 10), 0, 0); | 867 gfx::Point(10, 10), 0, 0); |
865 DispatchEventUsingWindowDispatcher(&mouse); | 868 DispatchEventUsingWindowDispatcher(&mouse); |
866 EXPECT_FALSE(filter->events().empty()); | 869 EXPECT_FALSE(recorder.events().empty()); |
867 filter->Reset(); | 870 recorder.Reset(); |
868 | 871 |
869 // Update the window bounds so that cursor is now outside the window. | 872 // Update the window bounds so that cursor is now outside the window. |
870 // This should trigger a synthetic MOVED event. | 873 // This should trigger a synthetic MOVED event. |
871 gfx::Rect bounds1(20, 20, 100, 100); | 874 gfx::Rect bounds1(20, 20, 100, 100); |
872 window->SetBounds(bounds1); | 875 window->SetBounds(bounds1); |
873 RunAllPendingInMessageLoop(); | 876 RunAllPendingInMessageLoop(); |
874 ASSERT_FALSE(filter->events().empty()); | 877 ASSERT_FALSE(recorder.events().empty()); |
875 ASSERT_FALSE(filter->mouse_event_flags().empty()); | 878 ASSERT_FALSE(recorder.mouse_event_flags().empty()); |
876 EXPECT_EQ(ui::ET_MOUSE_MOVED, filter->events().back()); | 879 EXPECT_EQ(ui::ET_MOUSE_MOVED, recorder.events().back()); |
877 EXPECT_EQ(ui::EF_IS_SYNTHESIZED, filter->mouse_event_flags().back()); | 880 EXPECT_EQ(ui::EF_IS_SYNTHESIZED, recorder.mouse_event_flags().back()); |
878 filter->Reset(); | 881 recorder.Reset(); |
879 | 882 |
880 // Hold down the LEFT mouse button. | 883 // Hold down the LEFT mouse button. |
881 Env::GetInstance()->set_mouse_button_flags(ui::EF_LEFT_MOUSE_BUTTON); | 884 Env::GetInstance()->set_mouse_button_flags(ui::EF_LEFT_MOUSE_BUTTON); |
882 | 885 |
883 // Update the window bounds so that cursor is back inside the window. | 886 // Update the window bounds so that cursor is back inside the window. |
884 // This should trigger a synthetic DRAGGED event with the left button flag. | 887 // This should trigger a synthetic DRAGGED event with the left button flag. |
885 gfx::Rect bounds2(5, 5, 100, 100); | 888 gfx::Rect bounds2(5, 5, 100, 100); |
886 window->SetBounds(bounds2); | 889 window->SetBounds(bounds2); |
887 RunAllPendingInMessageLoop(); | 890 RunAllPendingInMessageLoop(); |
888 ASSERT_FALSE(filter->events().empty()); | 891 ASSERT_FALSE(recorder.events().empty()); |
889 ASSERT_FALSE(filter->mouse_event_flags().empty()); | 892 ASSERT_FALSE(recorder.mouse_event_flags().empty()); |
890 EXPECT_EQ(ui::ET_MOUSE_DRAGGED, filter->events().back()); | 893 EXPECT_EQ(ui::ET_MOUSE_DRAGGED, recorder.events().back()); |
891 EXPECT_EQ(ui::EF_IS_SYNTHESIZED | ui::EF_LEFT_MOUSE_BUTTON, | 894 EXPECT_EQ(ui::EF_IS_SYNTHESIZED | ui::EF_LEFT_MOUSE_BUTTON, |
892 filter->mouse_event_flags().back()); | 895 recorder.mouse_event_flags().back()); |
893 filter->Reset(); | 896 recorder.Reset(); |
894 | 897 |
895 // Hold down the RIGHT mouse button. | 898 // Hold down the RIGHT mouse button. |
896 Env::GetInstance()->set_mouse_button_flags(ui::EF_RIGHT_MOUSE_BUTTON); | 899 Env::GetInstance()->set_mouse_button_flags(ui::EF_RIGHT_MOUSE_BUTTON); |
897 | 900 |
898 // Update the window bounds so that cursor is outside the window. | 901 // Update the window bounds so that cursor is outside the window. |
899 // This should trigger a synthetic DRAGGED event with the right button flag. | 902 // This should trigger a synthetic DRAGGED event with the right button flag. |
900 window->SetBounds(bounds1); | 903 window->SetBounds(bounds1); |
901 RunAllPendingInMessageLoop(); | 904 RunAllPendingInMessageLoop(); |
902 ASSERT_FALSE(filter->events().empty()); | 905 ASSERT_FALSE(recorder.events().empty()); |
903 ASSERT_FALSE(filter->mouse_event_flags().empty()); | 906 ASSERT_FALSE(recorder.mouse_event_flags().empty()); |
904 EXPECT_EQ(ui::ET_MOUSE_DRAGGED, filter->events().back()); | 907 EXPECT_EQ(ui::ET_MOUSE_DRAGGED, recorder.events().back()); |
905 EXPECT_EQ(ui::EF_IS_SYNTHESIZED | ui::EF_RIGHT_MOUSE_BUTTON, | 908 EXPECT_EQ(ui::EF_IS_SYNTHESIZED | ui::EF_RIGHT_MOUSE_BUTTON, |
906 filter->mouse_event_flags().back()); | 909 recorder.mouse_event_flags().back()); |
907 filter->Reset(); | 910 recorder.Reset(); |
908 | 911 |
909 // Release mouse button and set window to ignore events. | 912 // Release mouse button and set window to ignore events. |
910 Env::GetInstance()->set_mouse_button_flags(0); | 913 Env::GetInstance()->set_mouse_button_flags(0); |
911 window->set_ignore_events(true); | 914 window->set_ignore_events(true); |
912 | 915 |
913 // Update the window bounds so that cursor is back inside the window. | 916 // Update the window bounds so that cursor is back inside the window. |
914 // This should not trigger a synthetic event. | 917 // This should not trigger a synthetic event. |
915 window->SetBounds(bounds2); | 918 window->SetBounds(bounds2); |
916 RunAllPendingInMessageLoop(); | 919 RunAllPendingInMessageLoop(); |
917 EXPECT_TRUE(filter->events().empty()); | 920 EXPECT_TRUE(recorder.events().empty()); |
918 filter->Reset(); | 921 recorder.Reset(); |
919 | 922 |
920 // Set window to accept events but invisible. | 923 // Set window to accept events but invisible. |
921 window->set_ignore_events(false); | 924 window->set_ignore_events(false); |
922 window->Hide(); | 925 window->Hide(); |
923 filter->Reset(); | 926 recorder.Reset(); |
924 | 927 |
925 // Update the window bounds so that cursor is outside the window. | 928 // Update the window bounds so that cursor is outside the window. |
926 // This should not trigger a synthetic event. | 929 // This should not trigger a synthetic event. |
927 window->SetBounds(bounds1); | 930 window->SetBounds(bounds1); |
928 RunAllPendingInMessageLoop(); | 931 RunAllPendingInMessageLoop(); |
929 EXPECT_TRUE(filter->events().empty()); | 932 EXPECT_TRUE(recorder.events().empty()); |
930 } | 933 } |
931 | 934 |
932 // Tests that a mouse exit is dispatched to the last known cursor location | 935 // Tests that a mouse exit is dispatched to the last known cursor location |
933 // when the cursor becomes invisible. | 936 // when the cursor becomes invisible. |
934 TEST_F(WindowEventDispatcherTest, DispatchMouseExitWhenCursorHidden) { | 937 TEST_F(WindowEventDispatcherTest, DispatchMouseExitWhenCursorHidden) { |
935 EventFilterRecorder* filter = new EventFilterRecorder; | 938 EventFilterRecorder recorder; |
936 root_window()->SetEventFilter(filter); // passes ownership | 939 root_window()->AddPreTargetHandler(&recorder); |
937 | 940 |
938 test::TestWindowDelegate delegate; | 941 test::TestWindowDelegate delegate; |
939 gfx::Point window_origin(7, 18); | 942 gfx::Point window_origin(7, 18); |
940 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 943 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
941 &delegate, 1234, gfx::Rect(window_origin, gfx::Size(100, 100)), | 944 &delegate, 1234, gfx::Rect(window_origin, gfx::Size(100, 100)), |
942 root_window())); | 945 root_window())); |
943 window->Show(); | 946 window->Show(); |
944 | 947 |
945 // Dispatch a mouse move event into the window. | 948 // Dispatch a mouse move event into the window. |
946 gfx::Point mouse_location(gfx::Point(15, 25)); | 949 gfx::Point mouse_location(gfx::Point(15, 25)); |
947 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, | 950 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, |
948 mouse_location, 0, 0); | 951 mouse_location, 0, 0); |
949 EXPECT_TRUE(filter->events().empty()); | 952 EXPECT_TRUE(recorder.events().empty()); |
950 DispatchEventUsingWindowDispatcher(&mouse1); | 953 DispatchEventUsingWindowDispatcher(&mouse1); |
951 EXPECT_FALSE(filter->events().empty()); | 954 EXPECT_FALSE(recorder.events().empty()); |
952 filter->Reset(); | 955 recorder.Reset(); |
953 | 956 |
954 // Hide the cursor and verify a mouse exit was dispatched. | 957 // Hide the cursor and verify a mouse exit was dispatched. |
955 host()->OnCursorVisibilityChanged(false); | 958 host()->OnCursorVisibilityChanged(false); |
956 EXPECT_FALSE(filter->events().empty()); | 959 EXPECT_FALSE(recorder.events().empty()); |
957 EXPECT_EQ("MOUSE_EXITED", EventTypesToString(filter->events())); | 960 EXPECT_EQ("MOUSE_EXITED", EventTypesToString(recorder.events())); |
958 | 961 |
959 // Verify the mouse exit was dispatched at the correct location | 962 // Verify the mouse exit was dispatched at the correct location |
960 // (in the correct coordinate space). | 963 // (in the correct coordinate space). |
961 int translated_x = mouse_location.x() - window_origin.x(); | 964 int translated_x = mouse_location.x() - window_origin.x(); |
962 int translated_y = mouse_location.y() - window_origin.y(); | 965 int translated_y = mouse_location.y() - window_origin.y(); |
963 gfx::Point translated_point(translated_x, translated_y); | 966 gfx::Point translated_point(translated_x, translated_y); |
964 EXPECT_EQ(filter->mouse_location(0).ToString(), translated_point.ToString()); | 967 EXPECT_EQ(recorder.mouse_location(0).ToString(), translated_point.ToString()); |
| 968 root_window()->RemovePreTargetHandler(&recorder); |
965 } | 969 } |
966 | 970 |
967 // Tests that a synthetic mouse exit is dispatched to the last known cursor | 971 // Tests that a synthetic mouse exit is dispatched to the last known cursor |
968 // location after mouse events are disabled on the cursor client. | 972 // location after mouse events are disabled on the cursor client. |
969 TEST_F(WindowEventDispatcherTest, | 973 TEST_F(WindowEventDispatcherTest, |
970 DispatchSyntheticMouseExitAfterMouseEventsDisabled) { | 974 DispatchSyntheticMouseExitAfterMouseEventsDisabled) { |
971 EventFilterRecorder* filter = new EventFilterRecorder; | 975 EventFilterRecorder recorder; |
972 root_window()->SetEventFilter(filter); // passes ownership | 976 root_window()->AddPreTargetHandler(&recorder); |
973 | 977 |
974 test::TestWindowDelegate delegate; | 978 test::TestWindowDelegate delegate; |
975 gfx::Point window_origin(7, 18); | 979 gfx::Point window_origin(7, 18); |
976 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 980 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
977 &delegate, 1234, gfx::Rect(window_origin, gfx::Size(100, 100)), | 981 &delegate, 1234, gfx::Rect(window_origin, gfx::Size(100, 100)), |
978 root_window())); | 982 root_window())); |
979 window->Show(); | 983 window->Show(); |
980 | 984 |
981 // Dispatch a mouse move event into the window. | 985 // Dispatch a mouse move event into the window. |
982 gfx::Point mouse_location(gfx::Point(15, 25)); | 986 gfx::Point mouse_location(gfx::Point(15, 25)); |
983 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, | 987 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, |
984 mouse_location, 0, 0); | 988 mouse_location, 0, 0); |
985 EXPECT_TRUE(filter->events().empty()); | 989 EXPECT_TRUE(recorder.events().empty()); |
986 DispatchEventUsingWindowDispatcher(&mouse1); | 990 DispatchEventUsingWindowDispatcher(&mouse1); |
987 EXPECT_FALSE(filter->events().empty()); | 991 EXPECT_FALSE(recorder.events().empty()); |
988 filter->Reset(); | 992 recorder.Reset(); |
989 | 993 |
990 test::TestCursorClient cursor_client(root_window()); | 994 test::TestCursorClient cursor_client(root_window()); |
991 cursor_client.DisableMouseEvents(); | 995 cursor_client.DisableMouseEvents(); |
992 | 996 |
993 gfx::Point mouse_exit_location(gfx::Point(150, 150)); | 997 gfx::Point mouse_exit_location(gfx::Point(150, 150)); |
994 ui::MouseEvent mouse2(ui::ET_MOUSE_EXITED, gfx::Point(150, 150), | 998 ui::MouseEvent mouse2(ui::ET_MOUSE_EXITED, gfx::Point(150, 150), |
995 gfx::Point(150, 150), ui::EF_IS_SYNTHESIZED, 0); | 999 gfx::Point(150, 150), ui::EF_IS_SYNTHESIZED, 0); |
996 DispatchEventUsingWindowDispatcher(&mouse2); | 1000 DispatchEventUsingWindowDispatcher(&mouse2); |
997 | 1001 |
998 EXPECT_FALSE(filter->events().empty()); | 1002 EXPECT_FALSE(recorder.events().empty()); |
999 // We get the mouse exited event twice in our filter. Once during the | 1003 // We get the mouse exited event twice in our filter. Once during the |
1000 // predispatch phase and during the actual dispatch. | 1004 // predispatch phase and during the actual dispatch. |
1001 EXPECT_EQ("MOUSE_EXITED MOUSE_EXITED", EventTypesToString(filter->events())); | 1005 EXPECT_EQ("MOUSE_EXITED MOUSE_EXITED", EventTypesToString(recorder.events())); |
1002 | 1006 |
1003 // Verify the mouse exit was dispatched at the correct location | 1007 // Verify the mouse exit was dispatched at the correct location |
1004 // (in the correct coordinate space). | 1008 // (in the correct coordinate space). |
1005 int translated_x = mouse_exit_location.x() - window_origin.x(); | 1009 int translated_x = mouse_exit_location.x() - window_origin.x(); |
1006 int translated_y = mouse_exit_location.y() - window_origin.y(); | 1010 int translated_y = mouse_exit_location.y() - window_origin.y(); |
1007 gfx::Point translated_point(translated_x, translated_y); | 1011 gfx::Point translated_point(translated_x, translated_y); |
1008 EXPECT_EQ(filter->mouse_location(0).ToString(), translated_point.ToString()); | 1012 EXPECT_EQ(recorder.mouse_location(0).ToString(), translated_point.ToString()); |
| 1013 root_window()->RemovePreTargetHandler(&recorder); |
1009 } | 1014 } |
1010 | 1015 |
1011 class DeletingEventFilter : public ui::EventHandler { | 1016 class DeletingEventFilter : public ui::EventHandler { |
1012 public: | 1017 public: |
1013 DeletingEventFilter() | 1018 DeletingEventFilter() |
1014 : delete_during_pre_handle_(false) {} | 1019 : delete_during_pre_handle_(false) {} |
1015 virtual ~DeletingEventFilter() {} | 1020 virtual ~DeletingEventFilter() {} |
1016 | 1021 |
1017 void Reset(bool delete_during_pre_handle) { | 1022 void Reset(bool delete_during_pre_handle) { |
1018 delete_during_pre_handle_ = delete_during_pre_handle; | 1023 delete_during_pre_handle_ = delete_during_pre_handle; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 }; | 1077 }; |
1073 | 1078 |
1074 TEST_F(WindowEventDispatcherTest, DeleteWindowDuringDispatch) { | 1079 TEST_F(WindowEventDispatcherTest, DeleteWindowDuringDispatch) { |
1075 // Verifies that we can delete a window during each phase of event handling. | 1080 // Verifies that we can delete a window during each phase of event handling. |
1076 // Deleting the window should not cause a crash, only prevent further | 1081 // Deleting the window should not cause a crash, only prevent further |
1077 // processing from occurring. | 1082 // processing from occurring. |
1078 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); | 1083 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); |
1079 DeletingWindowDelegate d11; | 1084 DeletingWindowDelegate d11; |
1080 Window* w11 = CreateNormalWindow(11, w1.get(), &d11); | 1085 Window* w11 = CreateNormalWindow(11, w1.get(), &d11); |
1081 WindowTracker tracker; | 1086 WindowTracker tracker; |
1082 DeletingEventFilter* w1_filter = new DeletingEventFilter; | 1087 DeletingEventFilter w1_filter; |
1083 w1->SetEventFilter(w1_filter); | 1088 w1->AddPreTargetHandler(&w1_filter); |
1084 client::GetFocusClient(w1.get())->FocusWindow(w11); | 1089 client::GetFocusClient(w1.get())->FocusWindow(w11); |
1085 | 1090 |
1086 test::EventGenerator generator(root_window(), w11); | 1091 test::EventGenerator generator(root_window(), w11); |
1087 | 1092 |
1088 // First up, no one deletes anything. | 1093 // First up, no one deletes anything. |
1089 tracker.Add(w11); | 1094 tracker.Add(w11); |
1090 d11.Reset(w11, false); | 1095 d11.Reset(w11, false); |
1091 | 1096 |
1092 generator.PressLeftButton(); | 1097 generator.PressLeftButton(); |
1093 EXPECT_TRUE(tracker.Contains(w11)); | 1098 EXPECT_TRUE(tracker.Contains(w11)); |
1094 EXPECT_TRUE(d11.got_event()); | 1099 EXPECT_TRUE(d11.got_event()); |
1095 generator.ReleaseLeftButton(); | 1100 generator.ReleaseLeftButton(); |
1096 | 1101 |
1097 // Delegate deletes w11. This will prevent the post-handle step from applying. | 1102 // Delegate deletes w11. This will prevent the post-handle step from applying. |
1098 w1_filter->Reset(false); | 1103 w1_filter.Reset(false); |
1099 d11.Reset(w11, true); | 1104 d11.Reset(w11, true); |
1100 generator.PressKey(ui::VKEY_A, 0); | 1105 generator.PressKey(ui::VKEY_A, 0); |
1101 EXPECT_FALSE(tracker.Contains(w11)); | 1106 EXPECT_FALSE(tracker.Contains(w11)); |
1102 EXPECT_TRUE(d11.got_event()); | 1107 EXPECT_TRUE(d11.got_event()); |
1103 | 1108 |
1104 // Pre-handle step deletes w11. This will prevent the delegate and the post- | 1109 // Pre-handle step deletes w11. This will prevent the delegate and the post- |
1105 // handle steps from applying. | 1110 // handle steps from applying. |
1106 w11 = CreateNormalWindow(11, w1.get(), &d11); | 1111 w11 = CreateNormalWindow(11, w1.get(), &d11); |
1107 w1_filter->Reset(true); | 1112 w1_filter.Reset(true); |
1108 d11.Reset(w11, false); | 1113 d11.Reset(w11, false); |
1109 generator.PressLeftButton(); | 1114 generator.PressLeftButton(); |
1110 EXPECT_FALSE(tracker.Contains(w11)); | 1115 EXPECT_FALSE(tracker.Contains(w11)); |
1111 EXPECT_FALSE(d11.got_event()); | 1116 EXPECT_FALSE(d11.got_event()); |
1112 } | 1117 } |
1113 | 1118 |
1114 namespace { | 1119 namespace { |
1115 | 1120 |
1116 // A window delegate that detaches the parent of the target's parent window when | 1121 // A window delegate that detaches the parent of the target's parent window when |
1117 // it receives a tap event. | 1122 // it receives a tap event. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 test::EventGenerator generator(root_window(), w2.get()); | 1212 test::EventGenerator generator(root_window(), w2.get()); |
1208 generator.GestureTapAt(w2->bounds().CenterPoint()); | 1213 generator.GestureTapAt(w2->bounds().CenterPoint()); |
1209 | 1214 |
1210 // Both windows should get their gesture end events. | 1215 // Both windows should get their gesture end events. |
1211 EXPECT_EQ(1, d1.gesture_end_count()); | 1216 EXPECT_EQ(1, d1.gesture_end_count()); |
1212 EXPECT_EQ(1, d2.gesture_end_count()); | 1217 EXPECT_EQ(1, d2.gesture_end_count()); |
1213 } | 1218 } |
1214 | 1219 |
1215 // Tests whether we can repost the Tap down gesture event. | 1220 // Tests whether we can repost the Tap down gesture event. |
1216 TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { | 1221 TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { |
1217 EventFilterRecorder* filter = new EventFilterRecorder; | 1222 EventFilterRecorder recorder; |
1218 root_window()->SetEventFilter(filter); // passes ownership | 1223 root_window()->AddPreTargetHandler(&recorder); |
1219 | 1224 |
1220 test::TestWindowDelegate delegate; | 1225 test::TestWindowDelegate delegate; |
1221 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1226 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1222 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1227 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1223 | 1228 |
1224 ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f); | 1229 ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f); |
1225 gfx::Point point(10, 10); | 1230 gfx::Point point(10, 10); |
1226 ui::GestureEvent event( | 1231 ui::GestureEvent event( |
1227 ui::ET_GESTURE_TAP_DOWN, | 1232 ui::ET_GESTURE_TAP_DOWN, |
1228 point.x(), | 1233 point.x(), |
1229 point.y(), | 1234 point.y(), |
1230 0, | 1235 0, |
1231 ui::EventTimeForNow(), | 1236 ui::EventTimeForNow(), |
1232 details, | 1237 details, |
1233 0); | 1238 0); |
1234 host()->dispatcher()->RepostEvent(event); | 1239 host()->dispatcher()->RepostEvent(event); |
1235 RunAllPendingInMessageLoop(); | 1240 RunAllPendingInMessageLoop(); |
1236 // TODO(rbyers): Currently disabled - crbug.com/170987 | 1241 // TODO(rbyers): Currently disabled - crbug.com/170987 |
1237 EXPECT_FALSE(EventTypesToString(filter->events()).find("GESTURE_TAP_DOWN") != | 1242 EXPECT_FALSE(EventTypesToString(recorder.events()).find("GESTURE_TAP_DOWN") != |
1238 std::string::npos); | 1243 std::string::npos); |
1239 filter->Reset(); | 1244 recorder.Reset(); |
| 1245 root_window()->RemovePreTargetHandler(&recorder); |
1240 } | 1246 } |
1241 | 1247 |
1242 // This class inherits from the EventFilterRecorder class which provides a | 1248 // This class inherits from the EventFilterRecorder class which provides a |
1243 // facility to record events. This class additionally provides a facility to | 1249 // facility to record events. This class additionally provides a facility to |
1244 // repost the ET_GESTURE_TAP_DOWN gesture to the target window and records | 1250 // repost the ET_GESTURE_TAP_DOWN gesture to the target window and records |
1245 // events after that. | 1251 // events after that. |
1246 class RepostGestureEventRecorder : public EventFilterRecorder { | 1252 class RepostGestureEventRecorder : public EventFilterRecorder { |
1247 public: | 1253 public: |
1248 RepostGestureEventRecorder(aura::Window* repost_source, | 1254 RepostGestureEventRecorder(aura::Window* repost_source, |
1249 aura::Window* repost_target) | 1255 aura::Window* repost_target) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 // (repost_target). | 1316 // (repost_target). |
1311 // We then generate the scroll sequence for repost_target and look for two | 1317 // We then generate the scroll sequence for repost_target and look for two |
1312 // ET_GESTURE_TAP_DOWN events in the event list at the end. | 1318 // ET_GESTURE_TAP_DOWN events in the event list at the end. |
1313 test::TestWindowDelegate delegate; | 1319 test::TestWindowDelegate delegate; |
1314 scoped_ptr<aura::Window> repost_target(CreateTestWindowWithDelegate( | 1320 scoped_ptr<aura::Window> repost_target(CreateTestWindowWithDelegate( |
1315 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1321 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1316 | 1322 |
1317 scoped_ptr<aura::Window> repost_source(CreateTestWindowWithDelegate( | 1323 scoped_ptr<aura::Window> repost_source(CreateTestWindowWithDelegate( |
1318 &delegate, 1, gfx::Rect(0, 0, 50, 50), root_window())); | 1324 &delegate, 1, gfx::Rect(0, 0, 50, 50), root_window())); |
1319 | 1325 |
1320 RepostGestureEventRecorder* repost_event_recorder = | 1326 RepostGestureEventRecorder repost_event_recorder(repost_source.get(), |
1321 new RepostGestureEventRecorder(repost_source.get(), repost_target.get()); | 1327 repost_target.get()); |
1322 root_window()->SetEventFilter(repost_event_recorder); // passes ownership | 1328 root_window()->AddPreTargetHandler(&repost_event_recorder); |
1323 | 1329 |
1324 // Generate a tap down gesture for the repost_source. This will be reposted | 1330 // Generate a tap down gesture for the repost_source. This will be reposted |
1325 // to repost_target. | 1331 // to repost_target. |
1326 test::EventGenerator repost_generator(root_window(), repost_source.get()); | 1332 test::EventGenerator repost_generator(root_window(), repost_source.get()); |
1327 repost_generator.GestureTapAt(gfx::Point(40, 40)); | 1333 repost_generator.GestureTapAt(gfx::Point(40, 40)); |
1328 RunAllPendingInMessageLoop(); | 1334 RunAllPendingInMessageLoop(); |
1329 | 1335 |
1330 test::EventGenerator scroll_generator(root_window(), repost_target.get()); | 1336 test::EventGenerator scroll_generator(root_window(), repost_target.get()); |
1331 scroll_generator.GestureScrollSequence( | 1337 scroll_generator.GestureScrollSequence( |
1332 gfx::Point(80, 80), | 1338 gfx::Point(80, 80), |
1333 gfx::Point(100, 100), | 1339 gfx::Point(100, 100), |
1334 base::TimeDelta::FromMilliseconds(100), | 1340 base::TimeDelta::FromMilliseconds(100), |
1335 3); | 1341 3); |
1336 RunAllPendingInMessageLoop(); | 1342 RunAllPendingInMessageLoop(); |
1337 | 1343 |
1338 int tap_down_count = 0; | 1344 int tap_down_count = 0; |
1339 for (size_t i = 0; i < repost_event_recorder->events().size(); ++i) { | 1345 for (size_t i = 0; i < repost_event_recorder.events().size(); ++i) { |
1340 if (repost_event_recorder->events()[i] == ui::ET_GESTURE_TAP_DOWN) | 1346 if (repost_event_recorder.events()[i] == ui::ET_GESTURE_TAP_DOWN) |
1341 ++tap_down_count; | 1347 ++tap_down_count; |
1342 } | 1348 } |
1343 | 1349 |
1344 // We expect two tap down events. One from the repost and the other one from | 1350 // We expect two tap down events. One from the repost and the other one from |
1345 // the scroll sequence posted above. | 1351 // the scroll sequence posted above. |
1346 // TODO(rbyers): Currently disabled - crbug.com/170987 | 1352 // TODO(rbyers): Currently disabled - crbug.com/170987 |
1347 EXPECT_EQ(1, tap_down_count); | 1353 EXPECT_EQ(1, tap_down_count); |
1348 | 1354 |
1349 EXPECT_EQ(kExpectedTargetEvents, | 1355 EXPECT_EQ(kExpectedTargetEvents, |
1350 EventTypesToString(repost_event_recorder->events())); | 1356 EventTypesToString(repost_event_recorder.events())); |
| 1357 root_window()->RemovePreTargetHandler(&repost_event_recorder); |
1351 } | 1358 } |
1352 | 1359 |
1353 class OnMouseExitDeletingEventFilter : public EventFilterRecorder { | 1360 class OnMouseExitDeletingEventFilter : public EventFilterRecorder { |
1354 public: | 1361 public: |
1355 OnMouseExitDeletingEventFilter() : window_to_delete_(NULL) {} | 1362 OnMouseExitDeletingEventFilter() : window_to_delete_(NULL) {} |
1356 virtual ~OnMouseExitDeletingEventFilter() {} | 1363 virtual ~OnMouseExitDeletingEventFilter() {} |
1357 | 1364 |
1358 void set_window_to_delete(Window* window_to_delete) { | 1365 void set_window_to_delete(Window* window_to_delete) { |
1359 window_to_delete_ = window_to_delete; | 1366 window_to_delete_ = window_to_delete; |
1360 } | 1367 } |
(...skipping 13 matching lines...) Expand all Loading... |
1374 DISALLOW_COPY_AND_ASSIGN(OnMouseExitDeletingEventFilter); | 1381 DISALLOW_COPY_AND_ASSIGN(OnMouseExitDeletingEventFilter); |
1375 }; | 1382 }; |
1376 | 1383 |
1377 // Tests that RootWindow drops mouse-moved event that is supposed to be sent to | 1384 // Tests that RootWindow drops mouse-moved event that is supposed to be sent to |
1378 // a child, but the child is destroyed because of the synthesized mouse-exit | 1385 // a child, but the child is destroyed because of the synthesized mouse-exit |
1379 // event generated on the previous mouse_moved_handler_. | 1386 // event generated on the previous mouse_moved_handler_. |
1380 TEST_F(WindowEventDispatcherTest, DeleteWindowDuringMouseMovedDispatch) { | 1387 TEST_F(WindowEventDispatcherTest, DeleteWindowDuringMouseMovedDispatch) { |
1381 // Create window 1 and set its event filter. Window 1 will take ownership of | 1388 // Create window 1 and set its event filter. Window 1 will take ownership of |
1382 // the event filter. | 1389 // the event filter. |
1383 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); | 1390 scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), NULL)); |
1384 OnMouseExitDeletingEventFilter* w1_filter = | 1391 OnMouseExitDeletingEventFilter w1_filter; |
1385 new OnMouseExitDeletingEventFilter(); | 1392 w1->AddPreTargetHandler(&w1_filter); |
1386 w1->SetEventFilter(w1_filter); | |
1387 w1->SetBounds(gfx::Rect(20, 20, 60, 60)); | 1393 w1->SetBounds(gfx::Rect(20, 20, 60, 60)); |
1388 EXPECT_EQ(NULL, host()->dispatcher()->mouse_moved_handler()); | 1394 EXPECT_EQ(NULL, host()->dispatcher()->mouse_moved_handler()); |
1389 | 1395 |
1390 test::EventGenerator generator(root_window(), w1.get()); | 1396 test::EventGenerator generator(root_window(), w1.get()); |
1391 | 1397 |
1392 // Move mouse over window 1 to set it as the |mouse_moved_handler_| for the | 1398 // Move mouse over window 1 to set it as the |mouse_moved_handler_| for the |
1393 // root window. | 1399 // root window. |
1394 generator.MoveMouseTo(51, 51); | 1400 generator.MoveMouseTo(51, 51); |
1395 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_moved_handler()); | 1401 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_moved_handler()); |
1396 | 1402 |
1397 // Create window 2 under the mouse cursor and stack it above window 1. | 1403 // Create window 2 under the mouse cursor and stack it above window 1. |
1398 Window* w2 = CreateNormalWindow(2, root_window(), NULL); | 1404 Window* w2 = CreateNormalWindow(2, root_window(), NULL); |
1399 w2->SetBounds(gfx::Rect(30, 30, 40, 40)); | 1405 w2->SetBounds(gfx::Rect(30, 30, 40, 40)); |
1400 root_window()->StackChildAbove(w2, w1.get()); | 1406 root_window()->StackChildAbove(w2, w1.get()); |
1401 | 1407 |
1402 // Set window 2 as the window that is to be deleted when a mouse-exited event | 1408 // Set window 2 as the window that is to be deleted when a mouse-exited event |
1403 // happens on window 1. | 1409 // happens on window 1. |
1404 w1_filter->set_window_to_delete(w2); | 1410 w1_filter.set_window_to_delete(w2); |
1405 | 1411 |
1406 // Move mosue over window 2. This should generate a mouse-exited event for | 1412 // Move mosue over window 2. This should generate a mouse-exited event for |
1407 // window 1 resulting in deletion of window 2. The original mouse-moved event | 1413 // window 1 resulting in deletion of window 2. The original mouse-moved event |
1408 // that was targeted to window 2 should be dropped since window 2 is | 1414 // that was targeted to window 2 should be dropped since window 2 is |
1409 // destroyed. This test passes if no crash happens. | 1415 // destroyed. This test passes if no crash happens. |
1410 generator.MoveMouseTo(52, 52); | 1416 generator.MoveMouseTo(52, 52); |
1411 EXPECT_EQ(NULL, host()->dispatcher()->mouse_moved_handler()); | 1417 EXPECT_EQ(NULL, host()->dispatcher()->mouse_moved_handler()); |
1412 | 1418 |
1413 // Check events received by window 1. | 1419 // Check events received by window 1. |
1414 EXPECT_EQ("MOUSE_ENTERED MOUSE_MOVED MOUSE_EXITED", | 1420 EXPECT_EQ("MOUSE_ENTERED MOUSE_MOVED MOUSE_EXITED", |
1415 EventTypesToString(w1_filter->events())); | 1421 EventTypesToString(w1_filter.events())); |
1416 } | 1422 } |
1417 | 1423 |
1418 namespace { | 1424 namespace { |
1419 | 1425 |
1420 // Used to track if OnWindowDestroying() is invoked and if there is a valid | 1426 // Used to track if OnWindowDestroying() is invoked and if there is a valid |
1421 // RootWindow at such time. | 1427 // RootWindow at such time. |
1422 class ValidRootDuringDestructionWindowObserver : public aura::WindowObserver { | 1428 class ValidRootDuringDestructionWindowObserver : public aura::WindowObserver { |
1423 public: | 1429 public: |
1424 ValidRootDuringDestructionWindowObserver(bool* got_destroying, | 1430 ValidRootDuringDestructionWindowObserver(bool* got_destroying, |
1425 bool* has_valid_root) | 1431 bool* has_valid_root) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 gfx::Point(10, 10), gfx::Point(10, 10), | 1574 gfx::Point(10, 10), gfx::Point(10, 10), |
1569 ui::EF_SHIFT_DOWN, 0); | 1575 ui::EF_SHIFT_DOWN, 0); |
1570 h2->dispatcher()->RepostEvent(pressed); | 1576 h2->dispatcher()->RepostEvent(pressed); |
1571 // RunAllPendingInMessageLoop() to make sure the |pressed| is run. | 1577 // RunAllPendingInMessageLoop() to make sure the |pressed| is run. |
1572 RunAllPendingInMessageLoop(); | 1578 RunAllPendingInMessageLoop(); |
1573 EXPECT_TRUE(delegate.got_mouse_event()); | 1579 EXPECT_TRUE(delegate.got_mouse_event()); |
1574 EXPECT_TRUE(delegate.got_destroy()); | 1580 EXPECT_TRUE(delegate.got_destroy()); |
1575 } | 1581 } |
1576 | 1582 |
1577 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveTouches) { | 1583 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveTouches) { |
1578 EventFilterRecorder* filter = new EventFilterRecorder; | 1584 EventFilterRecorder recorder; |
1579 root_window()->SetEventFilter(filter); // passes ownership | 1585 root_window()->AddPreTargetHandler(&recorder); |
1580 | 1586 |
1581 test::TestWindowDelegate delegate; | 1587 test::TestWindowDelegate delegate; |
1582 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1588 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1583 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1589 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1584 | 1590 |
1585 gfx::Point position1 = root_window()->bounds().origin(); | 1591 gfx::Point position1 = root_window()->bounds().origin(); |
1586 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); | 1592 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); |
1587 DispatchEventUsingWindowDispatcher(&press); | 1593 DispatchEventUsingWindowDispatcher(&press); |
1588 | 1594 |
1589 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN", | 1595 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN", |
1590 EventTypesToString(filter->GetAndResetEvents())); | 1596 EventTypesToString(recorder.GetAndResetEvents())); |
1591 | 1597 |
1592 window->Hide(); | 1598 window->Hide(); |
1593 | 1599 |
1594 EXPECT_EQ("TOUCH_CANCELLED GESTURE_TAP_CANCEL GESTURE_END", | 1600 EXPECT_EQ("TOUCH_CANCELLED GESTURE_TAP_CANCEL GESTURE_END", |
1595 EventTypesToString(filter->events())); | 1601 EventTypesToString(recorder.events())); |
| 1602 root_window()->RemovePreTargetHandler(&recorder); |
1596 } | 1603 } |
1597 | 1604 |
1598 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveGestures) { | 1605 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveGestures) { |
1599 EventFilterRecorder* filter = new EventFilterRecorder; | 1606 EventFilterRecorder recorder; |
1600 root_window()->SetEventFilter(filter); // passes ownership | 1607 root_window()->AddPreTargetHandler(&recorder); |
1601 | 1608 |
1602 test::TestWindowDelegate delegate; | 1609 test::TestWindowDelegate delegate; |
1603 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1610 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1604 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1611 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1605 | 1612 |
1606 gfx::Point position1 = root_window()->bounds().origin(); | 1613 gfx::Point position1 = root_window()->bounds().origin(); |
1607 gfx::Point position2 = root_window()->bounds().CenterPoint(); | 1614 gfx::Point position2 = root_window()->bounds().CenterPoint(); |
1608 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); | 1615 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); |
1609 DispatchEventUsingWindowDispatcher(&press); | 1616 DispatchEventUsingWindowDispatcher(&press); |
1610 | 1617 |
1611 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); | 1618 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); |
1612 DispatchEventUsingWindowDispatcher(&move); | 1619 DispatchEventUsingWindowDispatcher(&move); |
1613 | 1620 |
1614 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, position1, 1, base::TimeDelta()); | 1621 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, position1, 1, base::TimeDelta()); |
1615 DispatchEventUsingWindowDispatcher(&press2); | 1622 DispatchEventUsingWindowDispatcher(&press2); |
1616 | 1623 |
1617 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " | 1624 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " |
1618 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " | 1625 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " |
1619 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_PINCH_BEGIN", | 1626 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_PINCH_BEGIN", |
1620 EventTypesToString(filter->GetAndResetEvents())); | 1627 EventTypesToString(recorder.GetAndResetEvents())); |
1621 | 1628 |
1622 window->Hide(); | 1629 window->Hide(); |
1623 | 1630 |
1624 EXPECT_EQ("TOUCH_CANCELLED GESTURE_PINCH_END GESTURE_END TOUCH_CANCELLED " | 1631 EXPECT_EQ("TOUCH_CANCELLED GESTURE_PINCH_END GESTURE_END TOUCH_CANCELLED " |
1625 "GESTURE_SCROLL_END GESTURE_END", | 1632 "GESTURE_SCROLL_END GESTURE_END", |
1626 EventTypesToString(filter->events())); | 1633 EventTypesToString(recorder.events())); |
| 1634 root_window()->RemovePreTargetHandler(&recorder); |
1627 } | 1635 } |
1628 | 1636 |
1629 // Places two windows side by side. Presses down on one window, and starts a | 1637 // Places two windows side by side. Presses down on one window, and starts a |
1630 // scroll. Sets capture on the other window and ensures that the "ending" events | 1638 // scroll. Sets capture on the other window and ensures that the "ending" events |
1631 // aren't sent to the window which gained capture. | 1639 // aren't sent to the window which gained capture. |
1632 TEST_F(WindowEventDispatcherTest, EndingEventDoesntRetarget) { | 1640 TEST_F(WindowEventDispatcherTest, EndingEventDoesntRetarget) { |
| 1641 EventFilterRecorder recorder1; |
| 1642 EventFilterRecorder recorder2; |
1633 scoped_ptr<Window> window1(CreateNormalWindow(1, root_window(), NULL)); | 1643 scoped_ptr<Window> window1(CreateNormalWindow(1, root_window(), NULL)); |
1634 window1->SetBounds(gfx::Rect(0, 0, 40, 40)); | 1644 window1->SetBounds(gfx::Rect(0, 0, 40, 40)); |
1635 | 1645 |
1636 scoped_ptr<Window> window2(CreateNormalWindow(2, root_window(), NULL)); | 1646 scoped_ptr<Window> window2(CreateNormalWindow(2, root_window(), NULL)); |
1637 window2->SetBounds(gfx::Rect(40, 0, 40, 40)); | 1647 window2->SetBounds(gfx::Rect(40, 0, 40, 40)); |
1638 | 1648 |
1639 EventFilterRecorder* filter1 = new EventFilterRecorder(); | 1649 window1->AddPreTargetHandler(&recorder1); |
1640 window1->SetEventFilter(filter1); // passes ownership | 1650 window2->AddPreTargetHandler(&recorder2); |
1641 EventFilterRecorder* filter2 = new EventFilterRecorder(); | |
1642 window2->SetEventFilter(filter2); // passes ownership | |
1643 | 1651 |
1644 gfx::Point position = window1->bounds().origin(); | 1652 gfx::Point position = window1->bounds().origin(); |
1645 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); | 1653 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); |
1646 DispatchEventUsingWindowDispatcher(&press); | 1654 DispatchEventUsingWindowDispatcher(&press); |
1647 | 1655 |
1648 gfx::Point position2 = window1->bounds().CenterPoint(); | 1656 gfx::Point position2 = window1->bounds().CenterPoint(); |
1649 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); | 1657 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); |
1650 DispatchEventUsingWindowDispatcher(&move); | 1658 DispatchEventUsingWindowDispatcher(&move); |
1651 | 1659 |
1652 window2->SetCapture(); | 1660 window2->SetCapture(); |
1653 | 1661 |
1654 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " | 1662 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " |
1655 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " | 1663 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " |
1656 "TOUCH_CANCELLED GESTURE_SCROLL_END GESTURE_END", | 1664 "TOUCH_CANCELLED GESTURE_SCROLL_END GESTURE_END", |
1657 EventTypesToString(filter1->events())); | 1665 EventTypesToString(recorder1.events())); |
1658 | 1666 |
1659 EXPECT_TRUE(filter2->events().empty()); | 1667 EXPECT_TRUE(recorder2.events().empty()); |
1660 } | 1668 } |
1661 | 1669 |
1662 namespace { | 1670 namespace { |
1663 | 1671 |
1664 // This class creates and manages a window which is destroyed as soon as | 1672 // This class creates and manages a window which is destroyed as soon as |
1665 // capture is lost. This is the case for the drag and drop capture window. | 1673 // capture is lost. This is the case for the drag and drop capture window. |
1666 class CaptureWindowTracker : public test::TestWindowDelegate { | 1674 class CaptureWindowTracker : public test::TestWindowDelegate { |
1667 public: | 1675 public: |
1668 CaptureWindowTracker() {} | 1676 CaptureWindowTracker() {} |
1669 virtual ~CaptureWindowTracker() {} | 1677 virtual ~CaptureWindowTracker() {} |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 // The root receives both the ENTER and the MOVED events dispatched to | 1854 // The root receives both the ENTER and the MOVED events dispatched to |
1847 // |child|, as well as an EXIT event. | 1855 // |child|, as well as an EXIT event. |
1848 EXPECT_EQ(3, handler_root.num_mouse_events()); | 1856 EXPECT_EQ(3, handler_root.num_mouse_events()); |
1849 } | 1857 } |
1850 | 1858 |
1851 child->RemovePreTargetHandler(&handler_child); | 1859 child->RemovePreTargetHandler(&handler_child); |
1852 root_window()->RemovePreTargetHandler(&handler_root); | 1860 root_window()->RemovePreTargetHandler(&handler_root); |
1853 } | 1861 } |
1854 | 1862 |
1855 TEST_F(WindowEventDispatcherTestInHighDPI, TouchMovesHeldOnScroll) { | 1863 TEST_F(WindowEventDispatcherTestInHighDPI, TouchMovesHeldOnScroll) { |
1856 EventFilterRecorder* filter = new EventFilterRecorder; | 1864 EventFilterRecorder recorder; |
1857 root_window()->SetEventFilter(filter); | 1865 root_window()->AddPreTargetHandler(&recorder); |
1858 test::TestWindowDelegate delegate; | 1866 test::TestWindowDelegate delegate; |
1859 HoldPointerOnScrollHandler handler(host()->dispatcher(), filter); | 1867 HoldPointerOnScrollHandler handler(host()->dispatcher(), &recorder); |
1860 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1868 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1861 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 1869 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
1862 window->AddPreTargetHandler(&handler); | 1870 window->AddPreTargetHandler(&handler); |
1863 | 1871 |
1864 test::EventGenerator generator(root_window()); | 1872 test::EventGenerator generator(root_window()); |
1865 generator.GestureScrollSequence( | 1873 generator.GestureScrollSequence( |
1866 gfx::Point(120, 120), gfx::Point(20, 120), | 1874 gfx::Point(120, 120), gfx::Point(20, 120), |
1867 base::TimeDelta::FromMilliseconds(100), 25); | 1875 base::TimeDelta::FromMilliseconds(100), 25); |
1868 | 1876 |
1869 // |handler| will have reset |filter| and started holding the touch-move | 1877 // |handler| will have reset |filter| and started holding the touch-move |
1870 // events when scrolling started. At the end of the scroll (i.e. upon | 1878 // events when scrolling started. At the end of the scroll (i.e. upon |
1871 // touch-release), the held touch-move event will have been dispatched first, | 1879 // touch-release), the held touch-move event will have been dispatched first, |
1872 // along with the subsequent events (i.e. touch-release, scroll-end, and | 1880 // along with the subsequent events (i.e. touch-release, scroll-end, and |
1873 // gesture-end). | 1881 // gesture-end). |
1874 const EventFilterRecorder::Events& events = filter->events(); | 1882 const EventFilterRecorder::Events& events = recorder.events(); |
1875 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", | 1883 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_SCROLL_END GESTURE_END", |
1876 EventTypesToString(events)); | 1884 EventTypesToString(events)); |
1877 ASSERT_EQ(2u, filter->touch_locations().size()); | 1885 ASSERT_EQ(2u, recorder.touch_locations().size()); |
1878 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 1886 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
1879 filter->touch_locations()[0].ToString()); | 1887 recorder.touch_locations()[0].ToString()); |
1880 EXPECT_EQ(gfx::Point(-40, 10).ToString(), | 1888 EXPECT_EQ(gfx::Point(-40, 10).ToString(), |
1881 filter->touch_locations()[1].ToString()); | 1889 recorder.touch_locations()[1].ToString()); |
1882 } | 1890 } |
1883 | 1891 |
1884 class SelfDestructDelegate : public test::TestWindowDelegate { | 1892 class SelfDestructDelegate : public test::TestWindowDelegate { |
1885 public: | 1893 public: |
1886 SelfDestructDelegate() {} | 1894 SelfDestructDelegate() {} |
1887 virtual ~SelfDestructDelegate() {} | 1895 virtual ~SelfDestructDelegate() {} |
1888 | 1896 |
1889 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 1897 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
1890 window_.reset(); | 1898 window_.reset(); |
1891 } | 1899 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 delegate.GetMouseMotionCountsAndReset(); | 2125 delegate.GetMouseMotionCountsAndReset(); |
2118 | 2126 |
2119 // Notify both hosts that the cursor is now hidden. This should send a single | 2127 // Notify both hosts that the cursor is now hidden. This should send a single |
2120 // mouse-exit event to |window|. | 2128 // mouse-exit event to |window|. |
2121 host()->OnCursorVisibilityChanged(false); | 2129 host()->OnCursorVisibilityChanged(false); |
2122 second_host->OnCursorVisibilityChanged(false); | 2130 second_host->OnCursorVisibilityChanged(false); |
2123 EXPECT_EQ("0 0 1", delegate.GetMouseMotionCountsAndReset()); | 2131 EXPECT_EQ("0 0 1", delegate.GetMouseMotionCountsAndReset()); |
2124 } | 2132 } |
2125 | 2133 |
2126 } // namespace aura | 2134 } // namespace aura |
OLD | NEW |