OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/event_dispatcher.h" | 5 #include "components/mus/ws/event_dispatcher.h" |
6 | 6 |
7 #include "components/mus/public/cpp/event_matcher.h" | 7 #include "components/mus/public/cpp/event_matcher.h" |
8 #include "components/mus/ws/event_dispatcher_delegate.h" | 8 #include "components/mus/ws/event_dispatcher_delegate.h" |
9 #include "components/mus/ws/server_window.h" | 9 #include "components/mus/ws/server_window.h" |
10 #include "components/mus/ws/test_server_window_delegate.h" | 10 #include "components/mus/ws/test_server_window_delegate.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 window_delegate.set_root_window(&root); | 296 window_delegate.set_root_window(&root); |
297 root.SetVisible(true); | 297 root.SetVisible(true); |
298 | 298 |
299 ServerWindow child(&window_delegate, WindowId(1, 3)); | 299 ServerWindow child(&window_delegate, WindowId(1, 3)); |
300 root.Add(&child); | 300 root.Add(&child); |
301 child.SetVisible(true); | 301 child.SetVisible(true); |
302 | 302 |
303 root.SetBounds(gfx::Rect(0, 0, 100, 100)); | 303 root.SetBounds(gfx::Rect(0, 0, 100, 100)); |
304 child.SetBounds(gfx::Rect(10, 10, 20, 20)); | 304 child.SetBounds(gfx::Rect(10, 10, 20, 20)); |
305 | 305 |
306 child.SetClientArea(gfx::Rect(5, 5, 10, 10)); | 306 child.SetClientArea(gfx::Insets(5, 5, 5, 5)); |
307 | 307 |
308 TestEventDispatcherDelegate event_dispatcher_delegate(&root); | 308 TestEventDispatcherDelegate event_dispatcher_delegate(&root); |
309 EventDispatcher dispatcher(&event_dispatcher_delegate); | 309 EventDispatcher dispatcher(&event_dispatcher_delegate); |
310 dispatcher.set_root(&root); | 310 dispatcher.set_root(&root); |
311 | 311 |
312 // Start move loop by sending mouse event over non-client area. | 312 // Start move loop by sending mouse event over non-client area. |
313 const ui::MouseEvent press_event( | 313 const ui::MouseEvent press_event( |
314 ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12), | 314 ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12), |
315 base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 315 base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
316 dispatcher.OnEvent( | 316 dispatcher.OnEvent( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 base::TimeDelta()); | 495 base::TimeDelta()); |
496 dispatcher.OnEvent( | 496 dispatcher.OnEvent( |
497 mojom::Event::From(static_cast<const ui::Event&>(drag_event1))); | 497 mojom::Event::From(static_cast<const ui::Event&>(drag_event1))); |
498 EXPECT_EQ(nullptr, event_dispatcher_delegate.GetAndClearLastTarget()); | 498 EXPECT_EQ(nullptr, event_dispatcher_delegate.GetAndClearLastTarget()); |
499 EXPECT_EQ(nullptr, | 499 EXPECT_EQ(nullptr, |
500 event_dispatcher_delegate.GetAndClearLastDispatchedEvent().get()); | 500 event_dispatcher_delegate.GetAndClearLastDispatchedEvent().get()); |
501 } | 501 } |
502 | 502 |
503 } // namespace ws | 503 } // namespace ws |
504 } // namespace mus | 504 } // namespace mus |
OLD | NEW |