Chromium Code Reviews| Index: ui/ozone/platform/wayland/wayland_display_unittest.cc |
| diff --git a/ui/ozone/platform/wayland/wayland_display_unittest.cc b/ui/ozone/platform/wayland/wayland_display_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f32b6df2b75af9316b91887287d5e0af20699342 |
| --- /dev/null |
| +++ b/ui/ozone/platform/wayland/wayland_display_unittest.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <wayland-server-core.h> |
| +#include <xdg-shell-unstable-v5-server-protocol.h> |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| +#include "ui/ozone/platform/wayland/fake_server.h" |
| +#include "ui/ozone/platform/wayland/wayland_display.h" |
| + |
| +namespace ui { |
| + |
| +class WaylandDisplayTest : public testing::Test { |
| + public: |
| + WaylandDisplayTest() : server(&mock_xdg_shell) {} |
| + |
| + ~WaylandDisplayTest() override {} |
| + |
| + void SetUp() override { |
| + ASSERT_TRUE(server.Start()); |
| + EXPECT_CALL(mock_xdg_shell, UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); |
| + ASSERT_TRUE(display.Initialize()); |
| + wl_display_roundtrip(display.display()); |
| + initialized = true; |
| + } |
| + |
| + void TearDown() override { |
| + if (initialized) |
| + wl_display_roundtrip(display.display()); |
| + } |
| + |
| + protected: |
| + wl::MockXdgShell mock_xdg_shell; |
| + wl::FakeServer server; |
| + WaylandDisplay display; |
| + |
| + private: |
| + bool initialized = false; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WaylandDisplayTest); |
| +}; |
| + |
| +TEST_F(WaylandDisplayTest, Ping) { |
|
rjkroege
2016/02/09 01:30:40
can you add some comment somewhere about how to ru
Michael Forney
2016/02/09 01:50:18
Just ./ozone_unittests, nothing special.
|
| + xdg_shell_send_ping(server.xdg_shell(), 1234); |
| + EXPECT_CALL(mock_xdg_shell, Pong(1234)); |
| + server.Flush(); |
| +} |
| + |
| +} // namespace ui |