| Index: ui/views/widget/widget_interactive_uitest.cc
|
| diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
|
| index 45026a9eb1e79064bc024dcb5279e2ab30850b83..54293c3f29e3b10c6f77297a9884095029507689 100644
|
| --- a/ui/views/widget/widget_interactive_uitest.cc
|
| +++ b/ui/views/widget/widget_interactive_uitest.cc
|
| @@ -866,7 +866,6 @@ class WidgetCaptureTest : public ViewsTestBase {
|
| EXPECT_FALSE(widget2.GetAndClearGotCaptureLost());
|
| }
|
|
|
| - private:
|
| NativeWidget* CreateNativeWidget(bool create_desktop_native_widget,
|
| Widget* widget) {
|
| #if !defined(OS_CHROMEOS)
|
| @@ -876,6 +875,7 @@ class WidgetCaptureTest : public ViewsTestBase {
|
| return NULL;
|
| }
|
|
|
| + private:
|
| DISALLOW_COPY_AND_ASSIGN(WidgetCaptureTest);
|
| };
|
|
|
| @@ -891,6 +891,46 @@ TEST_F(WidgetCaptureTest, CaptureDesktopNativeWidget) {
|
| }
|
| #endif
|
|
|
| +// Test that a synthetic mouse exit is sent to the widget which was handling
|
| +// mouse events when a different widget grabs capture.
|
| +TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) {
|
| + Widget widget1;
|
| + Widget::InitParams params1 =
|
| + CreateParams(Widget::InitParams::TYPE_WINDOW);
|
| + params1.native_widget = CreateNativeWidget(true, &widget1);
|
| + params1.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + widget1.Init(params1);
|
| + MouseView* contents_view1 = new MouseView;
|
| + widget1.SetContentsView(contents_view1);
|
| + widget1.Show();
|
| +
|
| + Widget widget2;
|
| + Widget::InitParams params2 =
|
| + CreateParams(Widget::InitParams::TYPE_WINDOW);
|
| + params2.native_widget = CreateNativeWidget(true, &widget2);
|
| + params2.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + widget2.Init(params2);
|
| + MouseView* contents_view2 = new MouseView;
|
| + widget2.SetContentsView(contents_view2);
|
| + widget2.Show();
|
| +
|
| + ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(),
|
| + gfx::Point(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::EventDispatchDetails details = widget1.GetNativeWindow()->GetHost()->
|
| + event_processor()->OnEventFromSource(&mouse_move_event);
|
| + ASSERT_FALSE(details.dispatcher_destroyed);
|
| + EXPECT_EQ(1, contents_view1->EnteredCalls());
|
| + EXPECT_EQ(0, contents_view1->ExitedCalls());
|
| +
|
| + widget2.SetCapture(NULL);
|
| + EXPECT_EQ(0, contents_view1->EnteredCalls());
|
| + // Grabbing native capture on Windows generates a ui::ET_MOUSE_EXITED event
|
| + // in addition to the one generated by Chrome.
|
| + EXPECT_LT(0, contents_view1->ExitedCalls());
|
| + EXPECT_EQ(0, contents_view2->ExitedCalls());
|
| +
|
| +}
|
| +
|
| #if !defined(OS_CHROMEOS)
|
| namespace {
|
|
|
|
|