diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/components/feeds/test/head.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'toolkit/components/feeds/test/head.js')
-rw-r--r-- | toolkit/components/feeds/test/head.js | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/toolkit/components/feeds/test/head.js b/toolkit/components/feeds/test/head.js new file mode 100644 index 000000000..65aa64b94 --- /dev/null +++ b/toolkit/components/feeds/test/head.js @@ -0,0 +1,80 @@ +"use strict"; + +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; +var Cr = Components.results; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/NetUtil.jsm"); + +function readTestData(testFile) { + var testcase = {}; + + // Got a feed file, now we need to parse out the Description and Expect headers. + var istream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream); + try { + istream.init(testFile, 0x01, parseInt("0444", 8), 0); + istream.QueryInterface(Ci.nsILineInputStream); + + var hasmore = false; + do { + var line = {}; + hasmore = istream.readLine(line); + + if (line.value.indexOf('Description:') > -1) { + testcase.desc = line.value.substring(line.value.indexOf(':')+1).trim(); + } + + if (line.value.indexOf('Expect:') > -1) { + testcase.expect = line.value.substring(line.value.indexOf(':')+1).trim(); + } + + if (line.value.indexOf('Base:') > -1) { + testcase.base = NetUtil.newURI(line.value.substring(line.value.indexOf(':')+1).trim()); + } + + if (testcase.expect && testcase.desc) { + testcase.path = 'xml/' + testFile.parent.leafName + '/' + testFile.leafName; + testcase.file = testFile; + break; + } + + } while (hasmore); + + } catch (e) { + Assert.ok(false, "FAILED! Error reading testFile case in file " + testFile.leafName + " ---- " + e); + } finally { + istream.close(); + } + + return testcase; +} + +function iterateDir(dir, recurse, callback) { + do_print("Iterate " + dir.leafName); + let entries = dir.directoryEntries; + + // Loop over everything in this dir. If its a dir + while (entries.hasMoreElements()) { + let entry = entries.getNext(); + entry.QueryInterface(Ci.nsILocalFile); + + if (entry.isDirectory()) { + if (recurse) { + iterateDir(entry, recurse, callback); + } + } else { + callback(entry); + } + } +} + +function isIID(a, iid) { + try { + a.QueryInterface(iid); + return true; + } catch (e) { } + + return false; +} |