audio: Fix streamCommon nullptr check in VTS

Fix test code in AudioStream#GetStreamCommon test.
Avoid crashing if the HAL module returns a null
IStreamCommon instance pointer.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I118ea1df49a127780a901479cf8cd5787be601f7
This commit is contained in:
Mikhail Naganov
2022-12-16 22:17:39 +00:00
parent bfc2e1524d
commit 8230457989

View File

@@ -1835,10 +1835,10 @@ class AudioStream : public AudioCoreModule {
ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames));
std::shared_ptr<IStreamCommon> streamCommon1;
EXPECT_IS_OK(stream.get()->getStreamCommon(&streamCommon1));
EXPECT_NE(nullptr, streamCommon1);
std::shared_ptr<IStreamCommon> streamCommon2;
EXPECT_IS_OK(stream.get()->getStreamCommon(&streamCommon2));
EXPECT_NE(nullptr, streamCommon2);
ASSERT_NE(nullptr, streamCommon1);
ASSERT_NE(nullptr, streamCommon2);
EXPECT_EQ(streamCommon1->asBinder(), streamCommon2->asBinder())
<< "getStreamCommon must return the same interface instance across invocations";
}