Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: LayoutTests/fast/workers/resources/worker-performance.js

Issue 1100813004: Offer User Timing in workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698