Bug 1188120: remove B2G networking test code
MozReview-Commit-ID: 9Yp1Ycbgmfb
--- a/dom/media/tests/mochitest/identity/mochitest.ini
+++ b/dom/media/tests/mochitest/identity/mochitest.ini
@@ -38,12 +38,8 @@ support-files =
[test_setIdentityProvider.html]
[test_setIdentityProviderWithErrors.html]
[test_peerConnection_peerIdentity.html]
[test_peerConnection_asymmetricIsolation.html]
[test_loginNeeded.html]
support-files =
/.well-known/idp-proxy/login.html
/.well-known/idp-proxy/idp.sjs
-
-
-# Bug 950317: Hack for making a cleanup hook after finishing all WebRTC cases
-[../test_zmedia_cleanup.html]
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -279,10 +279,8 @@ skip-if = toolkit == 'gonk' || buildapp
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_peerConnection_remoteRollback.html]
skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # b2g (Bug 1059867), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_remoteReofferRollback.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_selftest.html]
# Bug 1227781: Crash with bogus TURN server.
[test_peerConnection_bug1227781.html]
-# Bug 950317: Hack for making a cleanup hook after finishing all WebRTC cases
-[test_zmedia_cleanup.html]
--- a/dom/media/tests/mochitest/network.js
+++ b/dom/media/tests/mochitest/network.js
@@ -1,122 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
- * Query function for determining if any IP address is available for
- * generating SDP.
+ * A stub function for preparing the network if needed
*
- * @return false if required additional network setup.
*/
-function isNetworkReady() {
- // for gonk platform
- if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
- var listService = SpecialPowers.Cc["@mozilla.org/network/interface-list-service;1"]
- .getService(SpecialPowers.Ci.nsINetworkInterfaceListService);
- var itfList = listService.getDataInterfaceList(
- SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_MMS_INTERFACES |
- SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_SUPL_INTERFACES |
- SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_IMS_INTERFACES |
- SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_DUN_INTERFACES |
- SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_FOTA_INTERFACES);
- var num = itfList.getNumberOfInterface();
- for (var i = 0; i < num; i++) {
- var ips = {};
- var prefixLengths = {};
- var length = itfList.getInterfaceInfo(i).getAddresses(ips, prefixLengths);
-
- for (var j = 0; j < length; j++) {
- var ip = ips.value[j];
- // skip IPv6 address until bug 797262 is implemented
- if (ip.indexOf(":") < 0) {
- info("Network interface is ready with address: " + ip);
- return true;
- }
- }
- }
- // ip address is not available
- info("Network interface is not ready, required additional network setup");
- return false;
- }
- info("Network setup is not required");
- return true;
+function startNetworkAndTest() {
+ return Promise.resolve();
}
/**
- * Network setup utils for Gonk
- *
- * @return {object} providing functions for setup/teardown data connection
- */
-function getNetworkUtils() {
- var url = SimpleTest.getTestFileURL("NetworkPreparationChromeScript.js");
- var script = SpecialPowers.loadChromeScript(url);
-
- var utils = {
- /**
- * Utility for setting up data connection.
- *
- * @param aCallback callback after data connection is ready.
- */
- prepareNetwork: function() {
- return new Promise(resolve => {
- script.addMessageListener('network-ready', () => {
- info("Network interface is ready");
- resolve();
- });
- info("Setting up network interface");
- script.sendAsyncMessage("prepare-network", true);
- });
- },
- /**
- * Utility for tearing down data connection.
- *
- * @param aCallback callback after data connection is closed.
- */
- tearDownNetwork: function() {
- if (!isNetworkReady()) {
- info("No network to tear down");
- return Promise.resolve();
- }
- return new Promise(resolve => {
- script.addMessageListener('network-disabled', message => {
- info("Network interface torn down");
- script.destroy();
- resolve();
- });
- info("Tearing down network interface");
- script.sendAsyncMessage("network-cleanup", true);
- });
- }
- };
-
- return utils;
-}
-
-/**
- * Setup network on Gonk if needed and execute test once network is up
- *
- */
-function startNetworkAndTest() {
- if (isNetworkReady()) {
- return Promise.resolve();
- }
- var utils = getNetworkUtils();
- // Trigger network setup to obtain IP address before creating any PeerConnection.
- return utils.prepareNetwork();
-}
-
-/**
- * A wrapper around SimpleTest.finish() to handle B2G network teardown
+ * A stub function to shutdown the network if needed
*/
function networkTestFinished() {
- var p;
- if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
- var utils = getNetworkUtils();
- p = utils.tearDownNetwork();
- } else {
- p = Promise.resolve();
- }
- return p.then(() => finish());
+ return Promise.resolve().then(() => finish());
}
deleted file mode 100644
--- a/dom/media/tests/mochitest/test_zmedia_cleanup.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <script src="network.js"></script>
- </head>
-<body>
-<pre id="test">
-<script type="application/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
- getNetworkUtils().tearDownNetwork()
- .then(() =>
- ok(true, 'Successfully teared down network interface'),
- () =>
- ok(true, 'Network interface was in down state already'))
- .then(() => SimpleTest.finish());
-} else {
- ok(true, 'No need to cleanup network interface');
- SimpleTest.finish();
-}
-
-</script>
-</pre>
-</body>
-</html>