toolkit/components/osfile/tests/xpcshell/test_available_free_space.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:fe8c30b5cdd9
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 "use strict";
6
7 Components.utils.import("resource://gre/modules/osfile.jsm");
8 Components.utils.import("resource://gre/modules/Services.jsm");
9
10 do_register_cleanup(function() {
11 Services.prefs.setBoolPref("toolkit.osfile.log", false);
12 });
13
14 function run_test() {
15 Services.prefs.setBoolPref("toolkit.osfile.log", true);
16
17 run_next_test();
18 }
19
20 /**
21 * Test OS.File.getAvailableFreeSpace
22 */
23 add_task(function() {
24 // Set up profile. We will use profile path to query for available free
25 // space.
26 do_get_profile();
27
28 let dir = OS.Constants.Path.profileDir;
29
30 // Sanity checking for the test
31 do_check_true((yield OS.File.exists(dir)));
32
33 // Query for available bytes for user
34 let availableBytes = yield OS.File.getAvailableFreeSpace(dir);
35
36 do_check_true(!!availableBytes);
37 do_check_true(availableBytes > 0);
38 });

mercurial