From 92562d539ff97b59024ffa51d14e33312b10b5fb Mon Sep 17 00:00:00 2001 From: Agi Sferro Date: Fri, 20 Sep 2019 18:14:25 +0000 Subject: [PATCH] Bug 1582150 - Don't rely on page stop in aboutConfig test. r=snorp Trying to access `about:config` will fail even before the page has started loading so we don't get the usual flow. For a normal page (that fails to load) it is: - OnLoadRequest - OnPageStart - OnLoadError - OnPageStop but for about:config it's just - OnLoadRequest - OnLoadError So we just wait for the OnLoadError message instead. Differential Revision: https://phabricator.services.mozilla.com/D46369 --HG-- extra : moz-landing-system : lando --- .../geckoview/test/RuntimeSettingsTest.kt | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt index 0cb11a4bcc89..72bbbf569148 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/RuntimeSettingsTest.kt @@ -8,14 +8,18 @@ import android.provider.Settings import android.support.test.InstrumentationRegistry import android.support.test.filters.MediumTest import android.support.test.runner.AndroidJUnit4 +import android.util.Log import org.hamcrest.Matchers.* import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith +import org.mozilla.geckoview.GeckoResult import kotlin.math.roundToInt import org.mozilla.geckoview.GeckoSession +import org.mozilla.geckoview.WebRequestError import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled import org.mozilla.geckoview.test.util.Callbacks +import java.util.concurrent.atomic.AtomicBoolean @RunWith(AndroidJUnit4::class) @MediumTest @@ -144,21 +148,21 @@ class RuntimeSettingsTest : BaseSessionTest() { } @Test - @Ignore // Bug 1582150 fun aboutConfig() { - val settings = sessionRule.runtime.settings; + val settings = sessionRule.runtime.settings assertThat("about:config should be disabled by default", settings.aboutConfigEnabled, equalTo(false)) - mainSession.delegateDuringNextWait(object : Callbacks.ProgressDelegate { - @AssertCalled - override fun onPageStop(session: GeckoSession, success: Boolean) { - assertThat("about:config load should fail", success, equalTo(false)) - } - }) mainSession.loadUri("about:config") - mainSession.waitForPageStop() + mainSession.waitUntilCalled(object : Callbacks.NavigationDelegate { + @AssertCalled + override fun onLoadError(session: GeckoSession, uri: String?, error: WebRequestError): + GeckoResult? { + assertThat("about:config should not load.", uri, equalTo("about:config")) + return null + } + }) settings.aboutConfigEnabled = true