no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / xpcom / tests / unit / test_ioutil.js
blobe269b424a2017fdb83936536a7d6cd69cc0f97e0
1 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 const util = Cc["@mozilla.org/io-util;1"].getService(Ci.nsIIOUtil);
8 function run_test() {
9   try {
10     util.inputStreamIsBuffered(null);
11     do_throw("inputStreamIsBuffered should have thrown");
12   } catch (e) {
13     Assert.equal(e.result, Cr.NS_ERROR_INVALID_POINTER);
14   }
16   try {
17     util.outputStreamIsBuffered(null);
18     do_throw("outputStreamIsBuffered should have thrown");
19   } catch (e) {
20     Assert.equal(e.result, Cr.NS_ERROR_INVALID_POINTER);
21   }
23   var s = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
24     Ci.nsIStringInputStream
25   );
26   var body = "This is a test";
27   s.setData(body, body.length);
28   Assert.equal(util.inputStreamIsBuffered(s), true);