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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: Mime type checking of CSS files fetched via SW.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/get-host-info.js?pipe=sub"></script>
6 <script src="resources/test-helpers.js"></script>
7 <script>
8
9 function getElementColorInFrame(frame, id) {
10 var element = frame.contentDocument.getElementById(id);
11 var style = frame.contentWindow.getComputedStyle(element, '');
12 return style['color'];
13 }
14
15 promise_test(function(t) {
16 var SCOPE =
17 'resources/fetch-request-css-cross-origin-mime-check-iframe.html';
18 var SCRIPT =
19 'resources/fetch-request-css-cross-origin-mime-check-worker.js';
20 var EXPECTED_COLOR = 'rgb(0, 0, 255)';
21
22 return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
23 .then(r => wait_for_state(t, r.installing, 'activated'))
24 .then(_ => with_iframe(SCOPE) )
25 .then(f => {
26 assert_equals(
27 getElementColorInFrame(f, 'crossOriginCss'),
28 EXPECTED_COLOR,
29 'The color must be overridden by cross origin CSS.');
30 assert_equals(
31 getElementColorInFrame(f, 'crossOriginHtml'),
32 EXPECTED_COLOR,
33 'The color must not be overridden by cross origin non CSS file.');
34 assert_equals(
35 getElementColorInFrame(f, 'sameOriginCss'),
36 EXPECTED_COLOR,
37 'The color must be overridden by same origin CSS.');
38 assert_equals(
39 getElementColorInFrame(f, 'sameOriginHtml'),
40 EXPECTED_COLOR,
41 'The color must be overridden by same origin non CSS file.');
42 assert_equals(
43 getElementColorInFrame(f, 'synthetic'),
44 EXPECTED_COLOR,
45 'The color must be overridden by synthetic CSS.');
46 f.remove();
47 return service_worker_unregister_and_done(t, SCOPE);
48 });
49 }, 'Mime type checking of CSS files fetched via SW.');
50 </script>
OLDNEW
« 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