Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | "use strict"; |
michael@0 | 2 | |
michael@0 | 3 | Components.utils.import("resource://gre/modules/osfile.jsm"); |
michael@0 | 4 | |
michael@0 | 5 | function run_test() { |
michael@0 | 6 | run_next_test(); |
michael@0 | 7 | } |
michael@0 | 8 | |
michael@0 | 9 | // Check if Scheduler.queue returned by OS.File.queue is resolved initially. |
michael@0 | 10 | add_task(function* check_init() { |
michael@0 | 11 | yield OS.File.queue; |
michael@0 | 12 | do_print("Function resolved"); |
michael@0 | 13 | }); |
michael@0 | 14 | |
michael@0 | 15 | // Check if Scheduler.queue returned by OS.File.queue is resolved |
michael@0 | 16 | // after an operation is successful. |
michael@0 | 17 | add_task(function* check_success() { |
michael@0 | 18 | do_print("Attempting to open a file correctly"); |
michael@0 | 19 | let openedFile = yield OS.File.open(OS.Path.join(do_get_cwd().path, "test_queue.js")); |
michael@0 | 20 | do_print("File opened correctly"); |
michael@0 | 21 | yield OS.File.queue; |
michael@0 | 22 | do_print("Function resolved"); |
michael@0 | 23 | }); |
michael@0 | 24 | |
michael@0 | 25 | // Check if Scheduler.queue returned by OS.File.queue is resolved |
michael@0 | 26 | // after an operation fails. |
michael@0 | 27 | add_task(function* check_failure() { |
michael@0 | 28 | let exception; |
michael@0 | 29 | try { |
michael@0 | 30 | do_print("Attempting to open a non existing file"); |
michael@0 | 31 | yield OS.File.open(OS.Path.join(".", "Bigfoot")); |
michael@0 | 32 | } catch (err) { |
michael@0 | 33 | exception = err; |
michael@0 | 34 | yield OS.File.queue; |
michael@0 | 35 | } |
michael@0 | 36 | do_check_true(exception!=null); |
michael@0 | 37 | do_print("Function resolved"); |
michael@0 | 38 | }); |