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

Commit 4fe34f9b authored by Chong Zhang's avatar Chong Zhang
Browse files

transcoding: fix client number in unit tests

The unit test's client number check will fail with
MediaProvider registering a client. Relax client
number check after register and remove the check
after unregister.

bug: 154733526
test: MediaTranscodingService unit tests
Change-Id: I5dd6e88a8fa55480095ff83123065c71eb7e2e04
parent 358a0844
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -439,6 +439,7 @@ public:
            ALOGE("Failed to connect to the media.trascoding service.");
            return;
        }

        mClient1 = ::ndk::SharedRefBase::make<TestClientCallback>(kClientPackageA, 1);
        mClient2 = ::ndk::SharedRefBase::make<TestClientCallback>(kClientPackageB, 2);
        mClient3 = ::ndk::SharedRefBase::make<TestClientCallback>(kClientPackageC, 3);
@@ -469,7 +470,7 @@ public:
        int32_t numOfClients;
        Status status = mService->getNumOfClients(&numOfClients);
        EXPECT_TRUE(status.isOk());
        EXPECT_EQ(3, numOfClients);
        EXPECT_GE(numOfClients, 3);
    }

    void unregisterMultipleClients() {
@@ -477,12 +478,6 @@ public:
        EXPECT_TRUE(mClient1->unregisterClient().isOk());
        EXPECT_TRUE(mClient2->unregisterClient().isOk());
        EXPECT_TRUE(mClient3->unregisterClient().isOk());

        // Check the number of clients.
        int32_t numOfClients;
        Status status = mService->getNumOfClients(&numOfClients);
        EXPECT_TRUE(status.isOk());
        EXPECT_EQ(0, numOfClients);
    }

    void deleteFile(const char* path) { unlink(path); }
+1 −6
Original line number Diff line number Diff line
@@ -104,16 +104,11 @@ TEST_F(MediaTranscodingServiceSimulatedTest, TestRegisterOneClient) {
    int32_t numOfClients;
    status = mService->getNumOfClients(&numOfClients);
    EXPECT_TRUE(status.isOk());
    EXPECT_EQ(1, numOfClients);
    EXPECT_GE(numOfClients, 1);

    // Unregister the client.
    status = client->unregister();
    EXPECT_TRUE(status.isOk());

    // Check the number of Clients.
    status = mService->getNumOfClients(&numOfClients);
    EXPECT_TRUE(status.isOk());
    EXPECT_EQ(0, numOfClients);
}

TEST_F(MediaTranscodingServiceSimulatedTest, TestRegisterClientTwice) {