| 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 WindowEventDispatcherTestInHighDPI() {} | 2077 WindowEventDispatcherTestInHighDPI() {} |
| 2078 ~WindowEventDispatcherTestInHighDPI() override {} | 2078 ~WindowEventDispatcherTestInHighDPI() override {} |
| 2079 | 2079 |
| 2080 void DispatchEvent(ui::Event* event) { | 2080 void DispatchEvent(ui::Event* event) { |
| 2081 DispatchEventUsingWindowDispatcher(event); | 2081 DispatchEventUsingWindowDispatcher(event); |
| 2082 } | 2082 } |
| 2083 | 2083 |
| 2084 protected: | 2084 protected: |
| 2085 void SetUp() override { | 2085 void SetUp() override { |
| 2086 WindowEventDispatcherTest::SetUp(); | 2086 WindowEventDispatcherTest::SetUp(); |
| 2087 test_screen()->SetDeviceScaleFactor(2.f); | 2087 test_screen()->SetDeviceScaleFactorForTest(2.f); |
| 2088 } | 2088 } |
| 2089 }; | 2089 }; |
| 2090 | 2090 |
| 2091 TEST_F(WindowEventDispatcherTestInHighDPI, EventLocationTransform) { | 2091 TEST_F(WindowEventDispatcherTestInHighDPI, EventLocationTransform) { |
| 2092 test::TestWindowDelegate delegate; | 2092 test::TestWindowDelegate delegate; |
| 2093 std::unique_ptr<aura::Window> child(test::CreateTestWindowWithDelegate( | 2093 std::unique_ptr<aura::Window> child(test::CreateTestWindowWithDelegate( |
| 2094 &delegate, 1234, gfx::Rect(20, 20, 100, 100), root_window())); | 2094 &delegate, 1234, gfx::Rect(20, 20, 100, 100), root_window())); |
| 2095 child->Show(); | 2095 child->Show(); |
| 2096 | 2096 |
| 2097 ui::test::TestEventHandler handler_child; | 2097 ui::test::TestEventHandler handler_child; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 | 2654 |
| 2655 EventFilterRecorder recorder; | 2655 EventFilterRecorder recorder; |
| 2656 w->AddPreTargetHandler(&recorder); | 2656 w->AddPreTargetHandler(&recorder); |
| 2657 dispatcher->OnCursorMovedToRootLocation(gfx::Point(22, 22)); | 2657 dispatcher->OnCursorMovedToRootLocation(gfx::Point(22, 22)); |
| 2658 RunAllPendingInMessageLoop(); | 2658 RunAllPendingInMessageLoop(); |
| 2659 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_ENTERED)); | 2659 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_ENTERED)); |
| 2660 recorder.Reset(); | 2660 recorder.Reset(); |
| 2661 | 2661 |
| 2662 // The cursor should not be over |w| after changing the device scale factor to | 2662 // The cursor should not be over |w| after changing the device scale factor to |
| 2663 // 2x. A ET_MOUSE_EXITED event should have been sent to |w|. | 2663 // 2x. A ET_MOUSE_EXITED event should have been sent to |w|. |
| 2664 test_screen()->SetDeviceScaleFactor(2.f); | 2664 test_screen()->SetDeviceScaleFactorForTest(2.f); |
| 2665 dispatcher->OnCursorMovedToRootLocation(gfx::Point(11, 11)); | 2665 dispatcher->OnCursorMovedToRootLocation(gfx::Point(11, 11)); |
| 2666 RunAllPendingInMessageLoop(); | 2666 RunAllPendingInMessageLoop(); |
| 2667 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_EXITED)); | 2667 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_EXITED)); |
| 2668 | 2668 |
| 2669 w->RemovePreTargetHandler(&recorder); | 2669 w->RemovePreTargetHandler(&recorder); |
| 2670 } | 2670 } |
| 2671 | 2671 |
| 2672 } // namespace aura | 2672 } // namespace aura |
| OLD | NEW |