Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: ui/ozone/platform/wayland/wayland_connection_unittest.cc

Issue 2042503002: ozone/platform/wayland: Add support for wl_output_interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [For landding] update comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
16 class OutputObserver : public WaylandOutput::Observer {
17 public:
18 explicit OutputObserver(const base::Closure& closure) : closure_(closure) {}
19
20 void OnOutputReadyForUse() override {
21 if (!closure_.is_null())
22 closure_.Run();
23 }
24
25 private:
26 const base::Closure closure_;
27 };
28
15 TEST(WaylandConnectionTest, UseUnstableVersion) { 29 TEST(WaylandConnectionTest, UseUnstableVersion) {
16 base::MessageLoopForUI message_loop; 30 base::MessageLoopForUI message_loop;
17 wl::FakeServer server; 31 wl::FakeServer server;
18 EXPECT_CALL(*server.xdg_shell(), 32 EXPECT_CALL(*server.xdg_shell(),
19 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); 33 UseUnstableVersion(XDG_SHELL_VERSION_CURRENT));
20 ASSERT_TRUE(server.Start()); 34 ASSERT_TRUE(server.Start());
21 WaylandConnection connection; 35 WaylandConnection connection;
22 ASSERT_TRUE(connection.Initialize()); 36 ASSERT_TRUE(connection.Initialize());
23 connection.StartProcessingEvents(); 37 connection.StartProcessingEvents();
24 38
(...skipping 13 matching lines...) Expand all
38 server.Pause(); 52 server.Pause();
39 53
40 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234); 54 xdg_shell_send_ping(server.xdg_shell()->resource(), 1234);
41 EXPECT_CALL(*server.xdg_shell(), Pong(1234)); 55 EXPECT_CALL(*server.xdg_shell(), Pong(1234));
42 56
43 server.Resume(); 57 server.Resume();
44 base::RunLoop().RunUntilIdle(); 58 base::RunLoop().RunUntilIdle();
45 server.Pause(); 59 server.Pause();
46 } 60 }
47 61
62 TEST(WaylandConnectionTest, Output) {
63 base::MessageLoopForUI message_loop;
64 wl::FakeServer server;
65 ASSERT_TRUE(server.Start());
66 server.output()->SetRect(gfx::Rect(0, 0, 800, 600));
67 WaylandConnection connection;
68 ASSERT_TRUE(connection.Initialize());
69 connection.StartProcessingEvents();
70
71 base::RunLoop run_loop;
72 OutputObserver observer(run_loop.QuitClosure());
73 connection.PrimaryOutput()->SetObserver(&observer);
74 run_loop.Run();
75
76 ASSERT_TRUE(connection.GetOutputList().size() == 1);
77 WaylandOutput* output = connection.PrimaryOutput();
78 ASSERT_TRUE(output->Geometry().width() == 800);
79 ASSERT_TRUE(output->Geometry().height() == 600);
80
81 server.Resume();
82 base::RunLoop().RunUntilIdle();
83 server.Pause();
84 }
85
48 } // namespace ui 86 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/wayland/wayland_connection.cc ('k') | ui/ozone/platform/wayland/wayland_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698