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

Commit 67a15e86 authored by Arpit Singh's avatar Arpit Singh Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition in PointerControllerTest" into main

parents 72f1f55a c2c839d2
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -162,6 +162,16 @@ public:
};

class PointerControllerTest : public Test {
private:
    void loopThread();

    std::atomic<bool> mRunning = true;
    class MyLooper : public Looper {
    public:
        MyLooper() : Looper(false) {}
        ~MyLooper() = default;
    };

protected:
    PointerControllerTest();
    ~PointerControllerTest();
@@ -173,26 +183,16 @@ protected:
    std::unique_ptr<MockSpriteController> mSpriteController;
    std::shared_ptr<PointerController> mPointerController;
    sp<android::gui::WindowInfosListener> mRegisteredListener;
    sp<MyLooper> mLooper;

private:
    void loopThread();

    std::atomic<bool> mRunning = true;
    class MyLooper : public Looper {
    public:
        MyLooper() : Looper(false) {}
        ~MyLooper() = default;
    };
    std::thread mThread;

protected:
    sp<MyLooper> mLooper;
};

PointerControllerTest::PointerControllerTest()
      : mPointerSprite(new NiceMock<MockSprite>),
        mThread(&PointerControllerTest::loopThread, this),
        mLooper(new MyLooper) {
        mLooper(new MyLooper),
        mThread(&PointerControllerTest::loopThread, this) {
    mSpriteController.reset(new NiceMock<MockSpriteController>(mLooper));
    mPolicy = new MockPointerControllerPolicyInterface();