Commit 4a02b577 authored by Grisha Kruglov's avatar Grisha Kruglov
Browse files

Closes #5606: Re-use sessionToken during FxA migration

parent 96b531fc
......@@ -160,7 +160,7 @@ private object AuthenticatedAccountProcessor {
val signInResult = accountManager.signInWithShareableAccountAsync(
shareableAccount,
reuseSessionToken = false
reuseSessionToken = true
).await()
return when (signInResult) {
......
......@@ -82,7 +82,7 @@ class FennecFxaMigrationTest {
val fxaPath = File(getTestPath("fxa"), "married-v4.json")
val accountManager: FxaAccountManager = mock()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Success)
)
......@@ -92,7 +92,7 @@ class FennecFxaMigrationTest {
assertEquals("Married", (this.value as FxaMigrationResult.Success.SignedInIntoAuthenticatedAccount).stateLabel)
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
assertEquals("252fsvj8932vj32movj97325hjfksdhfjstrg23yurt267r23", captor.value.authInfo.kSync)
......@@ -106,7 +106,7 @@ class FennecFxaMigrationTest {
val fxaPath = File(getTestPath("fxa"), "cohabiting-v4.json")
val accountManager: FxaAccountManager = mock()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Success)
)
......@@ -116,7 +116,7 @@ class FennecFxaMigrationTest {
assertEquals("Cohabiting", (this.value as FxaMigrationResult.Success.SignedInIntoAuthenticatedAccount).stateLabel)
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
assertEquals("252bc4ccc3a239fsdfsdf32fg32wf3w4e3472d41d1a204890", captor.value.authInfo.kSync)
......@@ -130,7 +130,7 @@ class FennecFxaMigrationTest {
val fxaPath = File(getTestPath("fxa"), "cohabiting-v4.json")
val accountManager: FxaAccountManager = mock()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.WillRetry)
)
......@@ -140,7 +140,7 @@ class FennecFxaMigrationTest {
assertEquals("Cohabiting", (this.value as FxaMigrationResult.Success.WillAutoRetrySignInLater).stateLabel)
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
assertEquals("252bc4ccc3a239fsdfsdf32fg32wf3w4e3472d41d1a204890", captor.value.authInfo.kSync)
......@@ -154,7 +154,7 @@ class FennecFxaMigrationTest {
val fxaPath = File(getTestPath("fxa"), "married-v4.json")
val accountManager: FxaAccountManager = mock()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Failure)
)
......@@ -166,7 +166,7 @@ class FennecFxaMigrationTest {
assertEquals("Married", (unwrapped.failure as FxaMigrationResult.Failure.FailedToSignIntoAuthenticatedAccount).stateLabel)
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
assertEquals("252fsvj8932vj32movj97325hjfksdhfjstrg23yurt267r23", captor.value.authInfo.kSync)
......@@ -222,7 +222,7 @@ class FennecFxaMigrationTest {
val fxaPath = File(getTestPath("fxa"), "cohabiting-v4.json")
val accountManager: FxaAccountManager = mock()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Failure)
)
......@@ -234,7 +234,7 @@ class FennecFxaMigrationTest {
assertEquals("Cohabiting", unwrappedFailure.stateLabel)
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
assertEquals("252bc4ccc3a239fsdfsdf32fg32wf3w4e3472d41d1a204890", captor.value.authInfo.kSync)
......
......@@ -575,7 +575,7 @@ class FennecMigratorTest {
.setBrowserDbPath(File(getTestPath("combined"), "basic/browser.db").absolutePath)
.build()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Success)
)
......@@ -586,7 +586,7 @@ class FennecMigratorTest {
}
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
// This is going to be package name (org.mozilla.firefox) in actual builds.
......@@ -614,7 +614,7 @@ class FennecMigratorTest {
.setBrowserDbPath(File(getTestPath("combined"), "basic/browser.db").absolutePath)
.build()
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.WillRetry)
)
......@@ -625,7 +625,7 @@ class FennecMigratorTest {
}
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
// This is going to be package name (org.mozilla.firefox) in actual builds.
......@@ -654,7 +654,7 @@ class FennecMigratorTest {
.build()
// For now, we don't treat sign-in failure any different from success. E.g. it's a one-shot attempt.
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(false))).thenReturn(
`when`(accountManager.signInWithShareableAccountAsync(any(), eq(true))).thenReturn(
CompletableDeferred(SignInWithShareableAccountResult.Failure)
)
......@@ -665,7 +665,7 @@ class FennecMigratorTest {
}
val captor = argumentCaptor<ShareableAccount>()
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(false))
verify(accountManager).signInWithShareableAccountAsync(captor.capture(), eq(true))
assertEquals("test@example.com", captor.value.email)
// This is going to be package name (org.mozilla.firefox) in actual builds.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment