michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: Cu.import("resource://services-common/utils.js"); michael@0: michael@0: function run_test() { michael@0: do_check_null(CommonUtils.ensureMillisecondsTimestamp(null)); michael@0: do_check_null(CommonUtils.ensureMillisecondsTimestamp(0)); michael@0: do_check_null(CommonUtils.ensureMillisecondsTimestamp("0")); michael@0: do_check_null(CommonUtils.ensureMillisecondsTimestamp("000")); michael@0: michael@0: do_check_null(CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000)); michael@0: michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(-1); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1.5); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000 + 0.5); }); michael@0: michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("-1"); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1"); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1.5"); }); michael@0: do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("" + (999 * 10000000000 + 0.5)); }); michael@0: }