| 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 "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/ozone/platform/wayland/fake_server.h" | 10 #include "ui/ozone/platform/wayland/fake_server.h" |
| 11 #include "ui/ozone/platform/wayland/wayland_display.h" | 11 #include "ui/ozone/platform/wayland/wayland_connection.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 TEST(WaylandDisplayTest, UseUnstableVersion) { | 15 TEST(WaylandConnectionTest, UseUnstableVersion) { |
| 16 base::MessageLoopForUI message_loop; | 16 base::MessageLoopForUI message_loop; |
| 17 wl::FakeServer server; | 17 wl::FakeServer server; |
| 18 EXPECT_CALL(*server.xdg_shell(), | 18 EXPECT_CALL(*server.xdg_shell(), |
| 19 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); | 19 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); |
| 20 ASSERT_TRUE(server.Start()); | 20 ASSERT_TRUE(server.Start()); |
| 21 WaylandDisplay display; | 21 WaylandConnection connection; |
| 22 ASSERT_TRUE(display.Initialize()); | 22 ASSERT_TRUE(connection.Initialize()); |
| 23 display.StartProcessingEvents(); | 23 connection.StartProcessingEvents(); |
| 24 | 24 |
| 25 base::RunLoop().RunUntilIdle(); | 25 base::RunLoop().RunUntilIdle(); |
| 26 server.Pause(); | 26 server.Pause(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 TEST(WaylandDisplayTest, Ping) { | 29 TEST(WaylandConnectionTest, Ping) { |
| 30 base::MessageLoopForUI message_loop; | 30 base::MessageLoopForUI message_loop; |
| 31 wl::FakeServer server; | 31 wl::FakeServer server; |
| 32 ASSERT_TRUE(server.Start()); | 32 ASSERT_TRUE(server.Start()); |
| 33 WaylandDisplay display; | 33 WaylandConnection connection; |
| 34 ASSERT_TRUE(display.Initialize()); | 34 ASSERT_TRUE(connection.Initialize()); |
| 35 display.StartProcessingEvents(); | 35 connection.StartProcessingEvents(); |
| 36 | 36 |
| 37 base::RunLoop().RunUntilIdle(); | 37 base::RunLoop().RunUntilIdle(); |
| 38 server.Pause(); | 38 server.Pause(); |
| 39 | 39 |
| 40 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234); | 40 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234); |
| 41 EXPECT_CALL(*server.xdg_shell(), Pong(1234)); | 41 EXPECT_CALL(*server.xdg_shell(), Pong(1234)); |
| 42 | 42 |
| 43 server.Resume(); | 43 server.Resume(); |
| 44 base::RunLoop().RunUntilIdle(); | 44 base::RunLoop().RunUntilIdle(); |
| 45 server.Pause(); | 45 server.Pause(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace ui | 48 } // namespace ui |
| OLD | NEW |