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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 container->AddChildView(mouse); | 294 container->AddChildView(mouse); |
295 | 295 |
296 toplevel->SetSize(gfx::Size(100, 100)); | 296 toplevel->SetSize(gfx::Size(100, 100)); |
297 toplevel->Show(); | 297 toplevel->Show(); |
298 | 298 |
299 // Start a gesture on |gesture|. | 299 // Start a gesture on |gesture|. |
300 ui::GestureEvent tap_down(15, | 300 ui::GestureEvent tap_down(15, |
301 15, | 301 15, |
302 0, | 302 0, |
303 base::TimeDelta(), | 303 base::TimeDelta(), |
304 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); | 304 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, |
| 305 0, |
| 306 0)); |
305 ui::GestureEvent end(15, | 307 ui::GestureEvent end(15, |
306 15, | 308 15, |
307 0, | 309 0, |
308 base::TimeDelta(), | 310 base::TimeDelta(), |
309 ui::GestureEventDetails(ui::ET_GESTURE_END)); | 311 ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); |
310 toplevel->OnGestureEvent(&tap_down); | 312 toplevel->OnGestureEvent(&tap_down); |
311 | 313 |
312 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| | 314 // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| |
313 // will not receive the event. | 315 // will not receive the event. |
314 gfx::Point click_location(45, 15); | 316 gfx::Point click_location(45, 15); |
315 | 317 |
316 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, | 318 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, |
317 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 319 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
318 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location, | 320 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location, |
319 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 321 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> | 1150 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> |
1149 GetHost()->event_processor()->OnEventFromSource(&mouse_event); | 1151 GetHost()->event_processor()->OnEventFromSource(&mouse_event); |
1150 ASSERT_FALSE(details.dispatcher_destroyed); | 1152 ASSERT_FALSE(details.dispatcher_destroyed); |
1151 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 1153 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
1152 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 1154 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
1153 } | 1155 } |
1154 #endif // defined(OS_WIN) | 1156 #endif // defined(OS_WIN) |
1155 | 1157 |
1156 } // namespace test | 1158 } // namespace test |
1157 } // namespace views | 1159 } // namespace views |
OLD | NEW |