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 "services/ui/ws/event_dispatcher.h" | 5 #include "services/ui/ws/event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 ServerWindow* EventDispatcherTest::GetActiveSystemModalWindow() const { | 312 ServerWindow* EventDispatcherTest::GetActiveSystemModalWindow() const { |
313 ModalWindowController* mwc = | 313 ModalWindowController* mwc = |
314 EventDispatcherTestApi(event_dispatcher_.get()).modal_window_controller(); | 314 EventDispatcherTestApi(event_dispatcher_.get()).modal_window_controller(); |
315 return ModalWindowControllerTestApi(mwc).GetActiveSystemModalWindow(); | 315 return ModalWindowControllerTestApi(mwc).GetActiveSystemModalWindow(); |
316 } | 316 } |
317 | 317 |
318 void EventDispatcherTest::SetUp() { | 318 void EventDispatcherTest::SetUp() { |
319 testing::Test::SetUp(); | 319 testing::Test::SetUp(); |
320 | 320 |
321 window_delegate_.reset(new TestServerWindowDelegate()); | 321 window_delegate_ = base::MakeUnique<TestServerWindowDelegate>(); |
322 root_window_.reset(new ServerWindow(window_delegate_.get(), WindowId(1, 2))); | 322 root_window_ = |
| 323 base::MakeUnique<ServerWindow>(window_delegate_.get(), WindowId(1, 2)); |
323 window_delegate_->set_root_window(root_window_.get()); | 324 window_delegate_->set_root_window(root_window_.get()); |
324 root_window_->SetVisible(true); | 325 root_window_->SetVisible(true); |
325 | 326 |
326 test_event_dispatcher_delegate_.reset(new TestEventDispatcherDelegate(this)); | 327 test_event_dispatcher_delegate_ = |
327 event_dispatcher_.reset( | 328 base::MakeUnique<TestEventDispatcherDelegate>(this); |
328 new EventDispatcher(test_event_dispatcher_delegate_.get())); | 329 event_dispatcher_ = |
| 330 base::MakeUnique<EventDispatcher>(test_event_dispatcher_delegate_.get()); |
329 test_event_dispatcher_delegate_->set_root(root_window_.get()); | 331 test_event_dispatcher_delegate_->set_root(root_window_.get()); |
330 } | 332 } |
331 | 333 |
332 TEST_F(EventDispatcherTest, ProcessEvent) { | 334 TEST_F(EventDispatcherTest, ProcessEvent) { |
333 std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3)); | 335 std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3)); |
334 | 336 |
335 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 337 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
336 child->SetBounds(gfx::Rect(10, 10, 20, 20)); | 338 child->SetBounds(gfx::Rect(10, 10, 20, 20)); |
337 | 339 |
338 // Send event that is over child. | 340 // Send event that is over child. |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 // The delegate can decide if it really wants to forward the event or not. | 1704 // The delegate can decide if it really wants to forward the event or not. |
1703 EXPECT_EQ(child.get(), | 1705 EXPECT_EQ(child.get(), |
1704 test_event_dispatcher_delegate()->lost_capture_window()); | 1706 test_event_dispatcher_delegate()->lost_capture_window()); |
1705 EXPECT_EQ(child.get(), event_dispatcher()->capture_window()); | 1707 EXPECT_EQ(child.get(), event_dispatcher()->capture_window()); |
1706 EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id()); | 1708 EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id()); |
1707 } | 1709 } |
1708 | 1710 |
1709 } // namespace test | 1711 } // namespace test |
1710 } // namespace ws | 1712 } // namespace ws |
1711 } // namespace ui | 1713 } // namespace ui |
OLD | NEW |