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

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

Issue 1211443002: Expose Resource Timing methods and attribute 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
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 25 matching lines...) Expand all
36 .then(function(t) { 36 .then(function(t) {
37 var expectedResources = ['/resources/testharness.js', '/resources/dumm y.txt']; 37 var expectedResources = ['/resources/testharness.js', '/resources/dumm y.txt'];
38 assert_equals(performance.getEntriesByType('resource').length, expecte dResources.length); 38 assert_equals(performance.getEntriesByType('resource').length, expecte dResources.length);
39 for (var i = 0; i < expectedResources.length; i++) { 39 for (var i = 0; i < expectedResources.length; i++) {
40 var entry = performance.getEntriesByType('resource')[i]; 40 var entry = performance.getEntriesByType('resource')[i];
41 assert_true(entry.name.endsWith(expectedResources[i])); 41 assert_true(entry.name.endsWith(expectedResources[i]));
42 assert_equals(entry.workerStart, 0); 42 assert_equals(entry.workerStart, 0);
43 assert_greater_than(entry.startTime, 0); 43 assert_greater_than(entry.startTime, 0);
44 assert_greater_than(entry.responseEnd, entry.startTime); 44 assert_greater_than(entry.responseEnd, entry.startTime);
45 } 45 }
46 }); 46 return new Promise(function(resolve) {
47 performance.onwebkitresourcetimingbufferfull = resolve;
48 performance.webkitSetResourceTimingBufferSize(expectedResources.le ngth);
kinuko 2015/06/24 07:11:26 omg... ok so they're also prefixed on window.
49 });
50 })
51 .then(function() {
52 performance.webkitClearResourceTimings();
53 assert_equals(performance.getEntriesByType('resource').length, 0);
54 })
47 }, 'Resource Timing'); 55 }, 'Resource Timing');
48 56
49 done(); 57 done();
OLDNEW
« no previous file with comments | « no previous file | Source/core/timing/WorkerPerformance.idl » ('j') | Source/core/timing/WorkerPerformance.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698