Bug 1439013 - [3.0] Update tests to use new onLoadRequest interface. r=jchen
authorEugen Sawin <esawin@mozilla.com>
Thu, 26 Apr 2018 22:35:37 +0200
changeset 416140 653f16ce003a533e822053a042e41c1adcc55763
parent 416139 a26881251c96ad32e546468be55643bf834855cb
child 416141 e5425430461fca727ca0bfab0261248a15f6fd44
push id33917
push userapavel@mozilla.com
push dateSat, 28 Apr 2018 17:30:55 +0000
treeherdermozilla-central@08f68e2c892c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1439013
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1439013 - [3.0] Update tests to use new onLoadRequest interface. r=jchen
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressDelegateTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt
@@ -32,17 +32,19 @@ class ContentDelegateTest : BaseSessionT
     }
 
     @Test fun download() {
         sessionRule.session.loadTestPath(DOWNLOAD_HTML_PATH)
 
         sessionRule.waitUntilCalled(object : Callbacks.NavigationDelegate, Callbacks.ContentDelegate {
 
             @AssertCalled(count = 2)
-            override fun onLoadRequest(session: GeckoSession, uri: String, where: Int, response: GeckoResponse<Boolean>) {
+            override fun onLoadRequest(session: GeckoSession, uri: String,
+                                       where: Int, flags: Int,
+                                       response: GeckoResponse<Boolean>) {
                 response.respond(false)
             }
 
             @AssertCalled(false)
             override fun onNewSession(session: GeckoSession, uri: String, response: GeckoResponse<GeckoSession>) {
             }
 
             @AssertCalled(count = 1)
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
@@ -24,16 +24,17 @@ class NavigationDelegateTest : BaseSessi
     @Test fun load() {
         sessionRule.session.loadTestPath(HELLO_HTML_PATH)
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 1, order = intArrayOf(1))
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 assertThat("Session should not be null", session, notNullValue())
                 assertThat("URI should not be null", uri, notNullValue())
                 assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
                 assertThat("Where should not be null", where, notNullValue())
                 assertThat("Where should match", where,
                            equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
                 response.respond(false)
@@ -185,16 +186,17 @@ class NavigationDelegateTest : BaseSessi
 
         sessionRule.session.reload()
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 1, order = intArrayOf(1))
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
                 assertThat("Where should match", where,
                            equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
                 response.respond(false)
             }
 
             @AssertCalled(count = 1, order = intArrayOf(2))
@@ -235,16 +237,17 @@ class NavigationDelegateTest : BaseSessi
 
         sessionRule.session.goBack()
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 1, order = intArrayOf(1))
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
                 assertThat("Where should match", where,
                            equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
                 response.respond(false)
             }
 
             @AssertCalled(count = 1, order = intArrayOf(2))
@@ -270,16 +273,17 @@ class NavigationDelegateTest : BaseSessi
 
         sessionRule.session.goForward()
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 1, order = intArrayOf(1))
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 assertThat("URI should match", uri, endsWith(HELLO2_HTML_PATH))
                 assertThat("Where should match", where,
                            equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
                 response.respond(false)
             }
 
             @AssertCalled(count = 1, order = intArrayOf(2))
@@ -304,16 +308,17 @@ class NavigationDelegateTest : BaseSessi
         })
     }
 
     @Test fun onLoadUri_returnTrueCancelsLoad() {
         sessionRule.delegateDuringNextWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 2)
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 response.respond(uri.endsWith(HELLO_HTML_PATH))
             }
         })
 
         sessionRule.session.loadTestPath(HELLO_HTML_PATH)
         sessionRule.session.loadTestPath(HELLO2_HTML_PATH)
         sessionRule.waitForPageStop()
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressDelegateTest.kt
@@ -57,16 +57,17 @@ class ProgressDelegateTest : BaseSession
     fun loadExpectNetError(testUri: String) {
         sessionRule.session.loadUri(testUri);
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate, Callbacks.NavigationDelegate {
             @AssertCalled(count = 2)
             override fun onLoadRequest(session: GeckoSession, uri: String,
                                        where: Int,
+                                       flags: Int,
                                        response: GeckoResponse<Boolean>) {
                 if (sessionRule.currentCall.counter == 1) {
                     assertThat("URI should be " + testUri, uri, equalTo(testUri));
                 } else {
                     assertThat("URI should be about:neterror", uri, startsWith("about:neterror"));
                 }
                 response.respond(false)
             }
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java
@@ -39,16 +39,17 @@ public class TestRunnerActivity extends 
 
         @Override
         public void onCanGoForward(GeckoSession session, boolean canGoForward) {
 
         }
 
         @Override
         public void onLoadRequest(GeckoSession session, String uri, int target,
+                                  int flags,
                                   GeckoResponse<Boolean> response) {
             // Allow Gecko to load all URIs
             response.respond(false);
         }
 
         @Override
         public void onNewSession(GeckoSession session, String uri, GeckoResponse<GeckoSession> response) {
             response.respond(createSession(session.getSettings()));
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
@@ -43,16 +43,17 @@ class Callbacks private constructor() {
 
         override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
         }
 
         override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
         }
 
         override fun onLoadRequest(session: GeckoSession, uri: String, where: Int,
+                                   flags: Int,
                                    response: GeckoResponse<Boolean>) {
             response.respond(false)
         }
 
         override fun onNewSession(session: GeckoSession, uri: String, response: GeckoResponse<GeckoSession>) {
             response.respond(null)
         }
     }