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_connection.h" | 11 #include "ui/ozone/platform/wayland/wayland_connection.h" |
| 12 #include "ui/ozone/platform/wayland/wayland_output.h" |
12 | 13 |
13 namespace ui { | 14 namespace ui { |
14 | 15 |
15 TEST(WaylandConnectionTest, UseUnstableVersion) { | 16 TEST(WaylandConnectionTest, UseUnstableVersion) { |
16 base::MessageLoopForUI message_loop; | 17 base::MessageLoopForUI message_loop; |
17 wl::FakeServer server; | 18 wl::FakeServer server; |
18 EXPECT_CALL(*server.xdg_shell(), | 19 EXPECT_CALL(*server.xdg_shell(), |
19 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); | 20 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); |
20 ASSERT_TRUE(server.Start()); | 21 ASSERT_TRUE(server.Start()); |
21 WaylandConnection connection; | 22 WaylandConnection connection; |
(...skipping 16 matching lines...) Expand all Loading... |
38 server.Pause(); | 39 server.Pause(); |
39 | 40 |
40 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234); | 41 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234); |
41 EXPECT_CALL(*server.xdg_shell(), Pong(1234)); | 42 EXPECT_CALL(*server.xdg_shell(), Pong(1234)); |
42 | 43 |
43 server.Resume(); | 44 server.Resume(); |
44 base::RunLoop().RunUntilIdle(); | 45 base::RunLoop().RunUntilIdle(); |
45 server.Pause(); | 46 server.Pause(); |
46 } | 47 } |
47 | 48 |
| 49 TEST(WaylandConnectionTest, Output) { |
| 50 base::MessageLoopForUI message_loop; |
| 51 wl::FakeServer server; |
| 52 ASSERT_TRUE(server.Start()); |
| 53 server.output()->SetRect(gfx::Rect(0, 0, 800, 600)); |
| 54 WaylandConnection connection; |
| 55 ASSERT_TRUE(connection.Initialize()); |
| 56 connection.StartProcessingEvents(); |
| 57 |
| 58 base::RunLoop run_loop; |
| 59 WaylandOutput::Observer output_observer(run_loop.QuitClosure(), |
| 60 connection.PrimaryOutput()); |
| 61 run_loop.Run(); |
| 62 |
| 63 ASSERT_TRUE(connection.GetOutputList().size() == 1); |
| 64 WaylandOutput* output = connection.PrimaryOutput(); |
| 65 ASSERT_TRUE(output->Geometry().width() == 800); |
| 66 ASSERT_TRUE(output->Geometry().height() == 600); |
| 67 |
| 68 server.Resume(); |
| 69 base::RunLoop().RunUntilIdle(); |
| 70 server.Pause(); |
| 71 } |
| 72 |
48 } // namespace ui | 73 } // namespace ui |
OLD | NEW |