Commit d4b36272 authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

add RunAllPendingInMessageLoop() after surface Commit

It turned out that some X11 events arrive to the surfaces when
the tests run with Xvfb (without -noreset flag), and that causes
additional events which causes mismatches on mock expectations
(especially on OnPointerFrame). RunAllPendingInMessageLoop()
will consume such events, so those failure won't happen again.

BUG=854674
TEST=exo_unittests with Xvfb :9 -nolisten tcp -screen 0 1280x800x24

Change-Id: I2c40aa29708362bd8eb4d05dd6448948622cfd81
Reviewed-on: https://chromium-review.googlesource.com/1105492Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Commit-Queue: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568956}
parent 8225bf8f
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
namespace exo { namespace exo {
namespace { namespace {
using PointerTest = test::ExoTestBase;
class MockPointerDelegate : public PointerDelegate { class MockPointerDelegate : public PointerDelegate {
public: public:
MockPointerDelegate() {} MockPointerDelegate() {}
...@@ -46,6 +44,22 @@ class MockPointerDelegate : public PointerDelegate { ...@@ -46,6 +44,22 @@ class MockPointerDelegate : public PointerDelegate {
MOCK_METHOD0(OnPointerFrame, void()); MOCK_METHOD0(OnPointerFrame, void());
}; };
class PointerTest : public test::ExoTestBase {
public:
PointerTest() = default;
void SetUp() override {
test::ExoTestBase::SetUp();
// Sometimes underlying infra (i.e. X11 / Xvfb) may emit pointer events
// which can break MockPointerDelegate's expectations, so they should be
// consumed before starting. See https://crbug.com/854674.
RunAllPendingInMessageLoop();
}
private:
DISALLOW_COPY_AND_ASSIGN(PointerTest);
};
TEST_F(PointerTest, SetCursor) { TEST_F(PointerTest, SetCursor) {
std::unique_ptr<Surface> surface(new Surface); std::unique_ptr<Surface> surface(new Surface);
std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment