netwerk/test/unit/test_gre_resources.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 // test that things that are expected to be in gre-resources are still there
michael@0 2
michael@0 3 var ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService);
michael@0 4
michael@0 5 function wrapInputStream(input)
michael@0 6 {
michael@0 7 var nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream;
michael@0 8 var factory = Components.classes["@mozilla.org/scriptableinputstream;1"];
michael@0 9 var wrapper = factory.createInstance(nsIScriptableInputStream);
michael@0 10 wrapper.init(input);
michael@0 11 return wrapper;
michael@0 12 }
michael@0 13
michael@0 14 function check_file(file) {
michael@0 15 var channel = ios.newChannel("resource://gre-resources/"+file, null, null);
michael@0 16 try {
michael@0 17 let instr = wrapInputStream(channel.open());
michael@0 18 do_check_true(instr.read(1024).length > 0)
michael@0 19 } catch (e) {
michael@0 20 do_throw("Failed to read " + file + " from gre-resources:"+e)
michael@0 21 }
michael@0 22 }
michael@0 23
michael@0 24 function run_test() {
michael@0 25 for each(let file in ["charsetData.properties"])
michael@0 26 check_file(file)
michael@0 27 }

mercurial