fix(android): AVTransport test assertions escape DIDL; consolidate xmlEscape
android / Build + lint + test (push) Failing after 1m18s
android / Build + lint + test (push) Failing after 1m18s
DIDL assertion now checks for XML-escaped form (<dc:title>) since SoapClient.buildEnvelope escapes all arg values. Lifts xmlEscape to a top-level internal fun in SoapClient.kt, removing the duplicate private copy from AVTransportClient. Fixes @Suppress rationale (not Compose). Renames seek test to reflect colon-separated format; adds unknown-state getTransportInfo test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-8
@@ -7,7 +7,8 @@ import okhttp3.HttpUrl
|
||||
* Covers SetAVTransportURI / SetNextAVTransportURI / Play / Pause /
|
||||
* Stop / Seek / GetPositionInfo / GetTransportInfo.
|
||||
*/
|
||||
@Suppress("TooManyFunctions") // Compose-adjacent helper density: all are direct SOAP verbs.
|
||||
// One method per AVTransport SOAP verb; splitting would obscure the 1:1 protocol mapping.
|
||||
@Suppress("TooManyFunctions")
|
||||
class AVTransportClient(
|
||||
private val soap: SoapClient,
|
||||
private val controlUrl: HttpUrl,
|
||||
@@ -151,13 +152,6 @@ class AVTransportClient(
|
||||
}
|
||||
}
|
||||
|
||||
private fun xmlEscape(v: String): String = v
|
||||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\"", """)
|
||||
.replace("'", "'")
|
||||
|
||||
private fun formatHhMmSs(positionMs: Long): String {
|
||||
val totalSec = (positionMs / MILLIS_PER_SECOND).coerceAtLeast(0)
|
||||
val h = totalSec / SECONDS_PER_HOUR
|
||||
|
||||
@@ -69,13 +69,6 @@ class SoapClient(
|
||||
append("</s:Envelope>")
|
||||
}
|
||||
|
||||
private fun xmlEscape(v: String): String = v
|
||||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\"", """)
|
||||
.replace("'", "'")
|
||||
|
||||
private fun parseResponseArgs(body: String, action: String): Map<String, String> {
|
||||
val parser = XmlPullParserFactory.newInstance().newPullParser().apply {
|
||||
setInput(body.reader())
|
||||
@@ -138,3 +131,11 @@ class SoapClient(
|
||||
*/
|
||||
class SoapFaultException(val code: String, val description: String) :
|
||||
Exception("SOAP fault $code: $description")
|
||||
|
||||
/** XML-escapes a string value for embedding as text content inside a SOAP envelope. */
|
||||
internal fun xmlEscape(v: String): String = v
|
||||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\"", """)
|
||||
.replace("'", "'")
|
||||
|
||||
Reference in New Issue
Block a user