forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser-timing-api.js
33 lines (28 loc) · 1.11 KB
/
user-timing-api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if (self.importScripts)
importScripts("../../resources/js-test-pre.js");
if (self.window)
description("Basic Interface test for user-timing APIs.");
debug("PerformanceMark");
shouldBeDefined("PerformanceMark");
shouldThrow(`new PerformanceMark()`);
debug("");
debug("PerformanceMeasure");
shouldBeDefined("PerformanceMeasure");
shouldThrow(`new PerformanceMeasure()`);
debug("");
debug("Performance extensions");
shouldBeDefined(`Performance.prototype.mark`);
shouldBeDefined(`Performance.prototype.measure`);
shouldBeDefined(`Performance.prototype.clearMarks`);
shouldBeDefined(`Performance.prototype.clearMeasures`);
shouldThrow(`performance.mark()`);
shouldNotThrow(`performance.mark("mark_name")`);
shouldThrow(`performance.measure()`);
shouldNotThrow(`performance.measure("measure_name")`);
shouldThrow(`performance.measure("measure_name", { start: 0, duration: -1 })`);
shouldNotThrow(`performance.clearMarks()`);
shouldNotThrow(`performance.clearMarks("mark_name")`);
shouldNotThrow(`performance.clearMeasures()`);
shouldNotThrow(`performance.clearMeasures("measure_name")`);
if (self.importScripts)
finishJSTest();