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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html

Issue 1603873004: Dynamically inserted StyleSheet shouldn't block loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update LayoutTests Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/css/css-non-blocking.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <body> 2 <body>
3 <script> 3 <script>
4 var base = document.createElement('base'); 4 var base = document.createElement('base');
5 base.href = 'resources/'; 5 base.href = 'resources/';
6 6
7 var link1 = document.createElement('link'); 7 var link1 = document.createElement('link');
8 var promises = [];
8 link1.setAttribute('rel', 'stylesheet'); 9 link1.setAttribute('rel', 'stylesheet');
9 link1.setAttribute('href', 'stylesheet.css'); 10 link1.setAttribute('href', 'stylesheet.css');
11 promises.push(new Promise(function(resolve) {
12 link1.addEventListener('load', function() { resolve(); }, false);
13 }));
10 14
11 var foreignDocument = document.implementation.createHTMLDocument(''); 15 var foreignDocument = document.implementation.createHTMLDocument('');
12 var link2 = foreignDocument.createElement('link'); 16 var link2 = foreignDocument.createElement('link');
13 link2.setAttribute('rel', 'stylesheet'); 17 link2.setAttribute('rel', 'stylesheet');
14 link2.setAttribute('href', 'stylesheet2.css'); 18 link2.setAttribute('href', 'stylesheet2.css');
19 promises.push(new Promise(function(resolve) {
20 link2.addEventListener('load', function() { resolve(); }, false);
21 }));
15 22
16 document.body.appendChild(base); 23 document.body.appendChild(base);
17 document.body.appendChild(link1); 24 document.body.appendChild(link1);
18 document.body.appendChild(link2); 25 document.body.appendChild(link2);
19 26
20 if (window.testRunner) 27 if (window.testRunner) {
21 testRunner.dumpAsText(); 28 testRunner.dumpAsText();
29 testRunner.waitUntilDone();
30 }
22 </script> 31 </script>
23 <p>This tests that links resouce URLs are resolved dynamically when inserted int o 32 <p>This tests that links resouce URLs are resolved dynamically when inserted int o
24 the document, and honor the base URL of the document at the time of insertion .</p> 33 the document, and honor the base URL of the document at the time of insertion .</p>
25 34
26 <h1 id=test>I should be blue</h1> 35 <h1 id=test>I should be blue</h1>
27 <h1 id=test2>I should be red</h1> 36 <h1 id=test2>I should be red</h1>
28 37
29 <script> 38 <script>
30 var test = document.getElementById('test'); 39 Promise.all(promises).then(function() {
31 var testColor = window.getComputedStyle(document.getElementById('test'), null).c olor; 40 var test = document.getElementById('test');
32 var test2 = document.getElementById('test2'); 41 var testColor = window.getComputedStyle(document.getElementById('test'), nul l).color;
33 var test2Color = window.getComputedStyle(document.getElementById('test2'), null) .color; 42 var test2 = document.getElementById('test2');
34 test.innerHTML += testColor === 'rgb(0, 0, 255)' ? '...and I am!!!' : '...but I am not =-('; 43 var test2Color = window.getComputedStyle(document.getElementById('test2'), n ull).color;
35 test2.innerHTML += test2Color === 'rgb(255, 0, 0)' ? '...and I am!!!' : '...but I am not =-('; 44 test.innerHTML += testColor === 'rgb(0, 0, 255)' ? '...and I am!!!' : '...bu t I am not =-(';
45 test2.innerHTML += test2Color === 'rgb(255, 0, 0)' ? '...and I am!!!' : '... but I am not =-(';
46 testRunner.notifyDone();
47 });
36 </script> 48 </script>
37 </body></html> 49 </body></html>
38
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/css/css-non-blocking.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698