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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-css-cross-origin-mime-check.html

Issue 1861243002: Check the mime type of cross-origin CSS fetched via the Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add files Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-css-cross-origin-mime-check-cross.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-css-cross-origin-mime-check.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-css-cross-origin-mime-check.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-css-cross-origin-mime-check.html
new file mode 100644
index 0000000000000000000000000000000000000000..c53f47001f1ec90627f38134d6ad3799cc9912f0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-css-cross-origin-mime-check.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<title>Service Worker: Mime type checking of CSS files fetched via SW.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/get-host-info.js?pipe=sub"></script>
+<script src="resources/test-helpers.js"></script>
+<script>
+
+function getElementColorInFrame(frame, id) {
+ var element = frame.contentDocument.getElementById(id);
+ var style = frame.contentWindow.getComputedStyle(element, '');
+ return style['color'];
+}
+
+promise_test(function(t) {
+ var SCOPE =
+ 'resources/fetch-request-css-cross-origin-mime-check-iframe.html';
+ var SCRIPT =
+ 'resources/fetch-request-css-cross-origin-mime-check-worker.js';
+ var EXPECTED_COLOR = 'rgb(0, 0, 255)';
+
+ return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
+ .then(r => wait_for_state(t, r.installing, 'activated'))
+ .then(_ => with_iframe(SCOPE) )
+ .then(f => {
+ assert_equals(
+ getElementColorInFrame(f, 'crossOriginCss'),
+ EXPECTED_COLOR,
+ 'The color must be overridden by cross origin CSS.');
+ assert_equals(
+ getElementColorInFrame(f, 'crossOriginHtml'),
+ EXPECTED_COLOR,
+ 'The color must not be overridden by cross origin non CSS file.');
+ assert_equals(
+ getElementColorInFrame(f, 'sameOriginCss'),
+ EXPECTED_COLOR,
+ 'The color must be overridden by same origin CSS.');
+ assert_equals(
+ getElementColorInFrame(f, 'sameOriginHtml'),
+ EXPECTED_COLOR,
+ 'The color must be overridden by same origin non CSS file.');
+ assert_equals(
+ getElementColorInFrame(f, 'synthetic'),
+ EXPECTED_COLOR,
+ 'The color must be overridden by synthetic CSS.');
+ f.remove();
+ return service_worker_unregister_and_done(t, SCOPE);
+ });
+ }, 'Mime type checking of CSS files fetched via SW.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-css-cross-origin-mime-check-cross.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698