summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_bug515583.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /netwerk/test/unit/test_bug515583.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/test/unit/test_bug515583.js')
-rw-r--r--netwerk/test/unit/test_bug515583.js73
1 files changed, 73 insertions, 0 deletions
diff --git a/netwerk/test/unit/test_bug515583.js b/netwerk/test/unit/test_bug515583.js
new file mode 100644
index 000000000..28e43a3de
--- /dev/null
+++ b/netwerk/test/unit/test_bug515583.js
@@ -0,0 +1,73 @@
+const URL = "ftp://localhost/bug515583/";
+
+const tests = [
+ ["[RWCEM1 4 1-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1] 4 2-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1]A 4 3-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1]B; 4 4-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1];1 4 5-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1]; 4 6-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1]C;1D 4 7-MAR-1993 18:09:01.12\r\n" +
+ "[RWCEM1]E;1 4 8-MAR-1993 18:09:01.12\r\n"
+ ,
+ "300: " + URL + "\n" +
+ "200: filename content-length last-modified file-type\n" +
+ "201: \"A\" 2048 Wed%2C%2003%20Mar%201993%2018%3A09%3A01 FILE \n" +
+ "201: \"E\" 2048 Mon%2C%2008%20Mar%201993%2018%3A09%3A01 FILE \n"]
+ ,
+ ["\r\r\r\n"
+ ,
+ "300: " + URL + "\n" +
+ "200: filename content-length last-modified file-type\n"]
+]
+
+function checkData(request, data, ctx) {
+ do_check_eq(tests[0][1], data);
+ tests.shift();
+ do_execute_soon(next_test);
+}
+
+function storeData(status, entry) {
+ var scs = Cc["@mozilla.org/streamConverters;1"].
+ getService(Ci.nsIStreamConverterService);
+ var converter = scs.asyncConvertData("text/ftp-dir", "application/http-index-format",
+ new ChannelListener(checkData, null, CL_ALLOW_UNKNOWN_CL), null);
+
+ var stream = Cc["@mozilla.org/io/string-input-stream;1"].
+ createInstance(Ci.nsIStringInputStream);
+ stream.data = tests[0][0];
+
+ var url = {
+ password: "",
+ asciiSpec: URL,
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIURI])
+ };
+
+ var channel = {
+ URI: url,
+ contentLength: -1,
+ pending: true,
+ isPending: function() {
+ return this.pending;
+ },
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel])
+ };
+
+ converter.onStartRequest(channel, null);
+ converter.onDataAvailable(channel, null, stream, 0, 0);
+ channel.pending = false;
+ converter.onStopRequest(channel, null, Cr.NS_OK);
+}
+
+function next_test() {
+ if (tests.length == 0)
+ do_test_finished();
+ else {
+ storeData();
+ }
+}
+
+function run_test() {
+ do_execute_soon(next_test);
+ do_test_pending();
+}