OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" | 5 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" |
6 | 6 |
7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | 8 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
9 #include "ui/aura/test/aura_test_base.h" | 9 #include "ui/aura/test/aura_test_base.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 EXPECT_EQ(root_window(), move.target()); | 87 EXPECT_EQ(root_window(), move.target()); |
88 | 88 |
89 // But events within the shape will still reach the window. | 89 // But events within the shape will still reach the window. |
90 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, | 90 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, |
91 gfx::Point(80, 80), gfx::Point(80, 80), | 91 gfx::Point(80, 80), gfx::Point(80, 80), |
92 ui::EF_NONE, ui::EF_NONE); | 92 ui::EF_NONE, ui::EF_NONE); |
93 details = event_processor()->OnEventFromSource(&move2); | 93 details = event_processor()->OnEventFromSource(&move2); |
94 ASSERT_FALSE(details.dispatcher_destroyed); | 94 ASSERT_FALSE(details.dispatcher_destroyed); |
95 EXPECT_EQ(window, move2.target()); | 95 EXPECT_EQ(window, move2.target()); |
96 } | 96 } |
97 | |
98 region.reset(new SkRegion); | |
99 region->op(SkIRect::MakeXYWH(0, 0, 0, 0), SkRegion::kUnion_Op); | |
100 app_window()->UpdateShape(region.Pass()); | |
101 { | |
102 // With an empty custom shape, all events within the window should fall | |
103 // through to the root window. | |
104 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | |
tapted
2014/09/29 01:16:20
This is super-nitty, but I kinda feel this would b
garykac
2014/09/29 23:50:59
Moved.
| |
105 gfx::Point(40, 40), gfx::Point(40, 40), | |
106 ui::EF_NONE, ui::EF_NONE); | |
107 ui::EventDispatchDetails details = | |
108 event_processor()->OnEventFromSource(&move); | |
109 ASSERT_FALSE(details.dispatcher_destroyed); | |
110 EXPECT_EQ(root_window(), move.target()); | |
111 | |
112 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, | |
113 gfx::Point(80, 80), gfx::Point(80, 80), | |
114 ui::EF_NONE, ui::EF_NONE); | |
115 details = event_processor()->OnEventFromSource(&move2); | |
116 ASSERT_FALSE(details.dispatcher_destroyed); | |
117 EXPECT_EQ(root_window(), move2.target()); | |
118 } | |
97 } | 119 } |
98 | 120 |
99 TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) { | 121 TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) { |
100 // Install a window-targeter on the root window that allows a window to | 122 // Install a window-targeter on the root window that allows a window to |
101 // receive events outside of its bounds. Verify that this window-targeter is | 123 // receive events outside of its bounds. Verify that this window-targeter is |
102 // active unless the window has a custom shape. | 124 // active unless the window has a custom shape. |
103 gfx::Insets inset(-30, -30, -30, -30); | 125 gfx::Insets inset(-30, -30, -30, -30); |
104 root_window()->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 126 root_window()->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
105 new wm::EasyResizeWindowTargeter(root_window(), inset, inset))); | 127 new wm::EasyResizeWindowTargeter(root_window(), inset, inset))); |
106 | 128 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 244 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
223 gfx::Point(32, 37), gfx::Point(32, 37), | 245 gfx::Point(32, 37), gfx::Point(32, 37), |
224 ui::EF_NONE, ui::EF_NONE); | 246 ui::EF_NONE, ui::EF_NONE); |
225 ui::EventDispatchDetails details = | 247 ui::EventDispatchDetails details = |
226 event_processor()->OnEventFromSource(&move); | 248 event_processor()->OnEventFromSource(&move); |
227 ASSERT_FALSE(details.dispatcher_destroyed); | 249 ASSERT_FALSE(details.dispatcher_destroyed); |
228 EXPECT_EQ(window, move.target()); | 250 EXPECT_EQ(window, move.target()); |
229 } | 251 } |
230 #endif // defined (OS_CHROMEOS) | 252 #endif // defined (OS_CHROMEOS) |
231 } | 253 } |
OLD | NEW |