Index: ui/ozone/platform/wayland/wayland_connection_unittest.cc |
diff --git a/ui/ozone/platform/wayland/wayland_connection_unittest.cc b/ui/ozone/platform/wayland/wayland_connection_unittest.cc |
index abeb8818a15d8281acb250d41b564600600f8cb7..b261ec161229a173188bef640e8d935351968aae 100644 |
--- a/ui/ozone/platform/wayland/wayland_connection_unittest.cc |
+++ b/ui/ozone/platform/wayland/wayland_connection_unittest.cc |
@@ -9,9 +9,23 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/ozone/platform/wayland/fake_server.h" |
#include "ui/ozone/platform/wayland/wayland_connection.h" |
+#include "ui/ozone/platform/wayland/wayland_output.h" |
namespace ui { |
+class OutputObserver : public WaylandOutput::Observer { |
+ public: |
+ explicit OutputObserver(const base::Closure& closure) : closure_(closure) {} |
+ |
+ void OnOutputReadyForUse() override { |
+ if (!closure_.is_null()) |
+ closure_.Run(); |
+ } |
+ |
+ private: |
+ const base::Closure closure_; |
+}; |
+ |
TEST(WaylandConnectionTest, UseUnstableVersion) { |
base::MessageLoopForUI message_loop; |
wl::FakeServer server; |
@@ -45,4 +59,28 @@ TEST(WaylandConnectionTest, Ping) { |
server.Pause(); |
} |
+TEST(WaylandConnectionTest, Output) { |
+ base::MessageLoopForUI message_loop; |
+ wl::FakeServer server; |
+ ASSERT_TRUE(server.Start()); |
+ server.output()->SetRect(gfx::Rect(0, 0, 800, 600)); |
+ WaylandConnection connection; |
+ ASSERT_TRUE(connection.Initialize()); |
+ connection.StartProcessingEvents(); |
+ |
+ base::RunLoop run_loop; |
+ OutputObserver observer(run_loop.QuitClosure()); |
+ connection.PrimaryOutput()->SetObserver(&observer); |
+ run_loop.Run(); |
+ |
+ ASSERT_TRUE(connection.GetOutputList().size() == 1); |
+ WaylandOutput* output = connection.PrimaryOutput(); |
+ ASSERT_TRUE(output->Geometry().width() == 800); |
+ ASSERT_TRUE(output->Geometry().height() == 600); |
+ |
+ server.Resume(); |
+ base::RunLoop().RunUntilIdle(); |
+ server.Pause(); |
+} |
+ |
} // namespace ui |