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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 dispatcher->RepostEvent(event.get()); | 2077 dispatcher->RepostEvent(event.get()); |
2078 } | 2078 } |
2079 | 2079 |
2080 std::unique_ptr<Window> window_; | 2080 std::unique_ptr<Window> window_; |
2081 ExitMessageLoopOnMousePress handler_; | 2081 ExitMessageLoopOnMousePress handler_; |
2082 | 2082 |
2083 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcherTestWithMessageLoop); | 2083 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcherTestWithMessageLoop); |
2084 }; | 2084 }; |
2085 | 2085 |
2086 TEST_P(WindowEventDispatcherTestWithMessageLoop, EventRepostedInNonNestedLoop) { | 2086 TEST_P(WindowEventDispatcherTestWithMessageLoop, EventRepostedInNonNestedLoop) { |
2087 CHECK(!message_loop()->is_running()); | 2087 ASSERT_FALSE(base::RunLoop::IsRunningOnCurrentThread()); |
2088 // Perform the test in a callback, so that it runs after the message-loop | 2088 // Perform the test in a callback, so that it runs after the message-loop |
2089 // starts. | 2089 // starts. |
2090 message_loop()->task_runner()->PostTask( | 2090 message_loop()->task_runner()->PostTask( |
2091 FROM_HERE, base::Bind(&WindowEventDispatcherTestWithMessageLoop::RunTest, | 2091 FROM_HERE, base::Bind(&WindowEventDispatcherTestWithMessageLoop::RunTest, |
2092 base::Unretained(this))); | 2092 base::Unretained(this))); |
2093 base::RunLoop().Run(); | 2093 base::RunLoop().Run(); |
2094 } | 2094 } |
2095 | 2095 |
2096 class WindowEventDispatcherTestInHighDPI : public WindowEventDispatcherTest { | 2096 class WindowEventDispatcherTestInHighDPI : public WindowEventDispatcherTest { |
2097 public: | 2097 public: |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); | 2915 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); |
2916 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); | 2916 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); |
2917 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); | 2917 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); |
2918 | 2918 |
2919 // After dispatch the location should fallback to that of the | 2919 // After dispatch the location should fallback to that of the |
2920 // WindowTreeClient, which defaults to 0,0. | 2920 // WindowTreeClient, which defaults to 0,0. |
2921 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); | 2921 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); |
2922 } | 2922 } |
2923 | 2923 |
2924 } // namespace aura | 2924 } // namespace aura |
OLD | NEW |