Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27068fb3 authored by Yu Shan's avatar Yu Shan
Browse files

Fix flaky TestWakeupClientServiceImplUnitTest.

This CL fixed two possible issues: 1. mServerStarted is not reset
to false for each test case. 2. pollOnce should be used instead of
pollAll since pollAll might swallow wake.

Test: atest --host TestWakeupClientServerHostUnitTest
Bug: 333673876
Change-Id: Id705d6257c54a2e2711aff6018abf2ea65b0f691
parent bb7e7ae3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -169,7 +169,8 @@ void ServiceImpl::loop() {
    Looper::setForThread(mLooper);

    while (true) {
        mLooper->pollAll(/*timeoutMillis=*/-1);
        // Don't use pollAll since it might swallow wake.
        mLooper->pollOnce(/*timeoutMillis=*/-1);
        if (mServerStopped) {
            return;
        }
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ class TestWakeupClientServiceImplUnitTest : public ::testing::Test {
  public:
    virtual void SetUp() override {
        int selectedPort = 0;
        mServerStarted = false;
        mService.reset();
        mServer.reset();
        mServerThread = std::thread([this, &selectedPort] {
            mService = std::make_unique<MyTestWakeupClientServiceImpl>();
            ServerBuilder builder;