netwerk/test/unit/test_gre_resources.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:90e39e6fd72a
1 // test that things that are expected to be in gre-resources are still there
2
3 var ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService);
4
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 }
13
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 }
23
24 function run_test() {
25 for each(let file in ["charsetData.properties"])
26 check_file(file)
27 }

mercurial