WebKit Bugzilla
Attachment 368356 Details for
Bug 197329
: Update WPT service-worker resource-timing test to use hosts[alt]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197329-20190426154444.patch (text/plain), 18.61 KB, created by
youenn fablet
on 2019-04-26 15:44:45 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-04-26 15:44:45 PDT
Size:
18.61 KB
patch
obsolete
>Subversion Revision: 244694 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4987ccfdeb24fad97bab9c065d31cd0fa70cebf9..bdeb1d1fd2da0b4a740a7f18d9df782fc36b5a97 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2019-04-26 Youenn Fablet <youenn@apple.com> >+ >+ Update WPT service-worker resource-timing test to use hosts[alt] >+ https://bugs.webkit.org/show_bug.cgi?id=197329 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: >+ > 2019-04-26 Youenn Fablet <youenn@apple.com> > > Use normal loading path for ping loads >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 3396ced2312272ad6a3d6151561c2ef12ad7caf2..ea78fc8c943b09fcc1fdc2ac641250e2f2fb00db 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,19 @@ >+2019-04-26 Youenn Fablet <youenn@apple.com> >+ >+ Update WPT service-worker resource-timing test to use hosts[alt] >+ https://bugs.webkit.org/show_bug.cgi?id=197329 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Set alt server as 127.0.0.1. >+ Use hosts[alt][] instead of domains[www] to trigger a cross origin load. >+ >+ * resources/config.json: >+ * web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt: Removed. >+ * web-platform-tests/service-workers/service-worker/resource-timing.sub.https-expected.txt: Added. >+ * web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html. >+ * web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html: >+ > 2019-04-26 Youenn Fablet <youenn@apple.com> > > Use normal loading path for ping loads >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index f0c42eb1db265d2682e7f69bd14a6558e872a9e3..70247dde48792c4de49fd661fd18765190d66b2b 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -211,7 +211,7 @@ imported/w3c/web-platform-tests/service-workers/service-worker/worker-in-sandbox > > # Newly imported service worker tests that are flaky. > imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect-to-http.https.html [ Pass Failure ] >-imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html [ Pass Failure ] >+imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html [ Pass Failure ] > imported/w3c/web-platform-tests/service-workers/service-worker/worker-client-id.https.html [ Pass Failure ] > imported/w3c/web-platform-tests/xhr/event-timeout-order.htm [ Pass Failure ] > >diff --git a/LayoutTests/imported/w3c/resources/config.json b/LayoutTests/imported/w3c/resources/config.json >index 2debe3bd09d67a5763443dac283a2409c937779f..04b2f828eb8c3c4b2cb96029a90727a4fb17479b 100644 >--- a/LayoutTests/imported/w3c/resources/config.json >+++ b/LayoutTests/imported/w3c/resources/config.json >@@ -1,4 +1,5 @@ > {"browser_host": "localhost", >+ "alternate_hosts": { "alt": "127.0.0.1" }, > "ports":{"http":[8800, 8801], > "https":[9443], > "ws":[49001]}, >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt >deleted file mode 100644 >index 8c00dd205b8cc89179a8b677f45799b0ecf670c4..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt >+++ /dev/null >@@ -1,9 +0,0 @@ >-Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/square.png >-Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/missing.jpg >-Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/square.png >-Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/missing.jpg >- >- >-FAIL Controlled resource loads assert_greater_than: Generated response expected a number greater than 0 but got 0 >-PASS Non-controlled resource loads >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html >deleted file mode 100644 >index 123bbc87c57e857a517ab792717f1cf65b9a3a16..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html >+++ /dev/null >@@ -1,144 +0,0 @@ >-<!DOCTYPE html> >-<script src="/resources/testharness.js"></script> >-<script src="/resources/testharnessreport.js"></script> >-<script src="/common/get-host-info.sub.js"></script> >-<script src="resources/test-helpers.sub.js"></script> >-<script> >-function resourceUrl(path) { >- return get_host_info()['HTTPS_ORIGIN'] + base_path() + path; >-} >- >-function crossOriginUrl(path) { >- return get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + path; >-} >- >-function verify(options) { >- const url = options.mode === 'cross-origin' ? crossOriginUrl(options.resource) >- : resourceUrl(options.resource); >- const entryList = options.performance.getEntriesByName(url); >- if (options.should_no_performance_entry) { >- // The performance timeline may not have an entry for a resource >- // which failed to load. >- assert_equals(entryList.length, 0, options.description); >- return; >- } >- assert_equals(entryList.length, 1, options.description); >- const entry = entryList[0]; >- assert_equals(entry.entryType, 'resource', options.description); >- assert_greater_than(entry.workerStart, 0, options.description); >- assert_greater_than_equal(entry.workerStart, entry.startTime, options.description); >- assert_less_than_equal(entry.workerStart, entry.fetchStart, options.description); >- if (options.mode === 'cross-origin') { >- assert_equals(entry.responseStart, 0, options.description); >- assert_greater_than_equal(entry.responseEnd, entry.fetchStart, options.description); >- } else { >- assert_greater_than_equal(entry.responseStart, entry.fetchStart, options.description); >- assert_greater_than_equal(entry.responseEnd, entry.responseStart, options.description); >- } >- assert_greater_than(entry.responseEnd, entry.fetchStart, options.description); >- assert_greater_than(entry.duration, 0, options.description); >- if (options.resource.indexOf('redirect.py') != -1) { >- assert_less_than_equal(entry.workerStart, entry.redirectStart, >- options.description); >- } else { >- assert_equals(entry.redirectStart, 0, options.description); >- } >-} >- >-promise_test(function(t) { >- const worker_url = 'resources/resource-timing-worker.js'; >- const scope = 'resources/resource-timing-iframe.sub.html'; >- let registration; >- >- return service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- const performance = frame.contentWindow.performance; >- verify({ >- performance: performance, >- resource: 'resources/dummy.js', >- mode: 'same-origin', >- description: 'Generated response', >- }); >- verify({ >- performance: performance, >- resource: 'resources/empty.js', >- mode: 'same-origin', >- description: 'Network fallback', >- }); >- verify({ >- performance: performance, >- resource: 'resources/redirect.py?Redirect=empty.js', >- mode: 'same-origin', >- description: 'Redirect', >- }); >- verify({ >- performance: performance, >- resource: 'resources/square.png', >- mode: 'same-origin', >- description: 'Network fallback image', >- }); >- // Test that worker start is available on cross-origin no-cors >- // subresources. >- verify({ >- performance: performance, >- resource: 'resources/square.png', >- mode: 'cross-origin', >- description: 'Network fallback cross-origin image', >- }); >- >- // Tests for resouces which failed to load. >- verify({ >- performance: performance, >- resource: 'resources/missing.jpg', >- mode: 'same-origin', >- description: 'Network fallback load failure', >- should_no_performance_entry: true, >- }); >- verify({ >- performance: performance, >- resource: 'resources/missing.jpg', >- mode: 'cross-origin', >- description: 'Network fallback cross-origin load failure', >- should_no_performance_entry: true, >- }); >- // Tests for respondWith(fetch()). >- verify({ >- performance: performance, >- resource: 'resources/missing.jpg?SWRespondsWithFetch', >- mode: 'same-origin', >- description: 'Resource in iframe, nonexistent but responded with fetch to another.', >- }); >- verify({ >- performance: performance, >- resource: 'resources/dummy.txt?SWFetched', >- mode: 'same-origin', >- description: 'Resource fetched as response from missing.jpg?SWRespondsWithFetch.', >- should_no_performance_entry: true, >- }); >- // Test for a normal resource that is unaffected by the Service Worker. >- verify({ >- performance: performance, >- resource: 'resources/empty-worker.js', >- mode: 'same-origin', >- description: 'Resource untouched by the Service Worker.', >- }); >- >- frame.remove(); >- return registration.unregister(); >- }); >-}, 'Controlled resource loads'); >- >-test(() => { >- const url = resourceUrl('resources/test-helpers.sub.js'); >- const entry = window.performance.getEntriesByName(url)[0]; >- assert_equals(entry.workerStart, 0, 'Non-controlled'); >-}, 'Non-controlled resource loads'); >- >-</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c41c2b7e53ff7221829c63eb742b875bf9a1662a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https-expected.txt >@@ -0,0 +1,5 @@ >+ >+ >+FAIL Controlled resource loads assert_greater_than: Generated response expected a number greater than 0 but got 0 >+PASS Non-controlled resource loads >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a9f89d300d5d373ab329eb665f1b72262f8447c1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html >@@ -0,0 +1,143 @@ >+<!DOCTYPE html> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<script> >+function resourceUrl(path) { >+ return "https://{{host}}:{{ports[https][0]}}" + base_path() + path; >+} >+ >+function crossOriginUrl(path) { >+ return "https://{{hosts[alt][]}}:{{ports[https][0]}}" + base_path() + path; >+} >+ >+function verify(options) { >+ const url = options.mode === 'cross-origin' ? crossOriginUrl(options.resource) >+ : resourceUrl(options.resource); >+ const entryList = options.performance.getEntriesByName(url); >+ if (options.should_no_performance_entry) { >+ // The performance timeline may not have an entry for a resource >+ // which failed to load. >+ assert_equals(entryList.length, 0, options.description); >+ return; >+ } >+ assert_equals(entryList.length, 1, options.description); >+ const entry = entryList[0]; >+ assert_equals(entry.entryType, 'resource', options.description); >+ assert_greater_than(entry.workerStart, 0, options.description); >+ assert_greater_than_equal(entry.workerStart, entry.startTime, options.description); >+ assert_less_than_equal(entry.workerStart, entry.fetchStart, options.description); >+ if (options.mode === 'cross-origin') { >+ assert_equals(entry.responseStart, 0, options.description); >+ assert_greater_than_equal(entry.responseEnd, entry.fetchStart, options.description); >+ } else { >+ assert_greater_than_equal(entry.responseStart, entry.fetchStart, options.description); >+ assert_greater_than_equal(entry.responseEnd, entry.responseStart, options.description); >+ } >+ assert_greater_than(entry.responseEnd, entry.fetchStart, options.description); >+ assert_greater_than(entry.duration, 0, options.description); >+ if (options.resource.indexOf('redirect.py') != -1) { >+ assert_less_than_equal(entry.workerStart, entry.redirectStart, >+ options.description); >+ } else { >+ assert_equals(entry.redirectStart, 0, options.description); >+ } >+} >+ >+promise_test(function(t) { >+ const worker_url = 'resources/resource-timing-worker.js'; >+ const scope = 'resources/resource-timing-iframe.sub.html'; >+ let registration; >+ >+ return service_worker_unregister_and_register(t, worker_url, scope) >+ .then(function(r) { >+ registration = r; >+ return wait_for_state(t, r.installing, 'activated'); >+ }) >+ .then(function() { >+ return with_iframe(scope); >+ }) >+ .then(function(frame) { >+ const performance = frame.contentWindow.performance; >+ verify({ >+ performance: performance, >+ resource: 'resources/dummy.js', >+ mode: 'same-origin', >+ description: 'Generated response', >+ }); >+ verify({ >+ performance: performance, >+ resource: 'resources/empty.js', >+ mode: 'same-origin', >+ description: 'Network fallback', >+ }); >+ verify({ >+ performance: performance, >+ resource: 'resources/redirect.py?Redirect=empty.js', >+ mode: 'same-origin', >+ description: 'Redirect', >+ }); >+ verify({ >+ performance: performance, >+ resource: 'resources/square.png', >+ mode: 'same-origin', >+ description: 'Network fallback image', >+ }); >+ // Test that worker start is available on cross-origin no-cors >+ // subresources. >+ verify({ >+ performance: performance, >+ resource: 'resources/square.png', >+ mode: 'cross-origin', >+ description: 'Network fallback cross-origin image', >+ }); >+ >+ // Tests for resouces which failed to load. >+ verify({ >+ performance: performance, >+ resource: 'resources/missing.jpg', >+ mode: 'same-origin', >+ description: 'Network fallback load failure', >+ should_no_performance_entry: true, >+ }); >+ verify({ >+ performance: performance, >+ resource: 'resources/missing.jpg', >+ mode: 'cross-origin', >+ description: 'Network fallback cross-origin load failure', >+ should_no_performance_entry: true, >+ }); >+ // Tests for respondWith(fetch()). >+ verify({ >+ performance: performance, >+ resource: 'resources/missing.jpg?SWRespondsWithFetch', >+ mode: 'same-origin', >+ description: 'Resource in iframe, nonexistent but responded with fetch to another.', >+ }); >+ verify({ >+ performance: performance, >+ resource: 'resources/dummy.txt?SWFetched', >+ mode: 'same-origin', >+ description: 'Resource fetched as response from missing.jpg?SWRespondsWithFetch.', >+ should_no_performance_entry: true, >+ }); >+ // Test for a normal resource that is unaffected by the Service Worker. >+ verify({ >+ performance: performance, >+ resource: 'resources/empty-worker.js', >+ mode: 'same-origin', >+ description: 'Resource untouched by the Service Worker.', >+ }); >+ >+ frame.remove(); >+ return registration.unregister(); >+ }); >+}, 'Controlled resource loads'); >+ >+test(() => { >+ const url = resourceUrl('resources/test-helpers.sub.js'); >+ const entry = window.performance.getEntriesByName(url)[0]; >+ assert_equals(entry.workerStart, 0, 'Non-controlled'); >+}, 'Non-controlled resource loads'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html >index 4b626576ab456eae02aa922884b0d4917caeca14..41bc2e77c1b4acb3a57a83f9c9889f4e9c538103 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html >@@ -3,8 +3,8 @@ > <script src="dummy.js"></script> > <script src="redirect.py?Redirect=empty.js"></script> > <img src="square.png"> >-<img src="https://{{domains[www1]}}:{{ports[https][0]}}/service-workers/service-worker/resources/square.png"> >+<img src="https://{{hosts[alt][]}}:{{ports[https][0]}}/service-workers/service-worker/resources/square.png"> > <img src="missing.jpg"> >-<img src="https://{{domains[www1]}}:{{ports[https][0]}}/service-workers/service-worker/resources/missing.jpg"> >+<img src="https://{{hosts[alt][]}}:{{ports[https][0]}}/service-workers/service-worker/resources/missing.jpg"> > <img src='missing.jpg?SWRespondsWithFetch'> > <script src='empty-worker.js'></script>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197329
: 368356