Backed out 2 changesets (bug 1638724, bug 1640418) for build bustages on WebExtensionTest.kt. CLOSED TREE

Backed out changeset ca9ad40caa79 (bug 1638724)
Backed out changeset 8824d1cadb7a (bug 1640418)
This commit is contained in:
Narcis Beleuzu 2020-07-07 21:47:40 +03:00
Родитель 2e8d3a633e
Коммит de7afe990b
2 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -16,6 +16,7 @@ import org.junit.Assert
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assume.assumeThat
@RunWith(AndroidJUnit4::class)
@MediumTest
@ -147,8 +148,10 @@ class PromptDelegateTest : BaseSessionTest() {
equalTo(false))
}
// disable test on opt for frequently failing Bug 1640418
@Test
fun onBeforeUnloadTest() {
assumeThat(sessionRule.env.isDebugBuild, equalTo(true))
sessionRule.setPrefsUntilTestEnd(mapOf(
"dom.require_user_interaction_for_beforeunload" to false
))
@ -163,15 +166,12 @@ class PromptDelegateTest : BaseSessionTest() {
}
})
val promptResult = GeckoResult<PromptDelegate.PromptResponse>()
val promptResult2 = GeckoResult<PromptDelegate.PromptResponse>()
var promptResult = GeckoResult<PromptDelegate.PromptResponse>()
sessionRule.delegateUntilTestEnd(object : Callbacks.PromptDelegate {
@AssertCalled(count = 2)
override fun onBeforeUnloadPrompt(session: GeckoSession, prompt: PromptDelegate.BeforeUnloadPrompt): GeckoResult<PromptDelegate.PromptResponse>? {
// We have to return something here because otherwise the delegate will be invoked
// before we have a chance to override it in the waitUntilCalled call below
return forEachCall(promptResult, promptResult2)
return promptResult
}
})
@ -186,20 +186,18 @@ class PromptDelegateTest : BaseSessionTest() {
}
})
sessionRule.waitForResult(promptResult)
// This request will go through and end the test. Doing the negative case first will
// ensure that if either of this tests fail the test will fail.
promptResult = GeckoResult()
sessionRule.session.evaluateJS("document.querySelector('#navigateAway2').click()")
sessionRule.waitUntilCalled(object : Callbacks.PromptDelegate {
@AssertCalled(count = 1)
override fun onBeforeUnloadPrompt(session: GeckoSession, prompt: PromptDelegate.BeforeUnloadPrompt): GeckoResult<PromptDelegate.PromptResponse>? {
promptResult2.complete(prompt.confirm(AllowOrDeny.ALLOW))
return promptResult2
promptResult.complete(prompt.confirm(AllowOrDeny.ALLOW))
return promptResult
}
})
sessionRule.waitForResult(promptResult2)
sessionRule.waitForResult(result)
}

Просмотреть файл

@ -555,7 +555,7 @@ class WebExtensionTest : BaseSessionTest() {
assertEquals(details.url, "https://www.mozilla.org/en-US/")
assertEquals(details.active, true)
assertEquals(details.cookieStoreId, "1")
assertEquals(tabsExtension!!.id!!, source.id)
assertEquals(tabsExtension!!, source)
tabsCreateResult.complete(null)
return GeckoResult.fromValue(null)
}