OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 container->AddChildView(gesture); | 404 container->AddChildView(gesture); |
405 | 405 |
406 MouseView* mouse = new MouseView; | 406 MouseView* mouse = new MouseView; |
407 mouse->SetBounds(30, 0, 30, 30); | 407 mouse->SetBounds(30, 0, 30, 30); |
408 container->AddChildView(mouse); | 408 container->AddChildView(mouse); |
409 | 409 |
410 toplevel->SetSize(gfx::Size(100, 100)); | 410 toplevel->SetSize(gfx::Size(100, 100)); |
411 toplevel->Show(); | 411 toplevel->Show(); |
412 | 412 |
413 // Start a gesture on |gesture|. | 413 // Start a gesture on |gesture|. |
414 ui::GestureEvent tap_down(15, | 414 ui::GestureEvent tap_down(15, 15, 0, base::TimeTicks(), |
415 15, | |
416 0, | |
417 base::TimeDelta(), | |
418 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); | 415 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); |
419 ui::GestureEvent end(15, | 416 ui::GestureEvent end(15, 15, 0, base::TimeTicks(), |
420 15, | |
421 0, | |
422 base::TimeDelta(), | |
423 ui::GestureEventDetails(ui::ET_GESTURE_END)); | 417 ui::GestureEventDetails(ui::ET_GESTURE_END)); |
424 toplevel->OnGestureEvent(&tap_down); | 418 toplevel->OnGestureEvent(&tap_down); |
425 | 419 |
426 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| | 420 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| |
427 // will not receive the event. | 421 // will not receive the event. |
428 gfx::Point click_location(45, 15); | 422 gfx::Point click_location(45, 15); |
429 | 423 |
430 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, | 424 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, |
431 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 425 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
432 ui::EF_LEFT_MOUSE_BUTTON); | 426 ui::EF_LEFT_MOUSE_BUTTON); |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1788 |
1795 ui::KeyEvent key_event2(key_event); | 1789 ui::KeyEvent key_event2(key_event); |
1796 widget->OnKeyEvent(&key_event2); | 1790 widget->OnKeyEvent(&key_event2); |
1797 EXPECT_FALSE(key_event2.stopped_propagation()); | 1791 EXPECT_FALSE(key_event2.stopped_propagation()); |
1798 | 1792 |
1799 widget->CloseNow(); | 1793 widget->CloseNow(); |
1800 } | 1794 } |
1801 | 1795 |
1802 } // namespace test | 1796 } // namespace test |
1803 } // namespace views | 1797 } // namespace views |
OLD | NEW |