From de7afe990b6ead499595f27878419d293d5c19c7 Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Tue, 7 Jul 2020 21:47:40 +0300 Subject: [PATCH] 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) --- .../geckoview/test/PromptDelegateTest.kt | 18 ++++++++---------- .../mozilla/geckoview/test/WebExtensionTest.kt | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PromptDelegateTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PromptDelegateTest.kt index e6ba6f93cb43..39d52323a333 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PromptDelegateTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PromptDelegateTest.kt @@ -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() - val promptResult2 = GeckoResult() - + var promptResult = GeckoResult() sessionRule.delegateUntilTestEnd(object : Callbacks.PromptDelegate { - @AssertCalled(count = 2) override fun onBeforeUnloadPrompt(session: GeckoSession, prompt: PromptDelegate.BeforeUnloadPrompt): GeckoResult? { // 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? { - promptResult2.complete(prompt.confirm(AllowOrDeny.ALLOW)) - return promptResult2 + promptResult.complete(prompt.confirm(AllowOrDeny.ALLOW)) + return promptResult } }) - sessionRule.waitForResult(promptResult2) sessionRule.waitForResult(result) } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt index 73be9a578091..3407bd4dff92 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/WebExtensionTest.kt @@ -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) }