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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 container->AddChildView(gesture); | 400 container->AddChildView(gesture); |
401 | 401 |
402 MouseView* mouse = new MouseView; | 402 MouseView* mouse = new MouseView; |
403 mouse->SetBounds(30, 0, 30, 30); | 403 mouse->SetBounds(30, 0, 30, 30); |
404 container->AddChildView(mouse); | 404 container->AddChildView(mouse); |
405 | 405 |
406 toplevel->SetSize(gfx::Size(100, 100)); | 406 toplevel->SetSize(gfx::Size(100, 100)); |
407 toplevel->Show(); | 407 toplevel->Show(); |
408 | 408 |
409 // Start a gesture on |gesture|. | 409 // Start a gesture on |gesture|. |
410 ui::GestureEvent tap_down(15, | 410 ui::GestureEvent tap_down(15, 15, 0, base::TimeTicks(), |
411 15, | |
412 0, | |
413 base::TimeDelta(), | |
414 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); | 411 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); |
415 ui::GestureEvent end(15, | 412 ui::GestureEvent end(15, 15, 0, base::TimeTicks(), |
416 15, | |
417 0, | |
418 base::TimeDelta(), | |
419 ui::GestureEventDetails(ui::ET_GESTURE_END)); | 413 ui::GestureEventDetails(ui::ET_GESTURE_END)); |
420 toplevel->OnGestureEvent(&tap_down); | 414 toplevel->OnGestureEvent(&tap_down); |
421 | 415 |
422 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| | 416 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| |
423 // will not receive the event. | 417 // will not receive the event. |
424 gfx::Point click_location(45, 15); | 418 gfx::Point click_location(45, 15); |
425 | 419 |
426 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, | 420 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, |
427 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 421 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
428 ui::EF_LEFT_MOUSE_BUTTON); | 422 ui::EF_LEFT_MOUSE_BUTTON); |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 | 1752 |
1759 ui::KeyEvent key_event2(key_event); | 1753 ui::KeyEvent key_event2(key_event); |
1760 widget->OnKeyEvent(&key_event2); | 1754 widget->OnKeyEvent(&key_event2); |
1761 EXPECT_FALSE(key_event2.stopped_propagation()); | 1755 EXPECT_FALSE(key_event2.stopped_propagation()); |
1762 | 1756 |
1763 widget->CloseNow(); | 1757 widget->CloseNow(); |
1764 } | 1758 } |
1765 | 1759 |
1766 } // namespace test | 1760 } // namespace test |
1767 } // namespace views | 1761 } // namespace views |
OLD | NEW |