Bug 1507206 - Load error pages in TestRunnerActivity r=esawin
authorJames Willcox <snorp@snorp.net>
Tue, 27 Nov 2018 17:02:14 +0000
changeset 504767 a0b8137e55edab833c4d0c472cb1a7f8f13f7840
parent 504766 677d32e4a6afc448e3d6c8f359cb1161c906181e
child 504768 9fa6d8be9e0167bbb9345f3e18d4f3c07e5a2c79
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1507206
milestone65.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 1507206 - Load error pages in TestRunnerActivity r=esawin Differential Revision: https://phabricator.services.mozilla.com/D11909
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java
--- 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
@@ -21,16 +21,18 @@ import android.graphics.SurfaceTexture;
 import android.net.Uri;
 import android.os.Bundle;
 import android.view.Surface;
 
 import java.util.HashMap;
 
 public class TestRunnerActivity extends Activity {
     private static final String LOGTAG = "TestRunnerActivity";
+    private static final String ERROR_PAGE =
+            "<!DOCTYPE html><head><title>Error</title></head><body>Error!</body></html>";
 
     static GeckoRuntime sRuntime;
 
     private GeckoSession mSession;
     private GeckoView mView;
     private boolean mKillProcessOnDestroy;
 
     private HashMap<GeckoSession, GeckoDisplay> mDisplays = new HashMap<>();
@@ -60,17 +62,18 @@ public class TestRunnerActivity extends 
 
         @Override
         public GeckoResult<GeckoSession> onNewSession(GeckoSession session, String uri) {
             return GeckoResult.fromValue(createBackgroundSession(session.getSettings()));
         }
 
         @Override
         public GeckoResult<String> onLoadError(GeckoSession session, String uri, WebRequestError error) {
-            return null;
+
+            return GeckoResult.fromValue("data:text/html," + ERROR_PAGE);
         }
     };
 
     private GeckoSession.ContentDelegate mContentDelegate = new GeckoSession.ContentDelegate() {
         @Override
         public void onTitleChange(GeckoSession session, String title) {
 
         }
@@ -164,22 +167,19 @@ public class TestRunnerActivity extends 
                 runtimeSettingsBuilder.extras(extras);
             }
 
             runtimeSettingsBuilder
                     .consoleOutput(true)
                     .crashHandler(TestCrashHandler.class);
 
             sRuntime = GeckoRuntime.create(this, runtimeSettingsBuilder.build());
-            sRuntime.setDelegate(new GeckoRuntime.Delegate() {
-                @Override
-                public void onShutdown() {
-                    mKillProcessOnDestroy = true;
-                    finish();
-                }
+            sRuntime.setDelegate(() -> {
+                mKillProcessOnDestroy = true;
+                finish();
             });
         }
 
         mSession = createSession();
         mSession.open(sRuntime);
 
         // If we were passed a URI in the Intent, open it
         final Uri uri = intent.getData();