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

Side by Side Diff: LayoutTests/http/tests/workers/resources/performance-timeline-worker.js

Issue 1184403003: Offer Resource Timing in workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fix 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
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 importScripts('../../resources/testharness.js'); 1 importScripts('../../resources/testharness.js');
2 2
3 promise_test(function(test) { 3 promise_test(function(test) {
4 var durationMsec = 100; 4 var durationMsec = 100;
5 5
6 return new Promise(function(resolve) { 6 return new Promise(function(resolve) {
7 performance.mark('startMark'); 7 performance.mark('startMark');
8 setTimeout(resolve, durationMsec); 8 setTimeout(resolve, durationMsec);
9 }).then(function() { 9 }).then(function() {
10 performance.mark('endMark'); 10 performance.mark('endMark');
(...skipping 10 matching lines...) Expand all
21 21
22 assert_equals(performance.getEntriesByType('mark').length, 2); 22 assert_equals(performance.getEntriesByType('mark').length, 2);
23 assert_equals(performance.getEntriesByType('measure').length, 1); 23 assert_equals(performance.getEntriesByType('measure').length, 1);
24 performance.clearMarks('startMark'); 24 performance.clearMarks('startMark');
25 performance.clearMeasures('measure'); 25 performance.clearMeasures('measure');
26 assert_equals(performance.getEntriesByType('mark').length, 1); 26 assert_equals(performance.getEntriesByType('mark').length, 1);
27 assert_equals(performance.getEntriesByType('measure').length, 0); 27 assert_equals(performance.getEntriesByType('measure').length, 0);
28 }); 28 });
29 }, 'User Timing'); 29 }, 'User Timing');
30 30
31 promise_test(function(test) {
32 return fetch('../../resources/dummy.txt')
33 .then(function(resp) {
34 return resp.text();
35 })
36 .then(function(t) {
37 var expectedResources = ['/resources/testharness.js', '/resources/dumm y.txt'];
38 assert_equals(performance.getEntriesByType('resource').length, expecte dResources.length);
39 for (var i = 0; i < expectedResources.length; i++) {
40 var entry = performance.getEntriesByType('resource')[i];
41 assert_true(entry.name.endsWith(expectedResources[i]));
42 assert_equals(entry.workerStart, 0);
43 assert_greater_than(entry.startTime, 0);
44 assert_greater_than(entry.responseEnd, entry.startTime);
45 }
46 });
47 }, 'Resource Timing');
48
31 done(); 49 done();
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698