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

Unified Diff: ui/ozone/platform/wayland/wayland_test.cc

Issue 1739193004: ozone/platform/wayland: Use more realistic event processing and request flushing in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wayland-test2
Patch Set: Use watching_ instead of base::MessageLoopForUI::IsCurrent() Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/wayland/wayland_test.h ('k') | ui/ozone/platform/wayland/wayland_window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/wayland_test.cc
diff --git a/ui/ozone/platform/wayland/wayland_test.cc b/ui/ozone/platform/wayland/wayland_test.cc
index 85c897da1952dd5281b3d9d61ef39a7b5e70bc70..3d3fec7b080846179c555ce3181b13d410a94267 100644
--- a/ui/ozone/platform/wayland/wayland_test.cc
+++ b/ui/ozone/platform/wayland/wayland_test.cc
@@ -4,6 +4,8 @@
#include "ui/ozone/platform/wayland/wayland_test.h"
+#include "base/run_loop.h"
+
using ::testing::SaveArg;
using ::testing::_;
@@ -17,28 +19,38 @@ WaylandTest::~WaylandTest() {}
void WaylandTest::SetUp() {
ASSERT_TRUE(server.Start());
ASSERT_TRUE(display.Initialize());
+ display.StartProcessingEvents();
EXPECT_CALL(delegate, OnAcceleratedWidgetAvailable(_, _))
.WillOnce(SaveArg<0>(&widget));
ASSERT_TRUE(window.Initialize());
ASSERT_NE(widget, gfx::kNullAcceleratedWidget);
- wl_display_roundtrip(display.display());
+ // Wait for the client to flush all pending requests from initialization.
+ base::RunLoop().RunUntilIdle();
+
+ // Pause the server after it has responded to all incoming events.
server.Pause();
surface = server.GetObject<wl::MockSurface>(widget);
ASSERT_TRUE(surface);
+
initialized = true;
}
void WaylandTest::TearDown() {
- server.Resume();
if (initialized)
- wl_display_roundtrip(display.display());
+ Sync();
}
void WaylandTest::Sync() {
+ // Resume the server, flushing its pending events.
server.Resume();
- wl_display_roundtrip(display.display());
+
+ // Wait for the client to finish processing these events.
+ base::RunLoop().RunUntilIdle();
+
+ // Pause the server, after it has finished processing any follow-up requests
+ // from the client.
server.Pause();
}
« no previous file with comments | « ui/ozone/platform/wayland/wayland_test.h ('k') | ui/ozone/platform/wayland/wayland_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698