OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/get-host-info.js"></script> | 4 <script src="../resources/get-host-info.js"></script> |
5 <script src="resources/test-helpers.js"></script> | 5 <script src="resources/test-helpers.js"></script> |
6 <script> | 6 <script> |
7 function resourceUrl(path) { | 7 function resourceUrl(path) { |
8 return get_host_info()['HTTP_ORIGIN'] + base_path() + path; | 8 return get_host_info()['HTTP_ORIGIN'] + base_path() + path; |
9 } | 9 } |
10 | 10 |
11 function verify(performance, resource, description) { | 11 function verify(performance, resource, description) { |
12 var entry = performance.getEntriesByName(resourceUrl(resource))[0]; | 12 var entry = performance.getEntriesByName(resourceUrl(resource))[0]; |
13 assert_greater_than(entry.workerStart, 0, description); | 13 assert_greater_than(entry.workerStart, 0, description); |
14 assert_greater_than_equal(entry.workerStart, entry.startTime, description); | 14 assert_greater_than_equal(entry.workerStart, entry.startTime, description); |
15 assert_less_than(entry.workerStart, entry.fetchStart, description); | 15 assert_less_than_equal(entry.workerStart, entry.fetchStart, description); |
16 if (resource.indexOf('redirect.php') != -1) | 16 if (resource.indexOf('redirect.php') != -1) { |
17 assert_less_than(entry.workerStart, entry.redirectStart, description); | 17 assert_less_than_equal(entry.workerStart, entry.redirectStart, |
18 else | 18 description); |
| 19 } else { |
19 assert_equals(entry.redirectStart, 0, description); | 20 assert_equals(entry.redirectStart, 0, description); |
| 21 } |
20 } | 22 } |
21 | 23 |
22 async_test(function(t) { | 24 async_test(function(t) { |
23 var worker_url = 'resources/resource-timing-worker.js'; | 25 var worker_url = 'resources/resource-timing-worker.js'; |
24 var scope = 'resources/resource-timing-iframe.html'; | 26 var scope = 'resources/resource-timing-iframe.html'; |
25 var registration; | 27 var registration; |
26 | 28 |
27 service_worker_unregister_and_register(t, worker_url, scope) | 29 service_worker_unregister_and_register(t, worker_url, scope) |
28 .then(function(r) { | 30 .then(function(r) { |
29 registration = r; | 31 registration = r; |
(...skipping 17 matching lines...) Expand all Loading... |
47 .catch(unreached_rejection(t)); | 49 .catch(unreached_rejection(t)); |
48 }, 'Controlled resource loads'); | 50 }, 'Controlled resource loads'); |
49 | 51 |
50 test(function() { | 52 test(function() { |
51 var url = resourceUrl('resources/test-helpers.js'); | 53 var url = resourceUrl('resources/test-helpers.js'); |
52 var entry = window.performance.getEntriesByName(url)[0]; | 54 var entry = window.performance.getEntriesByName(url)[0]; |
53 assert_equals(entry.workerStart, 0, 'Non-controlled'); | 55 assert_equals(entry.workerStart, 0, 'Non-controlled'); |
54 }, 'Non-controlled resource loads'); | 56 }, 'Non-controlled resource loads'); |
55 | 57 |
56 </script> | 58 </script> |
OLD | NEW |