Use dumpJSConsoleLogInStdErr=true webkit-test-runner option for non-imported tests...
[WebKit-https.git] / LayoutTests / http / tests / security / frame-loading-via-document-write.html
index 4745e53..d3d137c 100644 (file)
@@ -1,21 +1,30 @@
+<!-- webkit-test-runner [ dumpJSConsoleLogInStdErr=true ] -->
 <html>
 <head>
-<title/>
+<title></title>
 
 <script language="JavaScript">
 
+const expectedLoadCount = 7;
+let loadCount = 0;
+function finishTestIfLastLoad()
+{
+    if (++loadCount == expectedLoadCount && window.testRunner)
+        testRunner.notifyDone();
+}
+
 function buildFrameset()
 {
-    if (window.layoutTestController) {
-        layoutTestController.waitUntilDone();
-        layoutTestController.dumpAsText();
-        layoutTestController.dumpChildFramesAsText();
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+        testRunner.dumpChildFramesAsText();
     }
 
     var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
-                "<frame src=\"\" name=\"topRow\">"+
-                "<frame src=\"\" name=\"middleRow\">"+
-                "<frame src=\"\" name=\"bottomRow\">"+
+                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"topRow\">"+
+                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"middleRow\">"+
+                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"bottomRow\">"+
                 "</frameset>";
 
     document.open("text/html","replace");
@@ -32,9 +41,9 @@ function buildFrameset()
     frames['topRow'].document.write(outHTML);
     frames['topRow'].document.close();
 
-    var localImageLocation = "file:////tmp/LayoutTests/fast/dom/resources/abe.png";
-    if (window.layoutTestController)
-        localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
+    var localImageLocation = "file:///tmp/LayoutTests/fast/dom/resources/abe.png";
+    if (window.testRunner)
+        localImageLocation = testRunner.pathToLocalResource(localImageLocation);
 
     outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
               "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
@@ -48,7 +57,7 @@ function buildFrameset()
     frames['middleRow'].document.close();
 
     outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
-              "</scr" + "ipt></head><body onLoad=\"lastTest()\"><table><tr><td>"+
+              "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
               "<div id=\"result\"></div>"+
               "<img src=\"/resources/abe.png\" id=\"myImg\">"+
               "</td></tr></table></body></html>";