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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html

Issue 2805313003: Upstream service worker `fetch` tests to WPT (Closed)
Patch Set: Move files up a directory Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html
index df2183643854badfa3f4b7fade06b037a6f9f5d5..33bf0416d5856da3f894468d39457ea7bf58a359 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html
@@ -1,72 +1,16 @@
-<script src="/common/get-host-info.sub.js"></script>
-<script src="test-helpers.sub.js?pipe=sub"></script>
<script>
-var image_path = base_path() + 'fetch-access-control.py?PNGIMAGE';
-var host_info = get_host_info();
-var results = '';
-var port = undefined;
+var meta = document.createElement('meta');
+meta.setAttribute('http-equiv', 'Content-Security-Policy');
+meta.setAttribute('content', decodeURIComponent(location.search.substring(1)));
+document.head.appendChild(meta);
-function test1() {
- var img = document.createElement('img');
- document.body.appendChild(img);
- img.onload = function() {
- test2();
- };
- img.onerror = function() {
- results += 'FAIL(1)';
- test2();
- };
- img.src = host_info['HTTPS_ORIGIN'] + image_path;
+function load_image(url) {
+ return new Promise(function(resolve, reject) {
+ var img = document.createElement('img');
+ document.body.appendChild(img);
+ img.onload = resolve;
+ img.onerror = reject;
+ img.src = url;
+ });
}
-
-function test2() {
- var img = document.createElement('img');
- document.body.appendChild(img);
- img.onload = function() {
- results += 'FAIL(2)';
- test3();
- };
- img.onerror = function() {
- test3();
- };
- img.src = host_info['HTTPS_REMOTE_ORIGIN'] + image_path;
-}
-
-function test3() {
- var img = document.createElement('img');
- document.body.appendChild(img);
- img.onload = function() {
- test4();
- };
- img.onerror = function() {
- results += 'FAIL(3)';
- test4();
- };
- img.src = './dummy?url=' +
- encodeURIComponent(host_info['HTTPS_ORIGIN'] + image_path);
-}
-
-function test4() {
- var img = document.createElement('img');
- document.body.appendChild(img);
- img.onload = function() {
- results += 'FAIL(4)';
- finish();
- };
- img.onerror = function() {
- finish();
- };
- img.src = './dummy?mode=no-cors&url=' +
- encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + image_path);
-}
-
-function finish() {
- results += 'finish';
- port.postMessage({results: results});
-}
-
-window.addEventListener('message', function(evt) {
- port = evt.ports[0];
- test1();
- }, false);
</script>

Powered by Google App Engine
This is Rietveld 408576698