netwerk/test/unit/test_gre_resources.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial