Bug 870660: Part 4: Remove test_udpsocket. r=jdm
authorPatrick Wang <kk1fff@patrickz.net>
Sat, 30 Nov 2013 00:17:35 +0800
changeset 172888 35b2064e87d44a625e3b7f756f2833d12ed3a744
parent 172887 61fdab1c8ab62631209a2af1f28bb87ea5568269
child 172889 18c75b6a5284b0582dc1321b8f54e2ba84a3dbb1
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs870660
milestone28.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 870660: Part 4: Remove test_udpsocket. r=jdm
dom/network/tests/unit_ipc/test_udpsocket_ipc.js
dom/network/tests/unit_ipc/udpsocket_child.js
dom/network/tests/unit_ipc/xpcshell.ini
deleted file mode 100644
--- a/dom/network/tests/unit_ipc/test_udpsocket_ipc.js
+++ /dev/null
@@ -1,9 +0,0 @@
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function run_test() {
-  Services.prefs.setBoolPref('media.peerconnection.ipc.enabled', true);
-  run_test_in_child("/udpsocket_child.js", function() {
-    Services.prefs.clearUserPref('media.peerconnection.ipc.enabled');
-    do_test_finished();
-  });
-}
deleted file mode 100644
--- a/dom/network/tests/unit_ipc/udpsocket_child.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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';
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-
-const SERVER_PORT = 12345;
-const DATA_ARRAY = [0, 255, 254, 0, 1, 2, 3, 0, 255, 255, 254, 0];
-
-function UDPSocketInternalImpl() {
-}
-
-UDPSocketInternalImpl.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIUDPSocketInternal]),
-  callListenerError: function(type, message, filename, lineNumber, columnNumber) {
-    if (this.onerror) {
-      this.onerror();
-    } else {
-      do_throw('Received unexpected error: ' + message + ' at ' + filename +
-                ':' + lineNumber + ':' + columnNumber);
-    }
-  },
-  callListenerReceivedData: function(type, host, port, data, dataLength) {
-    do_print('*** recv data(' + dataLength + ')=' + data.join() + '\n');
-    if (this.ondata) {
-      try {
-        this.ondata(data, dataLength);
-      } catch(ex) {
-        if (ex === Cr.NS_ERROR_ABORT)
-          throw ex;
-        do_print('Caught exception: ' + ex + '\n' + ex.stack);
-        do_throw('test is broken; bad ondata handler; see above');
-      }
-    } else {
-      do_throw('Received ' + dataLength + ' bytes of unexpected data!');
-    }
-  },
-  callListenerVoid: function(type) {
-    switch (type) {
-    case 'onopen':
-      if (this.onopen) {
-        this.onopen();
-      }
-      break;
-    case 'onclose':
-      if (this.onclose) {
-        this.onclose();
-      }
-      break;
-    }
-  },
-  callListenerSent: function(type, value) {
-    if (value != Cr.NS_OK) {
-      do_throw('Previous send was failed with cause: ' + value);
-    }
-  },
-  updateReadyState: function(readyState) {
-    do_print('*** current state: ' + readyState + '\n');
-  },
-  onopen: function() {},
-  onclose: function() {},
-};
-
-function makeSuccessCase(name) {
-  return function() {
-    do_print('got expected: ' + name);
-    run_next_test();
-  };
-}
-
-function makeJointSuccess(names) {
-  let funcs = {}, successCount = 0;
-  names.forEach(function(name) {
-    funcs[name] = function() {
-      do_print('got excepted: ' + name);
-      if (++successCount === names.length)
-        run_next_test();
-    };
-  });
-  return funcs;
-}
-
-function makeExpectedData(expectedData, callback) {
-  return function(receivedData, receivedDataLength) {
-    if (receivedDataLength != expectedData.length) {
-      do_throw('Received data size mismatched, expected ' + expectedData.length +
-               ' but got ' + receivedDataLength);
-    }
-    for (let i = 0; i < receivedDataLength; i++) {
-      if (receivedData[i] != expectedData[i]) {
-        do_throw('Received mismatched data at position ' + i);
-      }
-    }
-    if (callback) {
-      callback();
-    } else {
-      run_next_test();
-    }
-  };
-}
-
-function makeFailureCase(name) {
-  return function() {
-    let argstr;
-    if (arguments.length) {
-      argstr = '(args: ' +
-        Array.map(arguments, function(x) {return x.data + ""; }).join(" ") + ')';
-    } else {
-      argstr = '(no arguments)';
-    }
-    do_throw('got unexpected: ' + name + ' ' + argstr);
-  };
-}
-
-function createSocketChild() {
-  return Cc['@mozilla.org/udp-socket-child;1']
-           .createInstance(Ci.nsIUDPSocketChild);
-}
-
-var UDPSocket = createSocketChild();
-var callback = new UDPSocketInternalImpl();
-
-function connectSock() {
-  UDPSocket.bind(callback, '127.0.0.1', SERVER_PORT);
-  callback.onopen = makeSuccessCase('open');
-}
-
-function sendData() {
-  UDPSocket.send('127.0.0.1', SERVER_PORT, DATA_ARRAY, DATA_ARRAY.length);
-  callback.ondata = makeExpectedData(DATA_ARRAY);
-}
-
-function clientClose() {
-  UDPSocket.close();
-  callback.ondata = makeFailureCase('data');
-  callback.onclose = makeSuccessCase('close');
-}
-
-function connectError() {
-  UDPSocket = createSocketChild();
-  UDPSocket.bind(callback, 'some non-IP string', SERVER_PORT);
-  callback.onerror = makeSuccessCase('error');
-  callback.onopen = makeFailureCase('open');
-}
-
-function cleanup() {
-  UDPSocket = null;
-  run_next_test();
-}
-
-add_test(connectSock);
-add_test(sendData);
-add_test(clientClose);
-add_test(connectError);
-add_test(cleanup);
-
-function run_test() {
-  run_next_test();
-}
--- a/dom/network/tests/unit_ipc/xpcshell.ini
+++ b/dom/network/tests/unit_ipc/xpcshell.ini
@@ -1,10 +1,7 @@
 [DEFAULT]
 head =
 tail =
-support-files =
-  udpsocket_child.js
 
 [test_tcpsocket_ipc.js]
 [test_tcpserversocket_ipc.js]
-[test_udpsocket_ipc.js]
 run-sequentially = Uses hardcoded port, bug 903830.