Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: ui/ozone/platform/wayland/wayland_window_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 TEST_F(WaylandWindowTest, CanDispatchMouseEventUnfocus) { 81 TEST_F(WaylandWindowTest, CanDispatchMouseEventUnfocus) {
82 window.set_pointer_focus(false); 82 window.set_pointer_focus(false);
83 EXPECT_FALSE(window.CanDispatchEvent(&test_mouse_event)); 83 EXPECT_FALSE(window.CanDispatchEvent(&test_mouse_event));
84 } 84 }
85 85
86 ACTION_P(CloneEvent, ptr) { 86 ACTION_P(CloneEvent, ptr) {
87 *ptr = Event::Clone(*arg0); 87 *ptr = Event::Clone(*arg0);
88 } 88 }
89 89
90 TEST_F(WaylandWindowTest, DispatchEvent) { 90 TEST_F(WaylandWindowTest, DispatchEvent) {
91 scoped_ptr<Event> event; 91 std::unique_ptr<Event> event;
92 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event)); 92 EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
93 window.DispatchEvent(&test_mouse_event); 93 window.DispatchEvent(&test_mouse_event);
94 ASSERT_TRUE(event); 94 ASSERT_TRUE(event);
95 ASSERT_TRUE(event->IsMouseEvent()); 95 ASSERT_TRUE(event->IsMouseEvent());
96 auto mouse_event = static_cast<MouseEvent*>(event.get()); 96 auto mouse_event = static_cast<MouseEvent*>(event.get());
97 EXPECT_EQ(mouse_event->location_f(), test_mouse_event.location_f()); 97 EXPECT_EQ(mouse_event->location_f(), test_mouse_event.location_f());
98 EXPECT_EQ(mouse_event->root_location_f(), test_mouse_event.root_location_f()); 98 EXPECT_EQ(mouse_event->root_location_f(), test_mouse_event.root_location_f());
99 EXPECT_EQ(mouse_event->time_stamp(), test_mouse_event.time_stamp()); 99 EXPECT_EQ(mouse_event->time_stamp(), test_mouse_event.time_stamp());
100 EXPECT_EQ(mouse_event->button_flags(), test_mouse_event.button_flags()); 100 EXPECT_EQ(mouse_event->button_flags(), test_mouse_event.button_flags());
101 EXPECT_EQ(mouse_event->changed_button_flags(), 101 EXPECT_EQ(mouse_event->changed_button_flags(),
102 test_mouse_event.changed_button_flags()); 102 test_mouse_event.changed_button_flags());
103 } 103 }
104 104
105 TEST_F(WaylandWindowTest, ConfigureEvent) { 105 TEST_F(WaylandWindowTest, ConfigureEvent) {
106 wl_array states; 106 wl_array states;
107 wl_array_init(&states); 107 wl_array_init(&states);
108 xdg_surface_send_configure(xdg_surface->resource(), 1000, 1000, &states, 12); 108 xdg_surface_send_configure(xdg_surface->resource(), 1000, 1000, &states, 12);
109 xdg_surface_send_configure(xdg_surface->resource(), 1500, 1000, &states, 13); 109 xdg_surface_send_configure(xdg_surface->resource(), 1500, 1000, &states, 13);
110 110
111 // Make sure that the implementation does not call OnBoundsChanged for each 111 // Make sure that the implementation does not call OnBoundsChanged for each
112 // configure event if it receives multiple in a row. 112 // configure event if it receives multiple in a row.
113 EXPECT_CALL(delegate, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000)))); 113 EXPECT_CALL(delegate, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000))));
114 EXPECT_CALL(*xdg_surface, AckConfigure(13)); 114 EXPECT_CALL(*xdg_surface, AckConfigure(13));
115 } 115 }
116 116
117 } // namespace ui 117 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/wayland/wayland_surface_factory_unittest.cc ('k') | ui/ozone/platform/x11/ozone_platform_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698