Add CTS test for resolution stop failed
Bug: 266839892 Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest Change-Id: I1fee5aaaa5f19877d0fccafd6853568d50d4cb7c
This commit is contained in:
@@ -314,6 +314,7 @@ class NsdManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStopResolutionFailed(si: NsdServiceInfo, err: Int) {
|
override fun onStopResolutionFailed(si: NsdServiceInfo, err: Int) {
|
||||||
|
super.onStopResolutionFailed(si, err)
|
||||||
add(StopResolutionFailed(si, err))
|
add(StopResolutionFailed(si, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -985,6 +986,24 @@ class NsdManagerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testStopServiceResolutionFailedCallback() {
|
||||||
|
// This test requires shims supporting U+ APIs (NsdManager.stopServiceResolution)
|
||||||
|
assumeTrue(TestUtils.shouldTestUApis())
|
||||||
|
|
||||||
|
// It's not possible to make ResolutionListener#onStopResolutionFailed callback sending
|
||||||
|
// because it is only sent in very edge-case scenarios when the legacy implementation is
|
||||||
|
// used, and the legacy implementation is never used in the current AOSP builds. Considering
|
||||||
|
// that this callback isn't expected to be sent at all at the moment, and this is just an
|
||||||
|
// interface with no implementation. To verify this callback, just call
|
||||||
|
// onStopResolutionFailed on the record directly then verify it is received.
|
||||||
|
val resolveRecord = NsdResolveRecord()
|
||||||
|
resolveRecord.onStopResolutionFailed(
|
||||||
|
NsdServiceInfo(), NsdManager.FAILURE_OPERATION_NOT_RUNNING)
|
||||||
|
val failedCb = resolveRecord.expectCallback<StopResolutionFailed>()
|
||||||
|
assertEquals(NsdManager.FAILURE_OPERATION_NOT_RUNNING, failedCb.errorCode)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a service and return its registration record.
|
* Register a service and return its registration record.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user