Backed out changeset 581cdaf67a25
authorChris Double <chris.double@double.co.nz>
Thu, 23 Aug 2012 21:45:33 +1200
changeset 105200 afe10b61951a383c240c52b8c5b4094abcb1cad2
parent 105196 3110f58a46f4a5c214cb853f40a1da78dc231da2
child 105201 adb719a12c464397276c2f553ce8dc65079b8112
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
milestone17.0a1
backs out581cdaf67a25a491c3471ab8c72c983ac42865d8
Backed out changeset 581cdaf67a25
xpcom/tests/unit/test_seek_multiplex.js
xpcom/tests/unit/xpcshell.ini
deleted file mode 100644
--- a/xpcom/tests/unit/test_seek_multiplex.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* 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/. */
-
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const CC = Components.Constructor;
-const Cc = Components.classes;
-
-// The string we use as data.
-const data = "0123456789";
-// Number of streams in the multiplex stream.
-const count = 10;
-
-function test_multiplex_streams() {
-  try {
-    var MultiplexStream = CC("@mozilla.org/io/multiplex-input-stream;1",
-                             "nsIMultiplexInputStream");
-                             do_check_eq(1, 1);
-
-    var BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
-                                                   "nsIBinaryInputStream");
-    var BinaryOutputStream = Components.Constructor("@mozilla.org/binaryoutputstream;1",
-                                                    "nsIBinaryOutputStream",
-                                                    "setOutputStream");
-    var multiplex = new MultiplexStream();
-    for (var i = 0; i < count; ++i) {
-      let s = Cc["@mozilla.org/io/string-input-stream;1"]
-                .createInstance(Ci.nsIStringInputStream);
-      s.setData(data, data.length);
-
-      multiplex.appendStream(s);
-    }
-    var seekable = multiplex.QueryInterface(Ci.nsISeekableStream);
-    var sis = Cc["@mozilla.org/scriptableinputstream;1"]
-                .createInstance(Ci.nsIScriptableInputStream);
-    sis.init(seekable);
-    // Read some data.
-    var readData = sis.read(20);
-    do_check_eq(readData, data + data);
-    // -- Tests for NS_SEEK_SET
-    // Seek accross stream.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 35);
-    do_check_eq(seekable.tell(), 35);
-    do_check_eq(seekable.available(), 65);
-    readData = sis.read(5);
-    do_check_eq(readData, data.slice(5));
-    do_check_eq(seekable.available(), 60);
-    // Seek at stream boundaries.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 40);
-    do_check_eq(seekable.tell(), 40);
-    do_check_eq(seekable.available(), 60);
-    readData = sis.read(10);
-    do_check_eq(readData, data);
-    do_check_eq(seekable.tell(), 50);
-    do_check_eq(seekable.available(), 50);
-    // Rewind and read accross streams.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 39);
-    do_check_eq(seekable.tell(), 39);
-    do_check_eq(seekable.available(), 61);
-    readData = sis.read(11);
-    do_check_eq(readData, data.slice(9) + data);
-    do_check_eq(seekable.tell(), 50);
-    do_check_eq(seekable.available(), 50);
-    // Rewind to the beginning.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
-    do_check_eq(seekable.tell(), 0);
-    do_check_eq(seekable.available(), 100);
-    // Seek to some randome location
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 50);
-    // -- Tests for NS_SEEK_CUR
-    // Positive seek.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_CUR, 15);
-    do_check_eq(seekable.tell(), 65);
-    do_check_eq(seekable.available(), 35);
-    readData = sis.read(10);
-    do_check_eq(readData, data.slice(5) + data.slice(0, 5));
-    do_check_eq(seekable.tell(), 75);
-    do_check_eq(seekable.available(), 25);
-    // Negative seek.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_CUR, -15);
-    do_check_eq(seekable.tell(), 60);
-    do_check_eq(seekable.available(), 40);
-    readData = sis.read(10);
-    do_check_eq(readData, data);
-    do_check_eq(seekable.tell(), 70);
-    do_check_eq(seekable.available(), 30);
-
-    // -- Tests for NS_SEEK_END
-    // Normal read.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_END, -5);
-    do_check_eq(seekable.tell(), data.length * count - 5);
-    readData = sis.read(5);
-    do_check_eq(readData, data.slice(5));
-    do_check_eq(seekable.tell(), data.length * count);
-    // Read accros streams.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_END, -15);
-    do_check_eq(seekable.tell(), data.length * count - 15);
-    readData = sis.read(15);
-    do_check_eq(readData, data.slice(5) + data);
-    do_check_eq(seekable.tell(), data.length * count);
-
-    // -- Try to do various edge cases
-    // Forward seek from the end, should throw.
-    var caught = false;
-    try {
-      seekable.seek(Ci.nsISeekableStream.NS_SEEK_END, 15);
-    } catch(e) {
-      caught = true;
-    }
-    do_check_eq(caught, true);
-    do_check_eq(seekable.tell(), data.length * count);
-    // Backward seek from the beginning, should be clamped.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
-    do_check_eq(seekable.tell(), 0);
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_CUR, -15);
-    do_check_eq(seekable.tell(), 0);
-    // Seek too far: shoul be clamped.
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
-    do_check_eq(seekable.tell(), 0);
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_CUR, 3 * data.length * count);
-    do_check_eq(seekable.tell(), 100);
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, data.length * count);
-    do_check_eq(seekable.tell(), 100);
-    seekable.seek(Ci.nsISeekableStream.NS_SEEK_CUR, -2 * data.length * count);
-    do_check_eq(seekable.tell(), 0);
-  } catch(e) {
-    dump(e + "\n");
-  }
-}
-
-function run_test() {
-  test_multiplex_streams();
-}
-
--- a/xpcom/tests/unit/xpcshell.ini
+++ b/xpcom/tests/unit/xpcshell.ini
@@ -30,17 +30,16 @@ fail-if = os == "android"
 [test_nsIMutableArray.js]
 [test_nsIProcess.js]
 skip-if = os == "win" # bug 582821
 [test_nsIProcess_stress.js]
 skip-if = os == "win" # See bug: 676412
 [test_pipe.js]
 [test_storagestream.js]
 [test_streams.js]
-[test_seek_multiplex.js]
 [test_stringstream.js]
 [test_symlinks.js]
 # Bug 676998: test fails consistently on Android
 fail-if = os == "android"
 [test_systemInfo.js]
 # Bug 676998: test fails consistently on Android
 fail-if = os == "android"
 [test_versioncomparator.js]