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

Unified Diff: LayoutTests/fast/html/imports/import-script.html

Issue 19762002: [HTML Imports] Let script of imported document running. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made a test more robust. Created 7 years, 5 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
Index: LayoutTests/fast/html/imports/import-script.html
diff --git a/LayoutTests/fast/html/imports/import-script.html b/LayoutTests/fast/html/imports/import-script.html
new file mode 100644
index 0000000000000000000000000000000000000000..c5d588c8ea21730cb731f6930d72e80b169d4986
--- /dev/null
+++ b/LayoutTests/fast/html/imports/import-script.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script>
+var loadedScripts = [];
+var numLoaded = 0;
+var labels = ["InlineParser", "InlineDynamic", "ExternalParser", "ExternalDynamic", "ExternalAsync"].sort();
+
+document.notifyLoaded = function(label, doc)
+{
+ givenDocument = doc;
+ shouldBe("givenDocument", "document");
+ shouldBe("givenDocument.currentScript.ownerDocument", "leaf.import");
+
+ loadedScripts.push({ label: label, document: document, script: document.currentScript, order: numLoaded++ });
+ if (labels.length != numLoaded)
+ return;
+
+ loadedLabels = loadedScripts.map(function(o) { return o.label; }).sort();
+ shouldBe("labels", "loadedLabels");
+
+ finishJSTest();
+};
+</script>
+<link id="leaf" rel="import" href="resources/script-leaf.html">
+</head>
+<body>
+<script>
+description("Test that scripts in imported documents are executed");
+window.jsTestIsAsync = true;
+
+var dynamicallyInsertedInlineScript = leaf.import.createElement("script");
+dynamicallyInsertedInlineScript.innerHTML = "document.notifyLoaded('InlineDynamic', document);"
+leaf.import.body.appendChild(dynamicallyInsertedInlineScript);
+
+var dynamicallyInsertedExternalScript = leaf.import.createElement("script");
+dynamicallyInsertedExternalScript.setAttribute("src", "script-leaf-external-dynamic.js");
+leaf.import.body.appendChild(dynamicallyInsertedExternalScript);
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/fast/html/imports/import-master-expected.txt ('k') | LayoutTests/fast/html/imports/import-script-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698