commit | 0abafcc191d970bdaa858f20cad5155a95b1f2bf | [log] [tgz] |
---|---|---|
author | Pranav Madapurmath <[email protected]> | Tue Jun 13 20:18:57 2023 +0000 |
committer | Android Build Cherrypicker Worker <[email protected]> | Tue Jun 13 20:18:57 2023 +0000 |
tree | b5885ec9db40950b520dd7be7ebca3de690ec8e4 | |
parent | f96f9e37a54044663db779d664246150a6ac9d00 [diff] |
Fix BasicCallControlCallbacksTest test failure verifyAnswerCall is failing because the assertion in the coroutine is exexuting before the onAnswer callback is reached. Moving the assertions out of the coroutine should guarantee that we always validate after the call flow has terminated. Fixes: 286584457 Test: BasicCallControlCallBacksTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:79553aa0a73f1fe70c44afe72937882bd7a78d73) Merged-In: I97eadbc2415a55178664b45cab04ae1cda614005 Change-Id: I97eadbc2415a55178664b45cab04ae1cda614005
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt index 1aaf4db..369fd7c 100644 --- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt +++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt
@@ -97,21 +97,21 @@ @Suppress("deprecation") private fun verifyAnswerCall() { + assertFalse(TestUtils.mOnAnswerCallbackCalled) runBlocking { mCallsManager.addCall(TestUtils.INCOMING_CALL_ATTRIBUTES) { setCallback(TestUtils.mCompleteAllCallControlCallbacksImpl) launch { val call = TestUtils.waitOnInCallServiceToReachXCalls(1) assertNotNull("The returned Call object is <NULL>", call) - assertFalse(TestUtils.mOnAnswerCallbackCalled) call!!.answer(0) // API under test TestUtils.waitOnCallState(call, Call.STATE_ACTIVE) - // Assert that the callback was invoked - assertTrue(TestUtils.mOnAnswerCallbackCalled) // always send the disconnect signal if possible assertTrue(disconnect(DisconnectCause(DisconnectCause.LOCAL))) } } } + // Assert that the callback was invoked + assertTrue(TestUtils.mOnAnswerCallbackCalled) } } \ No newline at end of file