[mdns] exclude mDNS advertiser code from standalone build test

service-connectivity-mdns-standalone-build-test builds the mDNS
discovery and advertisement implementation against API level 21.
This stops the advertisement code from calling new NsdServiceInfo
public or private APIs which are required by Thread.

This commit removes the mDNS advertisement code from the standalone
build to loose the check given this will never be used by GMS Core.

Bug: 265095929
Test: verified that it can build with aosp/2608627
Change-Id: I32cfce7b994d51a4b4ec468e9f79ffc2be6635ff
This commit is contained in:
Kangping Dong
2023-09-22 18:32:02 +08:00
parent 462572b24b
commit 1a1beee654
12 changed files with 106 additions and 71 deletions

View File

@@ -82,7 +82,8 @@ class MdnsAnnouncerTest {
@Test
fun testAnnounce() {
val replySender = MdnsReplySender( thread.looper, socket, buffer, sharedLog)
val replySender = MdnsReplySender(
thread.looper, socket, buffer, sharedLog, true /* enableDebugLog */)
@Suppress("UNCHECKED_CAST")
val cb = mock(MdnsPacketRepeater.PacketRepeaterCallback::class.java)
as MdnsPacketRepeater.PacketRepeaterCallback<BaseAnnouncementInfo>

View File

@@ -190,8 +190,8 @@ class MdnsInterfaceAdvertiserTest {
fun testReplyToQuery() {
addServiceAndFinishProbing(TEST_SERVICE_ID_1, TEST_SERVICE_1)
val mockReply = mock(MdnsRecordRepository.ReplyInfo::class.java)
doReturn(mockReply).`when`(repository).getReply(any(), any())
val testReply = MdnsReplyInfo(emptyList(), emptyList(), 0, InetSocketAddress(0))
doReturn(testReply).`when`(repository).getReply(any(), any())
// Query obtained with:
// scapy.raw(scapy.DNS(
@@ -216,7 +216,7 @@ class MdnsInterfaceAdvertiserTest {
assertContentEquals(arrayOf("_testservice", "_tcp", "local"), it.questions[0].name)
}
verify(replySender).queueReply(mockReply)
verify(replySender).queueReply(testReply)
}
@Test

View File

@@ -119,7 +119,8 @@ class MdnsProberTest {
@Test
fun testProbe() {
val replySender = MdnsReplySender(thread.looper, socket, buffer, sharedLog)
val replySender = MdnsReplySender(
thread.looper, socket, buffer, sharedLog, true /* enableDebugLog */)
val prober = TestProber(thread.looper, replySender, cb, sharedLog)
val probeInfo = TestProbeInfo(
listOf(makeServiceRecord(TEST_SERVICE_NAME_1, 37890)))
@@ -143,7 +144,8 @@ class MdnsProberTest {
@Test
fun testProbeMultipleRecords() {
val replySender = MdnsReplySender(thread.looper, socket, buffer, sharedLog)
val replySender = MdnsReplySender(
thread.looper, socket, buffer, sharedLog, true /* enableDebugLog */)
val prober = TestProber(thread.looper, replySender, cb, sharedLog)
val probeInfo = TestProbeInfo(listOf(
makeServiceRecord(TEST_SERVICE_NAME_1, 37890),
@@ -181,7 +183,8 @@ class MdnsProberTest {
@Test
fun testStopProbing() {
val replySender = MdnsReplySender(thread.looper, socket, buffer, sharedLog)
val replySender = MdnsReplySender(
thread.looper, socket, buffer, sharedLog, true /* enableDebugLog */)
val prober = TestProber(thread.looper, replySender, cb, sharedLog)
val probeInfo = TestProbeInfo(
listOf(makeServiceRecord(TEST_SERVICE_NAME_1, 37890)),