From 6a3d3ec104b77b73431414b5d45900dcafefa0e1 Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Thu, 26 Mar 2020 21:35:45 +0000 Subject: [PATCH] Bug 1625310: Change WebExtensionTest to use the session rule for creating its GeckoSession objects; r=agi Differential Revision: https://phabricator.services.mozilla.com/D68461 --HG-- extra : moz-landing-system : lando --- .../org/mozilla/geckoview/test/WebExtensionTest.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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 de8d183bf194..82dc532ae84f 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 @@ -538,7 +538,7 @@ class WebExtensionTest : BaseSessionTest() { { tabsExtension.setTabDelegate(null) }, object : WebExtension.TabDelegate { override fun onNewTab(source: WebExtension, details: WebExtension.CreateTabDetails): GeckoResult { - val extensionCreatedSession = GeckoSession(sessionRule.session.settings) + val extensionCreatedSession = sessionRule.createClosedSession(sessionRule.session.settings) extensionCreatedSession.webExtensionController.setTabDelegate(tabsExtension, object : WebExtension.SessionTabDelegate { override fun onCloseTab(source: WebExtension?, session: GeckoSession): GeckoResult { @@ -578,9 +578,7 @@ class WebExtensionTest : BaseSessionTest() { fun testSetTabActive() { val onCloseRequestResult = GeckoResult() val tabsExtension = WebExtension(TABS_ACTIVATE_REMOVE_BACKGROUND, controller) - val newTabSession = GeckoSession(sessionRule.session.settings) - - newTabSession.open(sessionRule.runtime) + val newTabSession = sessionRule.createOpenSession(sessionRule.session.settings) sessionRule.addExternalDelegateUntilTestEnd( WebExtension.SessionTabDelegate::class, @@ -639,12 +637,10 @@ class WebExtensionTest : BaseSessionTest() { controller.setAllowedInPrivateBrowsing(tabsExtensionPB, true)) - val newTabSession = GeckoSession(sessionRule.session.settings) - newTabSession.open(sessionRule.runtime) + val newTabSession = sessionRule.createOpenSession(sessionRule.session.settings) - val newPrivateSession = GeckoSession( + val newPrivateSession = sessionRule.createOpenSession( GeckoSessionSettings.Builder().usePrivateMode(true).build()) - newPrivateSession.open(sessionRule.runtime) val privateBrowsingNewTabSession = GeckoResult()