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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resource-timing.html

Issue 1152673004: Add workerStart attribute to ResourceTiming (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | LayoutTests/http/tests/serviceworker/resources/resource-timing-iframe.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/get-host-info.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 function resourceUrl(path) {
8 return get_host_info()['HTTP_ORIGIN'] + base_path() + path;
9 }
10
11 function verify(performance, resource, description) {
12 var entry = performance.getEntriesByName(resourceUrl(resource))[0];
13 assert_greater_than(entry.workerStart, 0, description);
14 assert_greater_than_equal(entry.workerStart, entry.startTime, description);
15 assert_less_than_equal(entry.workerStart, entry.fetchStart, description);
16 if (resource.indexOf('redirect.php') != -1) {
17 assert_less_than_equal(entry.workerStart, entry.redirectStart,
18 description);
19 } else {
20 assert_equals(entry.redirectStart, 0, description);
21 }
22 }
23
24 async_test(function(t) {
25 var worker_url = 'resources/resource-timing-worker.js';
26 var scope = 'resources/resource-timing-iframe.html';
27 var registration;
28
29 service_worker_unregister_and_register(t, worker_url, scope)
30 .then(function(r) {
31 registration = r;
32 return wait_for_state(t, r.installing, 'activated');
33 })
34 .then(function() {
35 return with_iframe(scope);
36 })
37 .then(function(frame) {
38 var performance = frame.contentWindow.performance;
39 verify(performance, 'resources/dummy.js', 'Generated response');
40 verify(performance, 'resources/empty.js', 'Network fallback');
41 verify(performance, 'resources/redirect.php?Redirect=empty.js',
42 'Redirect');
43 frame.remove();
44 return registration.unregister();
45 })
46 .then(function() {
47 t.done();
48 })
49 .catch(unreached_rejection(t));
50 }, 'Controlled resource loads');
51
52 test(function() {
53 var url = resourceUrl('resources/test-helpers.js');
54 var entry = window.performance.getEntriesByName(url)[0];
55 assert_equals(entry.workerStart, 0, 'Non-controlled');
56 }, 'Non-controlled resource loads');
57
58 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/resource-timing-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698