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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/performance-timeline-worker.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 importScripts('worker-testharness.js');
2
3 promise_test(function(test) {
4 var durationMsec = 100;
5
6 return new Promise(function(resolve) {
7 performance.mark('startMark');
8 setTimeout(resolve, durationMsec);
9 }).then(function() {
10 performance.mark('endMark');
11 performance.measure('measure', 'startMark', 'endMark');
12
13 var startMark = performance.getEntriesByName('startMark')[0];
14 var endMark = performance.getEntriesByName('endMark')[0];
15 var measure = performance.getEntriesByType('measure')[0];
16
17 assert_equals(measure.startTime, startMark.startTime);
18 assert_approx_equals(endMark.startTime - startMark.startTime,
19 measure.duration, 0.001);
20 assert_greater_than(measure.duration, durationMsec);
21
22 assert_equals(performance.getEntriesByType('mark').length, 2);
23 assert_equals(performance.getEntriesByType('measure').length, 1);
24 performance.clearMarks('startMark');
25 performance.clearMeasures('measure');
26 assert_equals(performance.getEntriesByType('mark').length, 1);
27 assert_equals(performance.getEntriesByType('measure').length, 0);
kinuko 2015/06/04 08:21:22 Why do we have slightly different tests for Servic
Kunihiko Sakamoto 2015/06/05 03:43:56 See above comment.
28 });
29 }, 'User Timing in Service Worker');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698