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

Commit 49940980 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Automerger Merge Worker
Browse files

Merge "Fix AudioSystemTest#StartAndStopAudioSource flakiness" am: 1ab420ac...

Merge "Fix AudioSystemTest#StartAndStopAudioSource flakiness" am: 1ab420ac am: 4ae81d39 am: b473bbc7

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2492598



Change-Id: I478715f67ec715859a61e019c6eaaea1d79dd406
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0b443572 b473bbc7
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -214,8 +214,11 @@ TEST_F(AudioSystemTest, StartAndStopAudioSource) {
        GTEST_SKIP() << "No ports returned by the audio system";
    }

    bool sourceFound = false;
    for (const auto& port : ports) {
        if (port.role != AUDIO_PORT_ROLE_SOURCE || port.type != AUDIO_PORT_TYPE_DEVICE) continue;
        if (port.ext.device.type != AUDIO_DEVICE_IN_FM_TUNER) continue;
        sourceFound = true;
        sourcePortConfig = port.active_config;

        bool patchFound;
@@ -223,8 +226,9 @@ TEST_F(AudioSystemTest, StartAndStopAudioSource) {
        // start audio source.
        status_t ret =
                AudioSystem::startAudioSource(&sourcePortConfig, &attributes, &sourcePortHandle);
        EXPECT_EQ(OK, ret) << "AudioSystem::startAudioSource for source " << port.ext.device.address
                           << " failed";
        EXPECT_EQ(OK, ret) << "AudioSystem::startAudioSource for source "
                           << audio_device_to_string(port.ext.device.type) << " failed";
        if (ret != OK) continue;

        // verify that patch is established by the source port.
        ASSERT_NO_FATAL_FAILURE(anyPatchContainsInputDevice(port.id, patchFound));
@@ -233,13 +237,17 @@ TEST_F(AudioSystemTest, StartAndStopAudioSource) {

        if (sourcePortHandle != AUDIO_PORT_HANDLE_NONE) {
            ret = AudioSystem::stopAudioSource(sourcePortHandle);
            EXPECT_EQ(OK, ret) << "AudioSystem::stopAudioSource for handle failed";
            EXPECT_EQ(OK, ret) << "AudioSystem::stopAudioSource failed for handle "
                               << sourcePortHandle;
        }

        // verify that no source port patch exists.
        ASSERT_NO_FATAL_FAILURE(anyPatchContainsInputDevice(port.id, patchFound));
        EXPECT_EQ(false, patchFound);
    }
    if (!sourceFound) {
        GTEST_SKIP() << "No ports suitable for testing";
    }
}

TEST_F(AudioSystemTest, CreateAndReleaseAudioPatch) {