| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 display::Screen::GetScreen()->GetDisplayNearestPoint(gfx::Point())); | 454 display::Screen::GetScreen()->GetDisplayNearestPoint(gfx::Point())); |
| 455 | 455 |
| 456 EXPECT_EQ(new_pos, | 456 EXPECT_EQ(new_pos, |
| 457 popup_window.top_level_widget()->GetWindowBoundsInScreen()); | 457 popup_window.top_level_widget()->GetWindowBoundsInScreen()); |
| 458 | 458 |
| 459 ASSERT_NO_FATAL_FAILURE(popup_window.DestroyOwnedWindow()); | 459 ASSERT_NO_FATAL_FAILURE(popup_window.DestroyOwnedWindow()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 // The following code verifies we can correctly destroy a Widget from a mouse | 462 // The following code verifies we can correctly destroy a Widget from a mouse |
| 463 // enter/exit. We could test move/drag/enter/exit but in general we don't run | 463 // enter/exit. We could test move/drag/enter/exit but in general we don't run |
| 464 // nested message loops from such events, nor has the code ever really dealt | 464 // nested run loops from such events, nor has the code ever really dealt |
| 465 // with this situation. | 465 // with this situation. |
| 466 | 466 |
| 467 // Generates two moves (first generates enter, second real move), a press, drag | 467 // Generates two moves (first generates enter, second real move), a press, drag |
| 468 // and release stopping at |last_event_type|. | 468 // and release stopping at |last_event_type|. |
| 469 void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { | 469 void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { |
| 470 const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen()); | 470 const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen()); |
| 471 ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(), | 471 ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(), |
| 472 screen_bounds.CenterPoint(), ui::EventTimeForNow(), | 472 screen_bounds.CenterPoint(), ui::EventTimeForNow(), |
| 473 0, 0); | 473 0, 0); |
| 474 ui::EventSink* sink = WidgetTest::GetEventSink(widget); | 474 ui::EventSink* sink = WidgetTest::GetEventSink(widget); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); | 676 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); |
| 677 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); | 677 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); |
| 678 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); | 678 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); |
| 679 widget.CloseNow(); | 679 widget.CloseNow(); |
| 680 } | 680 } |
| 681 | 681 |
| 682 #endif // defined(OS_WIN) | 682 #endif // defined(OS_WIN) |
| 683 | 683 |
| 684 } // namespace test | 684 } // namespace test |
| 685 } // namespace views | 685 } // namespace views |
| OLD | NEW |