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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 widget.Show(); | 921 widget.Show(); |
922 ui::MouseEvent mouse_press_event(ui::ET_MOUSE_PRESSED, gfx::Point(300, 10), | 922 ui::MouseEvent mouse_press_event(ui::ET_MOUSE_PRESSED, gfx::Point(300, 10), |
923 gfx::Point(300, 10), ui::EF_NONE, ui::EF_NONE); | 923 gfx::Point(300, 10), ui::EF_NONE, ui::EF_NONE); |
924 ui::EventDispatchDetails details = widget.GetNativeWindow()->GetHost()-> | 924 ui::EventDispatchDetails details = widget.GetNativeWindow()->GetHost()-> |
925 event_processor()->OnEventFromSource(&mouse_press_event); | 925 event_processor()->OnEventFromSource(&mouse_press_event); |
926 ASSERT_FALSE(details.dispatcher_destroyed); | 926 ASSERT_FALSE(details.dispatcher_destroyed); |
927 EXPECT_FALSE(mouse_view1->pressed()); | 927 EXPECT_FALSE(mouse_view1->pressed()); |
928 EXPECT_TRUE(mouse_view2->pressed()); | 928 EXPECT_TRUE(mouse_view2->pressed()); |
929 } | 929 } |
930 | 930 |
931 #if !defined(OS_CHROMEOS) | 931 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) |
932 // Test that a synthetic mouse exit is sent to the widget which was handling | 932 // Test that a synthetic mouse exit is sent to the widget which was handling |
933 // mouse events when a different widget grabs capture. | 933 // mouse events when a different widget grabs capture. |
934 // TODO(pkotwicz): Make test pass on CrOS. | 934 // TODO(pkotwicz): Make test pass on CrOS and Windows. |
935 TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) { | 935 TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) { |
936 Widget widget1; | 936 Widget widget1; |
937 Widget::InitParams params1 = | 937 Widget::InitParams params1 = |
938 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 938 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
939 params1.native_widget = CreateNativeWidget(true, &widget1); | 939 params1.native_widget = CreateNativeWidget(true, &widget1); |
940 params1.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 940 params1.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
941 widget1.Init(params1); | 941 widget1.Init(params1); |
942 MouseView* mouse_view1 = new MouseView; | 942 MouseView* mouse_view1 = new MouseView; |
943 widget1.SetContentsView(mouse_view1); | 943 widget1.SetContentsView(mouse_view1); |
944 widget1.Show(); | 944 widget1.Show(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> | 1080 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> |
1081 GetHost()->event_processor()->OnEventFromSource(&mouse_event); | 1081 GetHost()->event_processor()->OnEventFromSource(&mouse_event); |
1082 ASSERT_FALSE(details.dispatcher_destroyed); | 1082 ASSERT_FALSE(details.dispatcher_destroyed); |
1083 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 1083 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
1084 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 1084 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
1085 } | 1085 } |
1086 #endif | 1086 #endif |
1087 | 1087 |
1088 } // namespace test | 1088 } // namespace test |
1089 } // namespace views | 1089 } // namespace views |
OLD | NEW |