package com.peachpasswords.autofill import org.junit.Assert.assertFalse import org.junit.Assert.assertNull import org.junit.Assert.assertTrue import org.junit.Test class AutofillOriginReleaseTest { @Test fun unverifiedWebClaimCannotReturnCredentialsOrSaveThem() { val denied = applyWebOriginVerification( ParsedStructure( webDomain = "github.com", packageName = "com.attacker.spoof", passwordValue = "captured-password", ), verifiedBrowser = false, ) assertFalse(denied.credentialReleaseAllowed) assertNull(autofillSaveDraft(denied)) } @Test fun verifiedBrowserRetainsWebAutofill() { val allowed = applyWebOriginVerification( ParsedStructure(webDomain = "login.github.com", packageName = "com.android.chrome"), verifiedBrowser = true, ) assertTrue(allowed.credentialReleaseAllowed) } @Test fun nativeAppRetainsAutofillWithoutWebClaim() { val native = ParsedStructure(packageName = "com.example.app") assertTrue(native.credentialReleaseAllowed) } }