OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include <wayland-server-core.h> | |
6 #include <xdg-shell-unstable-v5-server-protocol.h> | |
7 | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 #include "ui/ozone/platform/wayland/fake_server.h" | |
10 #include "ui/ozone/platform/wayland/wayland_display.h" | |
11 | |
12 namespace ui { | |
13 | |
14 class WaylandDisplayTest : public testing::Test { | |
15 public: | |
16 WaylandDisplayTest() : server(&mock_xdg_shell) {} | |
17 | |
18 ~WaylandDisplayTest() override {} | |
19 | |
20 void SetUp() override { | |
21 ASSERT_TRUE(server.Start()); | |
22 EXPECT_CALL(mock_xdg_shell, UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); | |
23 ASSERT_TRUE(display.Initialize()); | |
24 wl_display_roundtrip(display.display()); | |
25 initialized = true; | |
26 } | |
27 | |
28 void TearDown() override { | |
29 if (initialized) | |
30 wl_display_roundtrip(display.display()); | |
31 } | |
32 | |
33 protected: | |
34 wl::MockXdgShell mock_xdg_shell; | |
35 wl::FakeServer server; | |
36 WaylandDisplay display; | |
37 | |
38 private: | |
39 bool initialized = false; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayTest); | |
42 }; | |
43 | |
44 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.
| |
45 xdg_shell_send_ping(server.xdg_shell(), 1234); | |
46 EXPECT_CALL(mock_xdg_shell, Pong(1234)); | |
47 server.Flush(); | |
48 } | |
49 | |
50 } // namespace ui | |
OLD | NEW |