Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / fetch-request-css-base-url.html
blobd734905650c3139787de2eb737b5d341c5e82d95
1 <!DOCTYPE html>
2 <title>Service Worker: CSS's base URL must be the request URL even when fetched from other URL</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/get-host-info.js"></script>
6 <script src="resources/test-helpers.js?pipe=sub"></script>
7 <script>
8 async_test(function(t) {
9 var SCOPE = 'resources/fetch-request-css-base-url-iframe.html';
10 var SCRIPT = 'resources/fetch-request-css-base-url-worker.js';
11 var worker;
12 var frame;
14 return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
15 .then(function(registration) {
16 worker = registration.installing;
17 return wait_for_state(t, worker, 'activated');
19 .then(function() {
20 return new Promise(function(resolve) {
21 var channel = new MessageChannel();
22 channel.port1.onmessage = t.step_func(function(msg) {
23 if (msg.data.ready) {
24 resolve();
25 return;
27 var result = msg.data;
28 var base = get_host_info()['HTTP_ORIGIN'] + base_path();
29 assert_equals(
30 result.url,
31 base + 'resources/dummy.png',
32 'The base URL while loading the images referred from CSS ' +
33 'must be the request URL of CSS.');
34 assert_equals(
35 result.referrer,
36 base + 'resources/fetch-request-css-base-url-style.css',
37 'While loading the image defined in CSS the referrer must ' +
38 'be the request URL of CSS.');
39 frame.remove();
40 service_worker_unregister_and_done(t, SCOPE);
41 });
42 worker.postMessage(
43 {port: channel.port2}, [channel.port2]);
44 });
46 .then(function() { return with_iframe(SCOPE); })
47 .then(function(f) {
48 frame = f;
50 .catch(unreached_rejection(t));
51 }, 'CSS\'s base URL must be the request URL even when fetched from other URL.');
52 </script>