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 <wayland-server-core.h> | 5 #include <wayland-server-core.h> |
6 #include <xdg-shell-unstable-v5-server-protocol.h> | 6 #include <xdg-shell-unstable-v5-server-protocol.h> |
7 | 7 |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ACTION_P(CloneEvent, ptr) { | 87 ACTION_P(CloneEvent, ptr) { |
88 *ptr = Event::Clone(*arg0); | 88 *ptr = Event::Clone(*arg0); |
89 } | 89 } |
90 | 90 |
91 TEST_F(WaylandWindowTest, DispatchEvent) { | 91 TEST_F(WaylandWindowTest, DispatchEvent) { |
92 std::unique_ptr<Event> event; | 92 std::unique_ptr<Event> event; |
93 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event)); | 93 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event)); |
94 window.DispatchEvent(&test_mouse_event); | 94 window.DispatchEvent(&test_mouse_event); |
95 ASSERT_TRUE(event); | 95 ASSERT_TRUE(event); |
96 ASSERT_TRUE(event->IsMouseEvent()); | 96 ASSERT_TRUE(event->IsMouseEvent()); |
97 auto mouse_event = event->AsMouseEvent(); | 97 auto* mouse_event = event->AsMouseEvent(); |
98 EXPECT_EQ(mouse_event->location_f(), test_mouse_event.location_f()); | 98 EXPECT_EQ(mouse_event->location_f(), test_mouse_event.location_f()); |
99 EXPECT_EQ(mouse_event->root_location_f(), test_mouse_event.root_location_f()); | 99 EXPECT_EQ(mouse_event->root_location_f(), test_mouse_event.root_location_f()); |
100 EXPECT_EQ(mouse_event->time_stamp(), test_mouse_event.time_stamp()); | 100 EXPECT_EQ(mouse_event->time_stamp(), test_mouse_event.time_stamp()); |
101 EXPECT_EQ(mouse_event->button_flags(), test_mouse_event.button_flags()); | 101 EXPECT_EQ(mouse_event->button_flags(), test_mouse_event.button_flags()); |
102 EXPECT_EQ(mouse_event->changed_button_flags(), | 102 EXPECT_EQ(mouse_event->changed_button_flags(), |
103 test_mouse_event.changed_button_flags()); | 103 test_mouse_event.changed_button_flags()); |
104 } | 104 } |
105 | 105 |
106 TEST_F(WaylandWindowTest, ConfigureEvent) { | 106 TEST_F(WaylandWindowTest, ConfigureEvent) { |
107 wl_array states; | 107 wl_array states; |
108 wl_array_init(&states); | 108 wl_array_init(&states); |
109 xdg_surface_send_configure(xdg_surface->resource(), 1000, 1000, &states, 12); | 109 xdg_surface_send_configure(xdg_surface->resource(), 1000, 1000, &states, 12); |
110 xdg_surface_send_configure(xdg_surface->resource(), 1500, 1000, &states, 13); | 110 xdg_surface_send_configure(xdg_surface->resource(), 1500, 1000, &states, 13); |
111 | 111 |
112 // Make sure that the implementation does not call OnBoundsChanged for each | 112 // Make sure that the implementation does not call OnBoundsChanged for each |
113 // configure event if it receives multiple in a row. | 113 // configure event if it receives multiple in a row. |
114 EXPECT_CALL(delegate, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000)))); | 114 EXPECT_CALL(delegate, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000)))); |
115 EXPECT_CALL(*xdg_surface, AckConfigure(13)); | 115 EXPECT_CALL(*xdg_surface, AckConfigure(13)); |
116 } | 116 } |
117 | 117 |
118 } // namespace ui | 118 } // namespace ui |
OLD | NEW |