OLD | NEW |
---|---|
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 16 matching lines...) Expand all Loading... | |
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) { | 31 promise_test(function(test) { |
32 return fetch('../../resources/dummy.txt') | 32 return fetch('../../resources/dummy.txt') |
33 .then(function(resp) { | 33 .then(function(resp) { |
34 return resp.text(); | 34 return resp.text(); |
35 }) | 35 }) |
36 .then(function(t) { | 36 .then(function(t) { |
37 return new Promise(function(resolve, reject) { | |
hiroshige
2015/07/02 08:22:10
This is temporary fix: |performance| entries are u
| |
38 setTimeout(function() { resolve(t); }, 1000); | |
39 }); | |
40 }) | |
41 .then(function(t) { | |
37 var expectedResources = ['/resources/testharness.js', '/resources/dumm y.txt']; | 42 var expectedResources = ['/resources/testharness.js', '/resources/dumm y.txt']; |
38 assert_equals(performance.getEntriesByType('resource').length, expecte dResources.length); | 43 assert_equals(performance.getEntriesByType('resource').length, expecte dResources.length); |
39 for (var i = 0; i < expectedResources.length; i++) { | 44 for (var i = 0; i < expectedResources.length; i++) { |
40 var entry = performance.getEntriesByType('resource')[i]; | 45 var entry = performance.getEntriesByType('resource')[i]; |
41 assert_true(entry.name.endsWith(expectedResources[i])); | 46 assert_true(entry.name.endsWith(expectedResources[i])); |
42 assert_equals(entry.workerStart, 0); | 47 assert_equals(entry.workerStart, 0); |
43 assert_greater_than(entry.startTime, 0); | 48 assert_greater_than(entry.startTime, 0); |
44 assert_greater_than(entry.responseEnd, entry.startTime); | 49 assert_greater_than(entry.responseEnd, entry.startTime); |
45 } | 50 } |
46 return new Promise(function(resolve) { | 51 return new Promise(function(resolve) { |
47 performance.onwebkitresourcetimingbufferfull = resolve; | 52 performance.onwebkitresourcetimingbufferfull = resolve; |
48 performance.webkitSetResourceTimingBufferSize(expectedResources.le ngth); | 53 performance.webkitSetResourceTimingBufferSize(expectedResources.le ngth); |
49 }); | 54 }); |
50 }) | 55 }) |
51 .then(function() { | 56 .then(function() { |
52 performance.webkitClearResourceTimings(); | 57 performance.webkitClearResourceTimings(); |
53 assert_equals(performance.getEntriesByType('resource').length, 0); | 58 assert_equals(performance.getEntriesByType('resource').length, 0); |
54 }) | 59 }) |
55 }, 'Resource Timing'); | 60 }, 'Resource Timing'); |
56 | 61 |
57 done(); | 62 done(); |
OLD | NEW |