OLD | NEW |
---|---|
(Empty) | |
1 var port = self.port || self; | |
2 | |
3 function assert_equals(actual, expected, description) { | |
4 if (actual == expected) | |
5 port.postMessage('PASS: ' + description); | |
6 else | |
7 port.postMessage('FAIL: ' + description + ': ' + actual + ' != ' + expec ted); | |
8 } | |
9 | |
10 function assert_true(actual, description) { | |
11 if (actual) | |
12 port.postMessage('PASS: ' + description); | |
13 else | |
14 port.postMessage('FAIL: ' + description); | |
15 } | |
kinuko
2015/06/04 08:21:22
Could we also importScript LayoutTests/resources/t
Kunihiko Sakamoto
2015/06/05 03:43:56
Done, and merged into single testharness.js-based
| |
16 | |
17 performance.mark('startMark'); | |
18 setTimeout(timerFunc, 100); | |
19 | |
20 function timerFunc() { | |
21 performance.mark('endMark'); | |
22 performance.measure('measure', 'startMark', 'endMark'); | |
23 | |
24 var startMark = performance.getEntriesByName('startMark')[0]; | |
25 var endMark = performance.getEntriesByName('endMark')[0]; | |
26 var measure = performance.getEntriesByType('measure')[0]; | |
27 | |
28 assert_equals(measure.startTime, startMark.startTime, 'startTime should matc h'); | |
29 assert_true(measure.duration >= 100, 'measure.duration should be no less tha n 100ms'); | |
30 assert_equals(performance.getEntriesByType('mark').length, 2, "getEntriesByT ype('mark')"); | |
31 assert_equals(performance.getEntriesByType('measure').length, 1, "getEntries ByType('measure')"); | |
32 | |
33 port.postMessage('DONE'); | |
34 } | |
OLD | NEW |