CredentialProviderContractTest.kt

1.2 KB · raw

1package com.peachpasswords.passkeys23import java.io.File4import org.junit.Assert.assertFalse5import org.junit.Assert.assertTrue6import org.junit.Test78class CredentialProviderContractTest {9    @Test10    fun authenticationActionPendingIntentIsMutableForFrameworkRequestAttachment() {11        val source = source("passkeys/PasskeyUnlockIntent.kt")1213        assertTrue(source.contains("PendingIntent.FLAG_MUTABLE"))14        assertFalse(source.contains("PendingIntent.FLAG_IMMUTABLE"))15    }1617    @Test18    fun selectionPrefersTheFinalFrameworkOrigin() {19        assertTrue(20            selectionOrigin("https://github.com", "https://example.com") ==21                "https://github.com",22        )23    }2425    @Test26    fun selectionRetainsAuthenticatedBeginRequestOriginWhenOemOmitsFinalRequest() {27        assertTrue(28            selectionOrigin(null, "https://github.com") == "https://github.com",29        )30    }3132    @Test33    fun selectionStillFailsClosedWithoutAnyVerifiedOrigin() {34        assertTrue(selectionOrigin(null, null) == null)35        assertTrue(selectionOrigin("  ", "") == null)36    }3738    private fun source(relativePath: String): String =39        File("src/main/java/com/peachpasswords/$relativePath").readText()40}