Bug 1624715 - Remove network assertion introduced in Bug 1622816, r=snorp.
authorBob Clary <bclary@bclary.com>
Tue, 24 Mar 2020 21:44:49 +0000
changeset 520291 dd82e0be7f03a54045deadd516de02bd864147d3
parent 520290 bebf8622dd3b05350cb9418f6eb4f35e296c29f3
child 520292 9b5ef67cd556c0f9d5d2a3d17c462b93b90f41ec
push id37246
push useropoprus@mozilla.com
push dateWed, 25 Mar 2020 03:40:33 +0000
treeherdermozilla-central@14b59d4adc95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1624715, 1622816
milestone76.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 1624715 - Remove network assertion introduced in Bug 1622816, r=snorp. Differential Revision: https://phabricator.services.mozilla.com/D68097
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
@@ -14,23 +14,18 @@ import org.mozilla.geckoview.GeckoSessio
 import org.mozilla.geckoview.GeckoView;
 import org.mozilla.geckoview.GeckoRuntime;
 import org.mozilla.geckoview.GeckoRuntimeSettings;
 import org.mozilla.geckoview.WebExtension;
 import org.mozilla.geckoview.WebExtensionController;
 import org.mozilla.geckoview.WebRequestError;
 
 import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
 import android.content.Intent;
-import android.content.IntentFilter;
 import android.graphics.SurfaceTexture;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
 import android.net.Uri;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.view.Surface;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -257,43 +252,22 @@ public class TestRunnerActivity extends 
         session.close();
         if (!mOwnedSessions.isEmpty()) {
             // Pick a random session to set as active
             mActiveSession = mOwnedSessions.iterator().next();
             webExtensionController().setTabActive(mActiveSession, true);
         }
     }
 
-    private void ensureNetworkAvailable() {
-        ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-        NetworkInfo network = cm.getActiveNetworkInfo();
-        if (network == null || !network.isConnected()) {
-            throw new RuntimeException("No network available");
-        }
-
-        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
-        registerReceiver(new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                final boolean notConnected = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
-                if (notConnected) {
-                    throw new RuntimeException("Network connection has been lost");
-                }
-            }
-        }, filter);
-    }
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         final Intent intent = getIntent();
 
-        ensureNetworkAvailable();
-
         if (sRuntime == null) {
             final GeckoRuntimeSettings.Builder runtimeSettingsBuilder =
                 new GeckoRuntimeSettings.Builder();
 
             // Mochitest and reftest encounter rounding errors if we have a
             // a window.devicePixelRation like 3.625, so simplify that here.
             runtimeSettingsBuilder
                     .arguments(new String[] { "-purgecaches" })