services/common/tests/unit/test_utils_ensureMillisecondsTimestamp.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 Cu.import("resource://services-common/utils.js");
     6 function run_test() {
     7     do_check_null(CommonUtils.ensureMillisecondsTimestamp(null));
     8     do_check_null(CommonUtils.ensureMillisecondsTimestamp(0));
     9     do_check_null(CommonUtils.ensureMillisecondsTimestamp("0"));
    10     do_check_null(CommonUtils.ensureMillisecondsTimestamp("000"));
    12     do_check_null(CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000));
    14     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(-1); });
    15     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1); });
    16     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1.5); });
    17     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000 + 0.5); });
    19     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("-1"); });
    20     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1"); });
    21     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1.5"); });
    22     do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("" + (999 * 10000000000 + 0.5)); });
    23 }

mercurial