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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html
index d244e7ba36e747511b6570796511badb999f0959..4b6062b55325488b671f242da3945b88fa0c50e7 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion.html
@@ -5,20 +5,29 @@ var base = document.createElement('base');
base.href = 'resources/';
var link1 = document.createElement('link');
+var promises = [];
link1.setAttribute('rel', 'stylesheet');
link1.setAttribute('href', 'stylesheet.css');
+promises.push(new Promise(function(resolve) {
+ link1.addEventListener('load', function() { resolve(); }, false);
+ }));
var foreignDocument = document.implementation.createHTMLDocument('');
var link2 = foreignDocument.createElement('link');
link2.setAttribute('rel', 'stylesheet');
link2.setAttribute('href', 'stylesheet2.css');
+promises.push(new Promise(function(resolve) {
+ link2.addEventListener('load', function() { resolve(); }, false);
+ }));
document.body.appendChild(base);
document.body.appendChild(link1);
document.body.appendChild(link2);
-if (window.testRunner)
+if (window.testRunner) {
testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
</script>
<p>This tests that links resouce URLs are resolved dynamically when inserted into
the document, and honor the base URL of the document at the time of insertion.</p>
@@ -27,12 +36,14 @@ if (window.testRunner)
<h1 id=test2>I should be red</h1>
<script>
-var test = document.getElementById('test');
-var testColor = window.getComputedStyle(document.getElementById('test'), null).color;
-var test2 = document.getElementById('test2');
-var test2Color = window.getComputedStyle(document.getElementById('test2'), null).color;
-test.innerHTML += testColor === 'rgb(0, 0, 255)' ? '...and I am!!!' : '...but I am not =-(';
-test2.innerHTML += test2Color === 'rgb(255, 0, 0)' ? '...and I am!!!' : '...but I am not =-(';
+Promise.all(promises).then(function() {
+ var test = document.getElementById('test');
+ var testColor = window.getComputedStyle(document.getElementById('test'), null).color;
+ var test2 = document.getElementById('test2');
+ var test2Color = window.getComputedStyle(document.getElementById('test2'), null).color;
+ test.innerHTML += testColor === 'rgb(0, 0, 255)' ? '...and I am!!!' : '...but I am not =-(';
+ test2.innerHTML += test2Color === 'rgb(255, 0, 0)' ? '...and I am!!!' : '...but I am not =-(';
+ testRunner.notifyDone();
+ });
</script>
</body></html>
-
« 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