michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: Components.utils.import("resource://gre/modules/osfile.jsm"); michael@0: Components.utils.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: do_register_cleanup(function() { michael@0: Services.prefs.setBoolPref("toolkit.osfile.log", false); michael@0: }); michael@0: michael@0: function run_test() { michael@0: Services.prefs.setBoolPref("toolkit.osfile.log", true); michael@0: michael@0: run_next_test(); michael@0: } michael@0: michael@0: /** michael@0: * Test OS.File.getAvailableFreeSpace michael@0: */ michael@0: add_task(function() { michael@0: // Set up profile. We will use profile path to query for available free michael@0: // space. michael@0: do_get_profile(); michael@0: michael@0: let dir = OS.Constants.Path.profileDir; michael@0: michael@0: // Sanity checking for the test michael@0: do_check_true((yield OS.File.exists(dir))); michael@0: michael@0: // Query for available bytes for user michael@0: let availableBytes = yield OS.File.getAvailableFreeSpace(dir); michael@0: michael@0: do_check_true(!!availableBytes); michael@0: do_check_true(availableBytes > 0); michael@0: });