Commit bf9f2827 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[ozone/wayland] various driven-by style fixes.

Code in //ui/ozone/platform/wayland/fake_server.cc|h is quite
convoluted today. This a 3/n of a series of patches that clean it up.

Particularly, CL changes the wayland unittest's code to use the "bleh_"
terminology rather than "bleh" for class member declaration, as per
Chromium's coding style.

BUG=None
TBR=rjkroege@chromium.org

Change-Id: I3534937d2ed842b0723e622f39668d4ac6c557c0
Reviewed-on: https://chromium-review.googlesource.com/961143
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarAntonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#543072}
parent 4d51ebfa
......@@ -139,7 +139,7 @@ void GetPointer(wl_client* client, wl_resource* resource, uint32_t id) {
return;
}
auto* seat = GetUserDataAs<MockSeat>(resource);
seat->pointer.reset(new MockPointer(pointer_resource));
seat->pointer_.reset(new MockPointer(pointer_resource));
}
void GetKeyboard(wl_client* client, wl_resource* resource, uint32_t id) {
......@@ -150,7 +150,7 @@ void GetKeyboard(wl_client* client, wl_resource* resource, uint32_t id) {
return;
}
auto* seat = GetUserDataAs<MockSeat>(resource);
seat->keyboard.reset(new MockKeyboard(keyboard_resource));
seat->keyboard_.reset(new MockKeyboard(keyboard_resource));
}
void GetTouch(wl_client* client, wl_resource* resource, uint32_t id) {
......@@ -161,7 +161,7 @@ void GetTouch(wl_client* client, wl_resource* resource, uint32_t id) {
return;
}
auto* seat = GetUserDataAs<MockSeat>(resource);
seat->touch.reset(new MockTouch(touch_resource));
seat->touch_.reset(new MockTouch(touch_resource));
}
const struct wl_seat_interface seat_impl = {
......
......@@ -207,9 +207,9 @@ class MockSeat : public Global {
MockSeat();
~MockSeat() override;
std::unique_ptr<MockPointer> pointer;
std::unique_ptr<MockKeyboard> keyboard;
std::unique_ptr<MockTouch> touch;
std::unique_ptr<MockPointer> pointer_;
std::unique_ptr<MockKeyboard> keyboard_;
std::unique_ptr<MockTouch> touch_;
private:
DISALLOW_COPY_AND_ASSIGN(MockSeat);
......
......@@ -31,13 +31,13 @@ class WaylandKeyboardTest : public WaylandTest {
void SetUp() override {
WaylandTest::SetUp();
wl_seat_send_capabilities(server.seat()->resource(),
wl_seat_send_capabilities(server_.seat()->resource(),
WL_SEAT_CAPABILITY_KEYBOARD);
Sync();
keyboard = server.seat()->keyboard.get();
ASSERT_TRUE(keyboard);
keyboard_ = server_.seat()->keyboard_.get();
ASSERT_TRUE(keyboard_);
#if BUILDFLAG(USE_XKBCOMMON)
// Set up XKB bits and set the keymap to the client.
......@@ -54,14 +54,14 @@ class WaylandKeyboardTest : public WaylandTest {
bool rv = shared_keymap.CreateAndMapAnonymous(keymap_size);
DCHECK(rv);
memcpy(shared_keymap.memory(), keymap_string.get(), keymap_size);
wl_keyboard_send_keymap(keyboard->resource(),
wl_keyboard_send_keymap(keyboard_->resource(),
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
shared_keymap.handle().GetHandle(), keymap_size);
#endif
}
protected:
wl::MockKeyboard* keyboard;
wl::MockKeyboard* keyboard_;
private:
#if BUILDFLAG(USE_XKBCOMMON)
......@@ -81,14 +81,15 @@ ACTION_P(CloneEvent, ptr) {
TEST_P(WaylandKeyboardTest, Keypress) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
wl_keyboard_send_key(keyboard->resource(), 2, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
ASSERT_TRUE(event);
......@@ -98,27 +99,28 @@ TEST_P(WaylandKeyboardTest, Keypress) {
EXPECT_EQ(ui::VKEY_A, key_event->key_code());
EXPECT_EQ(ET_KEY_PRESSED, key_event->type());
wl_keyboard_send_leave(keyboard->resource(), 3, surface->resource());
wl_keyboard_send_leave(keyboard_->resource(), 3, surface_->resource());
Sync();
wl_keyboard_send_key(keyboard->resource(), 3, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 3, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
EXPECT_CALL(delegate, DispatchEvent(_)).Times(0);
EXPECT_CALL(delegate_, DispatchEvent(_)).Times(0);
}
TEST_P(WaylandKeyboardTest, AltModifierKeypress) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Alt
wl_keyboard_send_key(keyboard->resource(), 2, 0, 56 /* left Alt */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 56 /* left Alt */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
ASSERT_TRUE(event);
......@@ -134,15 +136,16 @@ TEST_P(WaylandKeyboardTest, AltModifierKeypress) {
TEST_P(WaylandKeyboardTest, ControlModifierKeypress) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Control
wl_keyboard_send_key(keyboard->resource(), 2, 0, 29 /* left Control */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 29 /* left Control */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
ASSERT_TRUE(event);
......@@ -158,15 +161,16 @@ TEST_P(WaylandKeyboardTest, ControlModifierKeypress) {
TEST_P(WaylandKeyboardTest, ShiftModifierKeypress) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Shift
wl_keyboard_send_key(keyboard->resource(), 2, 0, 42 /* left Shift */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 42 /* left Shift */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
ASSERT_TRUE(event);
......@@ -183,41 +187,42 @@ TEST_P(WaylandKeyboardTest, ControlShiftModifiers) {
struct wl_array empty;
wl_array_init(&empty);
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Pressing control.
wl_keyboard_send_key(keyboard->resource(), 2, 0, 29 /* Control */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 29 /* Control */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
wl_keyboard_send_modifiers(keyboard->resource(), 3, 4 /* mods_depressed*/,
wl_keyboard_send_modifiers(keyboard_->resource(), 3, 4 /* mods_depressed*/,
0 /* mods_latched */, 0 /* mods_locked */,
0 /* group */);
Sync();
// Pressing shift (with control key still held down).
wl_keyboard_send_key(keyboard->resource(), 4, 0, 42 /* Shift */,
wl_keyboard_send_key(keyboard_->resource(), 4, 0, 42 /* Shift */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event2;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
Sync();
wl_keyboard_send_modifiers(keyboard->resource(), 5, 5 /* mods_depressed*/,
wl_keyboard_send_modifiers(keyboard_->resource(), 5, 5 /* mods_depressed*/,
0 /* mods_latched */, 0 /* mods_locked */,
0 /* group */);
Sync();
// Sending a reguard keypress, eg 'a'.
wl_keyboard_send_key(keyboard->resource(), 6, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 6, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event3;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event3));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event3));
Sync();
ASSERT_TRUE(event3);
......@@ -234,15 +239,16 @@ TEST_P(WaylandKeyboardTest, CapsLockKeypress) {
struct wl_array empty;
wl_array_init(&empty);
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Capslock
wl_keyboard_send_key(keyboard->resource(), 2, 0, 58 /* Capslock */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 58 /* Capslock */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
ASSERT_TRUE(event);
......@@ -256,11 +262,11 @@ TEST_P(WaylandKeyboardTest, CapsLockKeypress) {
Sync();
wl_keyboard_send_key(keyboard->resource(), 2, 0, 58 /* Capslock */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 58 /* Capslock */,
WL_KEYBOARD_KEY_STATE_RELEASED);
std::unique_ptr<Event> event2;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
Sync();
ASSERT_TRUE(event2);
......@@ -278,41 +284,42 @@ TEST_P(WaylandKeyboardTest, CapsLockModifier) {
struct wl_array empty;
wl_array_init(&empty);
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Pressing capslock (led ON).
wl_keyboard_send_key(keyboard->resource(), 2, 0, 58 /* Capslock */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 58 /* Capslock */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
wl_keyboard_send_modifiers(keyboard->resource(), 3, 2 /* mods_depressed*/,
wl_keyboard_send_modifiers(keyboard_->resource(), 3, 2 /* mods_depressed*/,
0 /* mods_latched */, 2 /* mods_locked */,
0 /* group */);
Sync();
// Releasing capslock (led ON).
wl_keyboard_send_key(keyboard->resource(), 4, 0, 58 /* Capslock */,
wl_keyboard_send_key(keyboard_->resource(), 4, 0, 58 /* Capslock */,
WL_KEYBOARD_KEY_STATE_RELEASED);
std::unique_ptr<Event> event2;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
Sync();
wl_keyboard_send_modifiers(keyboard->resource(), 5, 0 /* mods_depressed*/,
wl_keyboard_send_modifiers(keyboard_->resource(), 5, 0 /* mods_depressed*/,
0 /* mods_latched */, 2 /* mods_locked */,
0 /* group */);
Sync();
// Sending a reguard keypress, eg 'a'.
wl_keyboard_send_key(keyboard->resource(), 6, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 6, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event3;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event3));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event3));
Sync();
ASSERT_TRUE(event3);
......@@ -330,20 +337,21 @@ TEST_P(WaylandKeyboardTest, EventAutoRepeat) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Auto repeat info in ms.
uint32_t rate = 75;
uint32_t delay = 25;
wl_keyboard_send_repeat_info(keyboard->resource(), rate, delay);
wl_keyboard_send_repeat_info(keyboard_->resource(), rate, delay);
wl_keyboard_send_key(keyboard->resource(), 2, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
......@@ -361,9 +369,9 @@ TEST_P(WaylandKeyboardTest, EventAutoRepeat) {
Sync();
std::unique_ptr<Event> event2;
EXPECT_CALL(delegate, DispatchEvent(_)).WillRepeatedly(CloneEvent(&event2));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillRepeatedly(CloneEvent(&event2));
wl_keyboard_send_key(keyboard->resource(), 3, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 3, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_RELEASED);
Sync();
}
......@@ -372,20 +380,21 @@ TEST_P(WaylandKeyboardTest, NoEventAutoRepeatOnLeave) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Auto repeat info in ms.
uint32_t rate = 75;
uint32_t delay = 25;
wl_keyboard_send_repeat_info(keyboard->resource(), rate, delay);
wl_keyboard_send_repeat_info(keyboard_->resource(), rate, delay);
wl_keyboard_send_key(keyboard->resource(), 2, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
......@@ -400,13 +409,13 @@ TEST_P(WaylandKeyboardTest, NoEventAutoRepeatOnLeave) {
base::TimeDelta::FromMilliseconds(rate * 2));
}
wl_keyboard_send_leave(keyboard->resource(), 3, surface->resource());
wl_keyboard_send_leave(keyboard_->resource(), 3, surface_->resource());
Sync();
EXPECT_CALL(delegate, DispatchEvent(_)).Times(0);
EXPECT_CALL(delegate_, DispatchEvent(_)).Times(0);
wl_keyboard_send_key(keyboard->resource(), 4, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 4, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_RELEASED);
Sync();
}
......@@ -415,20 +424,21 @@ TEST_P(WaylandKeyboardTest, NoEventAutoRepeatBeforeTimeout) {
struct wl_array empty;
wl_array_init(&empty);
wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty);
wl_keyboard_send_enter(keyboard_->resource(), 1, surface_->resource(),
&empty);
wl_array_release(&empty);
// Auto repeat info in ms.
uint32_t rate = 500;
uint32_t delay = 50;
wl_keyboard_send_repeat_info(keyboard->resource(), rate, delay);
wl_keyboard_send_repeat_info(keyboard_->resource(), rate, delay);
wl_keyboard_send_key(keyboard->resource(), 2, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 2, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_PRESSED);
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
......@@ -444,11 +454,11 @@ TEST_P(WaylandKeyboardTest, NoEventAutoRepeatBeforeTimeout) {
base::TimeDelta::FromMilliseconds(rate / 5));
}
wl_keyboard_send_key(keyboard->resource(), 4, 0, 30 /* a */,
wl_keyboard_send_key(keyboard_->resource(), 4, 0, 30 /* a */,
WL_KEYBOARD_KEY_STATE_RELEASED);
std::unique_ptr<Event> event2;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event2));
Sync();
ASSERT_TRUE(event2);
......
......@@ -25,17 +25,17 @@ class WaylandPointerTest : public WaylandTest {
void SetUp() override {
WaylandTest::SetUp();
wl_seat_send_capabilities(server.seat()->resource(),
wl_seat_send_capabilities(server_.seat()->resource(),
WL_SEAT_CAPABILITY_POINTER);
Sync();
pointer = server.seat()->pointer.get();
ASSERT_TRUE(pointer);
pointer_ = server_.seat()->pointer_.get();
ASSERT_TRUE(pointer_);
}
protected:
wl::MockPointer* pointer;
wl::MockPointer* pointer_;
private:
DISALLOW_COPY_AND_ASSIGN(WaylandPointerTest);
......@@ -43,7 +43,7 @@ class WaylandPointerTest : public WaylandTest {
TEST_P(WaylandPointerTest, Leave) {
MockPlatformWindowDelegate other_delegate;
WaylandWindow other_window(&other_delegate, connection.get(),
WaylandWindow other_window(&other_delegate, connection_.get(),
gfx::Rect(0, 0, 10, 10));
gfx::AcceleratedWidget other_widget = gfx::kNullAcceleratedWidget;
EXPECT_CALL(other_delegate, OnAcceleratedWidgetAvailable(_, _))
......@@ -54,16 +54,16 @@ TEST_P(WaylandPointerTest, Leave) {
Sync();
wl::MockSurface* other_surface =
server.GetObject<wl::MockSurface>(other_widget);
server_.GetObject<wl::MockSurface>(other_widget);
ASSERT_TRUE(other_surface);
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0);
wl_pointer_send_leave(pointer->resource(), 2, surface->resource());
wl_pointer_send_enter(pointer->resource(), 3, other_surface->resource(), 0,
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(), 0, 0);
wl_pointer_send_leave(pointer_->resource(), 2, surface_->resource());
wl_pointer_send_enter(pointer_->resource(), 3, other_surface->resource(), 0,
0);
wl_pointer_send_button(pointer->resource(), 4, 1004, BTN_LEFT,
wl_pointer_send_button(pointer_->resource(), 4, 1004, BTN_LEFT,
WL_POINTER_BUTTON_STATE_PRESSED);
EXPECT_CALL(delegate, DispatchEvent(_)).Times(1);
EXPECT_CALL(delegate_, DispatchEvent(_)).Times(1);
// Do an extra Sync() here so that we process the second enter event before we
// destroy |other_window|.
......@@ -75,12 +75,13 @@ ACTION_P(CloneEvent, ptr) {
}
TEST_P(WaylandPointerTest, Motion) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0);
wl_pointer_send_motion(pointer->resource(), 1002, wl_fixed_from_double(10.75),
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(), 0, 0);
wl_pointer_send_motion(pointer_->resource(), 1002,
wl_fixed_from_double(10.75),
wl_fixed_from_double(20.375));
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
Sync();
......@@ -95,15 +96,15 @@ TEST_P(WaylandPointerTest, Motion) {
}
TEST_P(WaylandPointerTest, MotionDragged) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0);
wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_MIDDLE,
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(), 0, 0);
wl_pointer_send_button(pointer_->resource(), 2, 1002, BTN_MIDDLE,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_motion(pointer->resource(), 1003, wl_fixed_from_int(400),
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_motion(pointer_->resource(), 1003, wl_fixed_from_int(400),
wl_fixed_from_int(500));
Sync();
......@@ -119,16 +120,16 @@ TEST_P(WaylandPointerTest, MotionDragged) {
}
TEST_P(WaylandPointerTest, ButtonPress) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(),
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(),
wl_fixed_from_int(200), wl_fixed_from_int(150));
wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_RIGHT,
wl_pointer_send_button(pointer_->resource(), 2, 1002, BTN_RIGHT,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_button(pointer->resource(), 3, 1003, BTN_LEFT,
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_button(pointer_->resource(), 3, 1003, BTN_LEFT,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
......@@ -145,18 +146,18 @@ TEST_P(WaylandPointerTest, ButtonPress) {
}
TEST_P(WaylandPointerTest, ButtonRelease) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(),
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(),
wl_fixed_from_int(50), wl_fixed_from_int(50));
wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_BACK,
wl_pointer_send_button(pointer_->resource(), 2, 1002, BTN_BACK,
WL_POINTER_BUTTON_STATE_PRESSED);
wl_pointer_send_button(pointer->resource(), 3, 1003, BTN_LEFT,
wl_pointer_send_button(pointer_->resource(), 3, 1003, BTN_LEFT,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_button(pointer->resource(), 4, 1004, BTN_LEFT,
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
wl_pointer_send_button(pointer_->resource(), 4, 1004, BTN_LEFT,
WL_POINTER_BUTTON_STATE_RELEASED);
Sync();
......@@ -173,17 +174,17 @@ TEST_P(WaylandPointerTest, ButtonRelease) {
}
TEST_P(WaylandPointerTest, AxisVertical) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(),
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(),
wl_fixed_from_int(0), wl_fixed_from_int(0));
wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_RIGHT,
wl_pointer_send_button(pointer_->resource(), 2, 1002, BTN_RIGHT,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
// Wayland servers typically send a value of 10 per mouse wheel click.
wl_pointer_send_axis(pointer->resource(), 1003,
wl_pointer_send_axis(pointer_->resource(), 1003,
WL_POINTER_AXIS_VERTICAL_SCROLL, wl_fixed_from_int(20));
Sync();
......@@ -200,17 +201,17 @@ TEST_P(WaylandPointerTest, AxisVertical) {
}
TEST_P(WaylandPointerTest, AxisHorizontal) {
wl_pointer_send_enter(pointer->resource(), 1, surface->resource(),
wl_pointer_send_enter(pointer_->resource(), 1, surface_->resource(),
wl_fixed_from_int(50), wl_fixed_from_int(75));
wl_pointer_send_button(pointer->resource(), 2, 1002, BTN_LEFT,
wl_pointer_send_button(pointer_->resource(), 2, 1002, BTN_LEFT,
WL_POINTER_BUTTON_STATE_PRESSED);
Sync();
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
// Wayland servers typically send a value of 10 per mouse wheel click.
wl_pointer_send_axis(pointer->resource(), 1003,
wl_pointer_send_axis(pointer_->resource(), 1003,
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
wl_fixed_from_int(10));
......
......@@ -19,13 +19,13 @@ namespace ui {
class WaylandSurfaceFactoryTest : public WaylandTest {
public:
WaylandSurfaceFactoryTest() : surface_factory(connection.get()) {}
WaylandSurfaceFactoryTest() : surface_factory(connection_.get()) {}
~WaylandSurfaceFactoryTest() override {}
void SetUp() override {
WaylandTest::SetUp();
canvas = surface_factory.CreateCanvasForWidget(widget);
canvas = surface_factory.CreateCanvasForWidget(widget_);
ASSERT_TRUE(canvas);
}
......@@ -41,11 +41,11 @@ TEST_P(WaylandSurfaceFactoryTest, Canvas) {
canvas->GetSurface();
canvas->PresentCanvas(gfx::Rect(5, 10, 20, 15));
Expectation damage = EXPECT_CALL(*surface, Damage(5, 10, 20, 15));
Expectation damage = EXPECT_CALL(*surface_, Damage(5, 10, 20, 15));
wl_resource* buffer_resource = nullptr;
Expectation attach = EXPECT_CALL(*surface, Attach(_, 0, 0))
Expectation attach = EXPECT_CALL(*surface_, Attach(_, 0, 0))
.WillOnce(SaveArg<0>(&buffer_resource));
EXPECT_CALL(*surface, Commit()).After(damage, attach);
EXPECT_CALL(*surface_, Commit()).After(damage, attach);
Sync();
......@@ -65,11 +65,11 @@ TEST_P(WaylandSurfaceFactoryTest, CanvasResize) {
canvas->GetSurface();
canvas->PresentCanvas(gfx::Rect(0, 0, 100, 50));
Expectation damage = EXPECT_CALL(*surface, Damage(0, 0, 100, 50));
Expectation damage = EXPECT_CALL(*surface_, Damage(0, 0, 100, 50));
wl_resource* buffer_resource = nullptr;
Expectation attach = EXPECT_CALL(*surface, Attach(_, 0, 0))
Expectation attach = EXPECT_CALL(*surface_, Attach(_, 0, 0))
.WillOnce(SaveArg<0>(&buffer_resource));
EXPECT_CALL(*surface, Commit()).After(damage, attach);
EXPECT_CALL(*surface_, Commit()).After(damage, attach);
Sync();
......
......@@ -27,48 +27,48 @@ WaylandTest::WaylandTest() {
KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
std::make_unique<StubKeyboardLayoutEngine>());
#endif
connection.reset(new WaylandConnection);
window = std::make_unique<WaylandWindow>(&delegate, connection.get(),
gfx::Rect(0, 0, 800, 600));
connection_.reset(new WaylandConnection);
window_ = std::make_unique<WaylandWindow>(&delegate_, connection_.get(),
gfx::Rect(0, 0, 800, 600));
}
WaylandTest::~WaylandTest() {}
void WaylandTest::SetUp() {
ASSERT_TRUE(server.Start(GetParam()));
ASSERT_TRUE(connection->Initialize());
EXPECT_CALL(delegate, OnAcceleratedWidgetAvailable(_, _))
.WillOnce(SaveArg<0>(&widget));
ASSERT_TRUE(window->Initialize());
ASSERT_NE(widget, gfx::kNullAcceleratedWidget);
ASSERT_TRUE(server_.Start(GetParam()));
ASSERT_TRUE(connection_->Initialize());
EXPECT_CALL(delegate_, OnAcceleratedWidgetAvailable(_, _))
.WillOnce(SaveArg<0>(&widget_));
ASSERT_TRUE(window_->Initialize());
ASSERT_NE(widget_, gfx::kNullAcceleratedWidget);
// Wait for the client to flush all pending requests from initialization.
base::RunLoop().RunUntilIdle();
// Pause the server after it has responded to all incoming events.
server.Pause();
server_.Pause();
surface = server.GetObject<wl::MockSurface>(widget);
ASSERT_TRUE(surface);
surface_ = server_.GetObject<wl::MockSurface>(widget_);
ASSERT_TRUE(surface_);
initialized = true;
initialized_ = true;
}
void WaylandTest::TearDown() {
if (initialized)
if (initialized_)
Sync();
}
void WaylandTest::Sync() {
// Resume the server, flushing its pending events.
server.Resume();
server_.Resume();
// Wait for the client to finish processing these events.
base::RunLoop().RunUntilIdle();
// Pause the server, after it has finished processing any follow-up requests
// from the client.
server.Pause();
server_.Pause();
}
} // namespace ui
......@@ -35,17 +35,17 @@ class WaylandTest : public ::testing::TestWithParam<uint32_t> {
void Sync();
private:
bool initialized = false;
base::MessageLoopForUI message_loop;
base::MessageLoopForUI message_loop_;
bool initialized_ = false;
protected:
wl::FakeServer server;
wl::MockSurface* surface;
wl::FakeServer server_;
wl::MockSurface* surface_;
MockPlatformWindowDelegate delegate;
std::unique_ptr<WaylandConnection> connection;
std::unique_ptr<WaylandWindow> window;
gfx::AcceleratedWidget widget = gfx::kNullAcceleratedWidget;
MockPlatformWindowDelegate delegate_;
std::unique_ptr<WaylandConnection> connection_;
std::unique_ptr<WaylandWindow> window_;
gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
private:
#if BUILDFLAG(USE_XKBCOMMON)
......
......@@ -33,13 +33,13 @@ class WaylandTouchTest : public WaylandTest {
void SetUp() override {
WaylandTest::SetUp();
wl_seat_send_capabilities(server.seat()->resource(),
wl_seat_send_capabilities(server_.seat()->resource(),
WL_SEAT_CAPABILITY_TOUCH);
Sync();
touch = server.seat()->touch.get();
ASSERT_TRUE(touch);
touch_ = server_.seat()->touch_.get();
ASSERT_TRUE(touch_);
}
protected:
......@@ -51,7 +51,7 @@ class WaylandTouchTest : public WaylandTest {
EXPECT_EQ(event_type, key_event->type());
}
wl::MockTouch* touch;
wl::MockTouch* touch_;
private:
DISALLOW_COPY_AND_ASSIGN(WaylandTouchTest);
......@@ -59,21 +59,21 @@ class WaylandTouchTest : public WaylandTest {
TEST_P(WaylandTouchTest, KeypressAndMotion) {
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillRepeatedly(CloneEvent(&event));
EXPECT_CALL(delegate_, DispatchEvent(_)).WillRepeatedly(CloneEvent(&event));
wl_touch_send_down(touch->resource(), 1, 0, surface->resource(), 0 /* id */,
wl_touch_send_down(touch_->resource(), 1, 0, surface_->resource(), 0 /* id */,
wl_fixed_from_int(50), wl_fixed_from_int(100));
Sync();
CheckEventType(ui::ET_TOUCH_PRESSED, event.get());
wl_touch_send_motion(touch->resource(), 500, 0 /* id */,
wl_touch_send_motion(touch_->resource(), 500, 0 /* id */,
wl_fixed_from_int(100), wl_fixed_from_int(100));
Sync();
CheckEventType(ui::ET_TOUCH_MOVED, event.get());
wl_touch_send_up(touch->resource(), 1, 1000, 0 /* id */);
wl_touch_send_up(touch_->resource(), 1, 1000, 0 /* id */);
Sync();
CheckEventType(ui::ET_TOUCH_RELEASED, event.get());
......
......@@ -38,7 +38,7 @@ class WaylandWindowTest : public WaylandTest {
void SetUp() override {
WaylandTest::SetUp();
xdg_surface = surface->xdg_surface.get();
xdg_surface = surface_->xdg_surface.get();
ASSERT_TRUE(xdg_surface);
}
......@@ -90,25 +90,26 @@ class WaylandWindowTest : public WaylandTest {
TEST_P(WaylandWindowTest, SetTitle) {
EXPECT_CALL(*GetXdgSurface(), SetTitle(StrEq("hello")));
window->SetTitle(base::ASCIIToUTF16("hello"));
window_->SetTitle(base::ASCIIToUTF16("hello"));
}
TEST_P(WaylandWindowTest, MaximizeAndRestore) {
wl_array states;
InitializeWlArrayWithActivatedState(&states);
EXPECT_CALL(delegate,
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_MAXIMIZED)));
SetWlArrayWithState(XDG_SURFACE_STATE_MAXIMIZED, &states);
EXPECT_CALL(*GetXdgSurface(), SetMaximized());
window->Maximize();
window_->Maximize();
SendConfigureEvent(0, 0, 1, &states);
Sync();
EXPECT_CALL(delegate, OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
EXPECT_CALL(*GetXdgSurface(), UnsetMaximized());
window->Restore();
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 2, &states);
......@@ -120,7 +121,8 @@ TEST_P(WaylandWindowTest, Minimize) {
wl_array_init(&states);
// Initialize to normal first.
EXPECT_CALL(delegate, OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
SendConfigureEvent(0, 0, 1, &states);
Sync();
......@@ -129,8 +131,8 @@ TEST_P(WaylandWindowTest, Minimize) {
// notified about the state, because 1) minimized state was set manually
// in WaylandWindow, and it has been confirmed in a back call from the server,
// which resulted in the same state as before.
EXPECT_CALL(delegate, OnWindowStateChanged(_)).Times(0);
window->Minimize();
EXPECT_CALL(delegate_, OnWindowStateChanged(_)).Times(0);
window_->Minimize();
// Reinitialize wl_array, which removes previous old states.
wl_array_init(&states);
SendConfigureEvent(0, 0, 2, &states);
......@@ -144,15 +146,16 @@ TEST_P(WaylandWindowTest, SetFullscreenAndRestore) {
SetWlArrayWithState(XDG_SURFACE_STATE_FULLSCREEN, &states);
EXPECT_CALL(*GetXdgSurface(), SetFullscreen());
EXPECT_CALL(delegate,
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_FULLSCREEN)));
window->ToggleFullscreen();
window_->ToggleFullscreen();
SendConfigureEvent(0, 0, 1, &states);
Sync();
EXPECT_CALL(*GetXdgSurface(), UnsetFullscreen());
EXPECT_CALL(delegate, OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
window->Restore();
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 2, &states);
......@@ -164,25 +167,26 @@ TEST_P(WaylandWindowTest, SetMaximizedFullscreenAndRestore) {
InitializeWlArrayWithActivatedState(&states);
EXPECT_CALL(*GetXdgSurface(), SetMaximized());
EXPECT_CALL(delegate,
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_MAXIMIZED)));
window->Maximize();
window_->Maximize();
SetWlArrayWithState(XDG_SURFACE_STATE_MAXIMIZED, &states);
SendConfigureEvent(0, 0, 2, &states);
Sync();
EXPECT_CALL(*GetXdgSurface(), SetFullscreen());
EXPECT_CALL(delegate,
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_FULLSCREEN)));
window->ToggleFullscreen();
window_->ToggleFullscreen();
SetWlArrayWithState(XDG_SURFACE_STATE_FULLSCREEN, &states);
SendConfigureEvent(0, 0, 3, &states);
Sync();
EXPECT_CALL(*GetXdgSurface(), UnsetFullscreen());
EXPECT_CALL(*GetXdgSurface(), UnsetMaximized());
EXPECT_CALL(delegate, OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
window->Restore();
EXPECT_CALL(delegate_,
OnWindowStateChanged(Eq(PLATFORM_WINDOW_STATE_NORMAL)));
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 4, &states);
......@@ -190,26 +194,26 @@ TEST_P(WaylandWindowTest, SetMaximizedFullscreenAndRestore) {
}
TEST_P(WaylandWindowTest, RestoreBoundsAfterMaximize) {
const gfx::Rect current_bounds = window->GetBounds();
const gfx::Rect current_bounds = window_->GetBounds();
wl_array states;
InitializeWlArrayWithActivatedState(&states);
const gfx::Rect maximized_bounds = gfx::Rect(0, 0, 1024, 768);
EXPECT_CALL(delegate, OnBoundsChanged(Eq(maximized_bounds)));
window->Maximize();
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(maximized_bounds)));
window_->Maximize();
SetWlArrayWithState(XDG_SURFACE_STATE_MAXIMIZED, &states);
SendConfigureEvent(maximized_bounds.width(), maximized_bounds.height(), 1,
&states);
Sync();
EXPECT_CALL(delegate, OnBoundsChanged(Eq(current_bounds)));
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(current_bounds)));
// Both in XdgV5 and XdgV6, surfaces implement SetWindowGeometry method.
// Thus, using a toplevel object in XdgV6 case is not right thing. Use a
// surface here instead.
EXPECT_CALL(*xdg_surface, SetWindowGeometry(0, 0, current_bounds.width(),
current_bounds.height()));
window->Restore();
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 2, &states);
......@@ -217,26 +221,26 @@ TEST_P(WaylandWindowTest, RestoreBoundsAfterMaximize) {
}
TEST_P(WaylandWindowTest, RestoreBoundsAfterFullscreen) {
const gfx::Rect current_bounds = window->GetBounds();
const gfx::Rect current_bounds = window_->GetBounds();
wl_array states;
InitializeWlArrayWithActivatedState(&states);
const gfx::Rect fullscreen_bounds = gfx::Rect(0, 0, 1280, 720);
EXPECT_CALL(delegate, OnBoundsChanged(Eq(fullscreen_bounds)));
window->ToggleFullscreen();
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(fullscreen_bounds)));
window_->ToggleFullscreen();
SetWlArrayWithState(XDG_SURFACE_STATE_FULLSCREEN, &states);
SendConfigureEvent(fullscreen_bounds.width(), fullscreen_bounds.height(), 1,
&states);
Sync();
EXPECT_CALL(delegate, OnBoundsChanged(Eq(current_bounds)));
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(current_bounds)));
// Both in XdgV5 and XdgV6, surfaces implement SetWindowGeometry method.
// Thus, using a toplevel object in XdgV6 case is not right thing. Use a
// surface here instead.
EXPECT_CALL(*xdg_surface, SetWindowGeometry(0, 0, current_bounds.width(),
current_bounds.height()));
window->Restore();
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 2, &states);
......@@ -244,29 +248,29 @@ TEST_P(WaylandWindowTest, RestoreBoundsAfterFullscreen) {
}
TEST_P(WaylandWindowTest, RestoreBoundsAfterMaximizeAndFullscreen) {
const gfx::Rect current_bounds = window->GetBounds();
const gfx::Rect current_bounds = window_->GetBounds();
wl_array states;
InitializeWlArrayWithActivatedState(&states);
const gfx::Rect maximized_bounds = gfx::Rect(0, 0, 1024, 768);
EXPECT_CALL(delegate, OnBoundsChanged(Eq(maximized_bounds)));
window->Maximize();
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(maximized_bounds)));
window_->Maximize();
SetWlArrayWithState(XDG_SURFACE_STATE_MAXIMIZED, &states);
SendConfigureEvent(maximized_bounds.width(), maximized_bounds.height(), 1,
&states);
Sync();
const gfx::Rect fullscreen_bounds = gfx::Rect(0, 0, 1280, 720);
EXPECT_CALL(delegate, OnBoundsChanged(Eq(fullscreen_bounds)));
window->ToggleFullscreen();
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(fullscreen_bounds)));
window_->ToggleFullscreen();
SetWlArrayWithState(XDG_SURFACE_STATE_FULLSCREEN, &states);
SendConfigureEvent(fullscreen_bounds.width(), fullscreen_bounds.height(), 2,
&states);
Sync();
EXPECT_CALL(delegate, OnBoundsChanged(Eq(maximized_bounds)));
window->Maximize();
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(maximized_bounds)));
window_->Maximize();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SetWlArrayWithState(XDG_SURFACE_STATE_MAXIMIZED, &states);
......@@ -274,13 +278,13 @@ TEST_P(WaylandWindowTest, RestoreBoundsAfterMaximizeAndFullscreen) {
&states);
Sync();
EXPECT_CALL(delegate, OnBoundsChanged(Eq(current_bounds)));
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(current_bounds)));
// Both in XdgV5 and XdgV6, surfaces implement SetWindowGeometry method.
// Thus, using a toplevel object in XdgV6 case is not right thing. Use a
// surface here instead.
EXPECT_CALL(*xdg_surface, SetWindowGeometry(0, 0, current_bounds.width(),
current_bounds.height()));
window->Restore();
window_->Restore();
// Reinitialize wl_array, which removes previous old states.
InitializeWlArrayWithActivatedState(&states);
SendConfigureEvent(0, 0, 4, &states);
......@@ -288,12 +292,12 @@ TEST_P(WaylandWindowTest, RestoreBoundsAfterMaximizeAndFullscreen) {
}
TEST_P(WaylandWindowTest, SendsBoundsOnRequest) {
const gfx::Rect initial_bounds = window->GetBounds();
const gfx::Rect initial_bounds = window_->GetBounds();
const gfx::Rect new_bounds = gfx::Rect(0, 0, initial_bounds.width() + 10,
initial_bounds.height() + 10);
EXPECT_CALL(delegate, OnBoundsChanged(Eq(new_bounds)));
window->SetBounds(new_bounds);
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(new_bounds)));
window_->SetBounds(new_bounds);
wl_array states;
InitializeWlArrayWithActivatedState(&states);
......@@ -314,17 +318,17 @@ TEST_P(WaylandWindowTest, SendsBoundsOnRequest) {
}
TEST_P(WaylandWindowTest, CanDispatchMouseEventDefault) {
EXPECT_FALSE(window->CanDispatchEvent(&test_mouse_event));
EXPECT_FALSE(window_->CanDispatchEvent(&test_mouse_event));
}
TEST_P(WaylandWindowTest, CanDispatchMouseEventFocus) {
window->set_pointer_focus(true);
EXPECT_TRUE(window->CanDispatchEvent(&test_mouse_event));
window_->set_pointer_focus(true);
EXPECT_TRUE(window_->CanDispatchEvent(&test_mouse_event));
}
TEST_P(WaylandWindowTest, CanDispatchMouseEventUnfocus) {
window->set_pointer_focus(false);
EXPECT_FALSE(window->CanDispatchEvent(&test_mouse_event));
window_->set_pointer_focus(false);
EXPECT_FALSE(window_->CanDispatchEvent(&test_mouse_event));
}
ACTION_P(CloneEvent, ptr) {
......@@ -333,8 +337,8 @@ ACTION_P(CloneEvent, ptr) {
TEST_P(WaylandWindowTest, DispatchEvent) {
std::unique_ptr<Event> event;
EXPECT_CALL(delegate, DispatchEvent(_)).WillOnce(CloneEvent(&event));
window->DispatchEvent(&test_mouse_event);
EXPECT_CALL(delegate_, DispatchEvent(_)).WillOnce(CloneEvent(&event));
window_->DispatchEvent(&test_mouse_event);
ASSERT_TRUE(event);
ASSERT_TRUE(event->IsMouseEvent());
auto* mouse_event = event->AsMouseEvent();
......@@ -354,7 +358,7 @@ TEST_P(WaylandWindowTest, ConfigureEvent) {
// Make sure that the implementation does not call OnBoundsChanged for each
// configure event if it receives multiple in a row.
EXPECT_CALL(delegate, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000))));
EXPECT_CALL(delegate_, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000))));
// Responding to a configure event, the window geometry in here must respect
// the sizing negotiations specified by the configure event.
// |xdg_surface| must receive the following calls in both xdg_shell_v5 and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment