Commit 678dd97f authored by Aaron Tagliaboschi's avatar Aaron Tagliaboschi Committed by Commit Bot

Revert "[client-hints] Test client hint availability in service workers"

This reverts commit 09255d96.

Reason for revert: WPT bots on GitHub caught a possibly (probably) flaky test

https://github.com/web-platform-tests/wpt/pull/25845/checks?check_run_id=1187933269

Original change's description:
> [client-hints] Test client hint availability in service workers
>
> Change-Id: Icbb9de8fa340ac216a05a1093a1840c7903ba53c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432187
> Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
> Commit-Queue: Aaron Tagliaboschi <aarontag@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#812131}

TBR=yoavweiss@chromium.org,aarontag@chromium.org

Change-Id: I017b04cf0ba8b47e5fa271254f69816956397aed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441268Reviewed-by: default avatarAaron Tagliaboschi <aarontag@chromium.org>
Commit-Queue: Aaron Tagliaboschi <aarontag@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812138}
parent 26eeb3ee
import sys
def main(request, response):
"""
Simple handler that sets a response header based on which client hint
request headers were received.
"""
response.headers.append(b"Content-Type", b"text/html; charset=UTF-8")
response.headers.append(b"Access-Control-Allow-Origin", b"*")
response.headers.append(b"Access-Control-Allow-Headers", b"*")
response.headers.append(b"Access-Control-Expose-Headers", b"*")
response.headers.append(b"Cache-Control", b"no-store")
result = "FAIL"
if b"device-memory" in request.headers:
result = "PASS"
response.content = result
self.addEventListener('fetch', (event) => {
result="FAIL";
if(event.request.headers.has("device-memory"))
result="PASS";
event.respondWith(new Response(result));
});
self.addEventListener('fetch', (event) => {
event.respondWith(fetch("/client-hints/service-workers/resources/echo-hint-in-html.py"))
});
<!DOCTYPE html>
<title>Simple test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test((t) => {
navigator.serviceWorker.register('resources/intercept-request.js')
.then((e) =>{
var popup_window = window.open("resources/foo.html");
assert_not_equals(popup_window, null, "Popup windows not allowed?");
popup_window.addEventListener('load', (e) => {
t.step(()=>{assert_equals(popup_window.document.body.textContent, "PASS")});
t.done();
});
})
}, "Client Hint/Service Worker interaction: service workers succsefully receives hints from request");
</script>
<!DOCTYPE html>
<title>Simple test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test((t) => {
navigator.serviceWorker.register('resources/new-request.js')
.then((e) =>{
var popup_window = window.open("resources/foo.html");
assert_not_equals(popup_window, null, "Popup windows not allowed?");
popup_window.addEventListener('load', (e) => {
t.step(()=>{assert_equals(popup_window.document.body.textContent, "FAIL")});
t.done();
});
})
}, "Client Hint/Service Worker interaction: service worker does NOT generate client hints in a new request");
</script>
<!DOCTYPE html>
<title>Simple test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test((t) => {
navigator.serviceWorker.register('resources/passthrough-request.js')
.then((e) =>{
var popup_window = window.open("/client-hints/service-workers/resources/echo-hint-in-html.py");
assert_not_equals(popup_window, null, "Popup windows not allowed?");
popup_window.addEventListener('load', (e) => {
t.step(()=>{assert_equals(popup_window.document.body.textContent, "PASS")});
t.done();
});
})
}, "Client Hint/Service Worker interaction: service worker successfully passes hints through to new fetch");
</script>
This is a testharness.js-based test.
FAIL Client Hint/Service Worker interaction: service workers succsefully receives hints from request assert_equals: expected "PASS" but got "FAIL"
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Client Hint/Service Worker interaction: service worker successfully passes hints through to new fetch assert_equals: expected "PASS" but got "FAIL"
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment