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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 dispatcher->RepostEvent(event.get()); | 2109 dispatcher->RepostEvent(event.get()); |
2110 } | 2110 } |
2111 | 2111 |
2112 std::unique_ptr<Window> window_; | 2112 std::unique_ptr<Window> window_; |
2113 ExitMessageLoopOnMousePress handler_; | 2113 ExitMessageLoopOnMousePress handler_; |
2114 | 2114 |
2115 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcherTestWithMessageLoop); | 2115 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcherTestWithMessageLoop); |
2116 }; | 2116 }; |
2117 | 2117 |
2118 TEST_P(WindowEventDispatcherTestWithMessageLoop, EventRepostedInNonNestedLoop) { | 2118 TEST_P(WindowEventDispatcherTestWithMessageLoop, EventRepostedInNonNestedLoop) { |
2119 CHECK(!message_loop()->is_running()); | 2119 ASSERT_FALSE(base::RunLoop::IsRunningOnCurrentThread()); |
2120 // Perform the test in a callback, so that it runs after the message-loop | 2120 // Perform the test in a callback, so that it runs after the message-loop |
2121 // starts. | 2121 // starts. |
2122 message_loop()->task_runner()->PostTask( | 2122 message_loop()->task_runner()->PostTask( |
2123 FROM_HERE, base::Bind(&WindowEventDispatcherTestWithMessageLoop::RunTest, | 2123 FROM_HERE, base::Bind(&WindowEventDispatcherTestWithMessageLoop::RunTest, |
2124 base::Unretained(this))); | 2124 base::Unretained(this))); |
2125 base::RunLoop().Run(); | 2125 base::RunLoop().Run(); |
2126 } | 2126 } |
2127 | 2127 |
2128 class WindowEventDispatcherTestInHighDPI : public WindowEventDispatcherTest { | 2128 class WindowEventDispatcherTestInHighDPI : public WindowEventDispatcherTest { |
2129 public: | 2129 public: |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2947 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); | 2947 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); |
2948 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); | 2948 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); |
2949 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); | 2949 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); |
2950 | 2950 |
2951 // After dispatch the location should fallback to that of the | 2951 // After dispatch the location should fallback to that of the |
2952 // WindowTreeClient, which defaults to 0,0. | 2952 // WindowTreeClient, which defaults to 0,0. |
2953 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); | 2953 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); |
2954 } | 2954 } |
2955 | 2955 |
2956 } // namespace aura | 2956 } // namespace aura |
OLD | NEW |