blob: 80da0fd22e60751ca32af2795848952aa7447022 [file] [log] [blame]
if (self.importScripts)
importScripts("../../resources/js-test-pre.js");
self.jsTestIsAsync = true;
if (self.window)
description("Basic Interface test for High Resolution Time APIs.");
debug("Performance");
shouldBeDefined(`Performance`);
shouldBeDefined(`Performance.prototype.now`);
shouldThrow(`new Performance()`);
debug("performance");
shouldBeDefined(`performance`);
shouldBeTrue(`performance instanceof Performance`);
shouldBeTrue(`typeof performance.now() === "number"`);
shouldBeTrue(`performance.now() <= performance.now()`);
self.time1 = performance.now();
setTimeout(function() {
self.delta = performance.now() - time1;
// Allow for ~20ms error.
shouldBeTrue(`delta >= 95 && delta <= 120`);
if (self.importScripts)
finishJSTest();
else
testWorker();
}, 100);