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

Unified Diff: LayoutTests/loader/iframe-sync-loads.html

Issue 210253003: Make data: urls always parse async (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 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 | « LayoutTests/html5lib/resources/runner.js ('k') | LayoutTests/loader/iframe-sync-loads-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/loader/iframe-sync-loads.html
diff --git a/LayoutTests/loader/iframe-sync-loads.html b/LayoutTests/loader/iframe-sync-loads.html
new file mode 100644
index 0000000000000000000000000000000000000000..34b3177ad2892ef773d22998e8a76a6b078b07bd
--- /dev/null
+++ b/LayoutTests/loader/iframe-sync-loads.html
@@ -0,0 +1,59 @@
+<body>
+<pre id="log"></pre>
+<script>
+function log(msg) {
+ document.getElementById("log").textContent += msg + "\n";
+}
+
+function getText(iframe) {
+ return iframe.contentDocument.documentElement.textContent;
+}
+
+var testIndex = 0;
+
+function runTest(name, testFunction) {
+ var iframe = document.createElement('iframe');
+ document.body.appendChild(iframe);
+
+ var expectedText = "foo " + testIndex;
+ iframe.onerror = function() {
+ log(name + ' error ' + getText(iframe));
+ }
+ testFunction(iframe, expectedText);
+ var resultText = getText(iframe);
+ if (resultText == expectedText) {
+ log(' sync : ' + name);
+ iframe.parentNode.removeChild(iframe);
+ nextTest();
+ } else {
+ iframe.onload = function() {
+ log('ASYNC : ' + name);
+ iframe.parentNode.removeChild(iframe);
+ nextTest();
+ }
+ }
+}
+
+var tests = [
+ { name: 'src = javascript:"content"', testFunction: function(iframe, expectedText) { iframe.src = 'javascript: "' + expectedText + '"'} },
+ { name: 'src = data:text/html,content', testFunction: function(iframe, expectedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
+ { name: 'srcdoc = "content"', testFunction: function(iframe, expectedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
+];
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function nextTest() {
+ if (testIndex >= tests.length) {
+ log("done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ var test = tests[testIndex++];
+ runTest(test.name, test.testFunction);
+}
+nextTest();
+</script>
« no previous file with comments | « LayoutTests/html5lib/resources/runner.js ('k') | LayoutTests/loader/iframe-sync-loads-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698