| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 // when the focused window does not live in the dispatcher's tree. | 1824 // when the focused window does not live in the dispatcher's tree. |
| 1825 TEST_F(WindowEventDispatcherTest, HostCancelModeWithFocusedWindowOutside) { | 1825 TEST_F(WindowEventDispatcherTest, HostCancelModeWithFocusedWindowOutside) { |
| 1826 test::TestWindowDelegate delegate; | 1826 test::TestWindowDelegate delegate; |
| 1827 scoped_ptr<Window> focused(CreateTestWindowWithDelegate(&delegate, 123, | 1827 scoped_ptr<Window> focused(CreateTestWindowWithDelegate(&delegate, 123, |
| 1828 gfx::Rect(20, 30, 100, 50), NULL)); | 1828 gfx::Rect(20, 30, 100, 50), NULL)); |
| 1829 StaticFocusClient focus_client(focused.get()); | 1829 StaticFocusClient focus_client(focused.get()); |
| 1830 client::SetFocusClient(root_window(), &focus_client); | 1830 client::SetFocusClient(root_window(), &focus_client); |
| 1831 EXPECT_FALSE(root_window()->Contains(focused.get())); | 1831 EXPECT_FALSE(root_window()->Contains(focused.get())); |
| 1832 EXPECT_EQ(focused.get(), | 1832 EXPECT_EQ(focused.get(), |
| 1833 client::GetFocusClient(root_window())->GetFocusedWindow()); | 1833 client::GetFocusClient(root_window())->GetFocusedWindow()); |
| 1834 dispatcher()->DispatchCancelModeEvent(); | 1834 dispatcher()->AsWindowTreeHostDelegate()->OnHostCancelMode(); |
| 1835 EXPECT_EQ(focused.get(), | 1835 EXPECT_EQ(focused.get(), |
| 1836 client::GetFocusClient(root_window())->GetFocusedWindow()); | 1836 client::GetFocusClient(root_window())->GetFocusedWindow()); |
| 1837 } | 1837 } |
| 1838 | 1838 |
| 1839 // Dispatches a mouse-move event to |target| when it receives a mouse-move | 1839 // Dispatches a mouse-move event to |target| when it receives a mouse-move |
| 1840 // event. | 1840 // event. |
| 1841 class DispatchEventHandler : public ui::EventHandler { | 1841 class DispatchEventHandler : public ui::EventHandler { |
| 1842 public: | 1842 public: |
| 1843 explicit DispatchEventHandler(Window* target) | 1843 explicit DispatchEventHandler(Window* target) |
| 1844 : target_(target), | 1844 : target_(target), |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 EXPECT_TRUE(details.target_destroyed); | 1936 EXPECT_TRUE(details.target_destroyed); |
| 1937 EXPECT_EQ(first.get(), move.target()); | 1937 EXPECT_EQ(first.get(), move.target()); |
| 1938 EXPECT_TRUE(dispatch_event.dispatched()); | 1938 EXPECT_TRUE(dispatch_event.dispatched()); |
| 1939 EXPECT_EQ(second_root, first->GetRootWindow()); | 1939 EXPECT_EQ(second_root, first->GetRootWindow()); |
| 1940 | 1940 |
| 1941 first->RemovePreTargetHandler(&dispatch_event); | 1941 first->RemovePreTargetHandler(&dispatch_event); |
| 1942 second->RemovePreTargetHandler(&move_window); | 1942 second->RemovePreTargetHandler(&move_window); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 } // namespace aura | 1945 } // namespace aura |
| OLD | NEW |