OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/events/event_utils.h" | 5 #include "ui/events/event_utils.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/gfx/win/window_impl.h" | 8 #include "ui/gfx/win/window_impl.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class TestWindow : public gfx::WindowImpl { | 14 class TestWindow : public gfx::WindowImpl { |
15 public: | 15 public: |
16 TestWindow() {} | 16 TestWindow() {} |
17 ~TestWindow() override {} | 17 ~TestWindow() override {} |
18 | 18 |
19 BOOL ProcessWindowMessage(HWND window, | 19 BOOL ProcessWindowMessage(HWND window, |
20 UINT message, | 20 UINT message, |
21 WPARAM w_param, | 21 WPARAM w_param, |
22 LPARAM l_param, | 22 LPARAM l_param, |
23 LRESULT& result, | 23 LRESULT& result, |
24 DWORD msg_map_id = 0) { | 24 DWORD msg_map_id = 0) override { |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 private: | 28 private: |
29 DISALLOW_COPY_AND_ASSIGN(TestWindow); | 29 DISALLOW_COPY_AND_ASSIGN(TestWindow); |
30 }; | 30 }; |
31 | 31 |
32 MSG CreateEvent(UINT type, WORD x, WORD y, HWND hwnd) { | 32 MSG CreateEvent(UINT type, WORD x, WORD y, HWND hwnd) { |
33 MSG event; | 33 MSG event; |
34 event.message = type; | 34 event.message = type; |
(...skipping 22 matching lines...) Expand all Loading... |
57 } | 57 } |
58 | 58 |
59 MSG event = CreateEvent(WM_LBUTTONDOWN, x_coord, y_coord, test_window.hwnd()); | 59 MSG event = CreateEvent(WM_LBUTTONDOWN, x_coord, y_coord, test_window.hwnd()); |
60 EXPECT_EQ(gfx::Point(x_coord + x_window_offset, y_coord + y_window_offset), | 60 EXPECT_EQ(gfx::Point(x_coord + x_window_offset, y_coord + y_window_offset), |
61 EventSystemLocationFromNative(event)); | 61 EventSystemLocationFromNative(event)); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 } // namespace ui | 66 } // namespace ui |
OLD | NEW |