Changeset 28690 in webkit


Ignore:
Timestamp:
Dec 13, 2007 11:07:39 AM (16 years ago)
Author:
kmccullough@apple.com
Message:

WebKitTools:

Reviewed by Alice and Sam.

  • <rdar://5621435> Need a way to specify local resources (being loaded from HTTP tests) on Windows.
  • Implemented pathToLocalResource which exposes the functionality of converting a given unix path to the correct location on Windows.
  • DumpRenderTree/LayoutTestController.cpp: (pathToLocalResourceCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::pathToLocalResource):
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::pathToLocalResource):

LayoutTests:

Reviewed by Alice and Sam.

  • <rdar://5621435> Need a way to specify local resources (being loaded from HTTP tests) on Windows.
  • Updated the following tests to use the new layoutTestController function, pathToLocalResource to get a Windows viable path (when on Windows) to the local resources they are attempting to access.
  • Also clarified and updated some results.
  • fast/dom/frame-loading-via-document-write.html:
  • fast/loader/local-CSS-from-local-expected.txt:
  • fast/loader/local-CSS-from-local.html:
  • fast/loader/local-JavaScript-from-local-expected.txt:
  • fast/loader/local-JavaScript-from-local.html:
  • fast/loader/local-iFrame-source-from-local-expected.txt:
  • fast/loader/local-iFrame-source-from-local.html:
  • fast/loader/local-image-from-local-expected.txt:
  • fast/loader/local-image-from-local.html:
  • http/tests/security/frame-loading-via-document-write.html:
  • http/tests/security/local-CSS-from-remote-expected.txt:
  • http/tests/security/local-CSS-from-remote.html:
  • http/tests/security/local-JavaScript-from-remote-expected.txt:
  • http/tests/security/local-JavaScript-from-remote.html:
  • http/tests/security/local-iFrame-from-remote-expected.txt:
  • http/tests/security/local-iFrame-from-remote.html:
  • http/tests/security/local-image-from-remote-expected.txt:
  • http/tests/security/local-image-from-remote.html:
  • http/tests/security/local-user-CSS-from-remote.html:
  • platform/mac/fast/dom/frame-loading-via-document-write-expected.txt:
  • platform/win/Skipped:
  • platform/win/http: Added.
  • platform/win/http/tests: Added.
  • platform/win/http/tests/security: Added.
  • platform/win/http/tests/security/frame-loading-via-document-write-expected.txt: Added.
Location:
trunk
Files:
4 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r28688 r28690  
     12007-12-13  Kevin McCullough  <kmccullough@apple.com>
     2
     3        Reviewed by Alice and Sam.
     4
     5        - <rdar://5621435> Need a way to specify local resources (being loaded
     6        from HTTP tests) on Windows.
     7        - Updated the following tests to use the new layoutTestController
     8        function, pathToLocalResource to get a Windows viable path (when on
     9        Windows) to the local resources they are attempting to access.
     10        - Also clarified and updated some results.
     11
     12        * fast/dom/frame-loading-via-document-write.html:
     13        * fast/loader/local-CSS-from-local-expected.txt:
     14        * fast/loader/local-CSS-from-local.html:
     15        * fast/loader/local-JavaScript-from-local-expected.txt:
     16        * fast/loader/local-JavaScript-from-local.html:
     17        * fast/loader/local-iFrame-source-from-local-expected.txt:
     18        * fast/loader/local-iFrame-source-from-local.html:
     19        * fast/loader/local-image-from-local-expected.txt:
     20        * fast/loader/local-image-from-local.html:
     21        * http/tests/security/frame-loading-via-document-write.html:
     22        * http/tests/security/local-CSS-from-remote-expected.txt:
     23        * http/tests/security/local-CSS-from-remote.html:
     24        * http/tests/security/local-JavaScript-from-remote-expected.txt:
     25        * http/tests/security/local-JavaScript-from-remote.html:
     26        * http/tests/security/local-iFrame-from-remote-expected.txt:
     27        * http/tests/security/local-iFrame-from-remote.html:
     28        * http/tests/security/local-image-from-remote-expected.txt:
     29        * http/tests/security/local-image-from-remote.html:
     30        * http/tests/security/local-user-CSS-from-remote.html:
     31        * platform/mac/fast/dom/frame-loading-via-document-write-expected.txt:
     32        * platform/win/Skipped:
     33        * platform/win/http: Added.
     34        * platform/win/http/tests: Added.
     35        * platform/win/http/tests/security: Added.
     36        * platform/win/http/tests/security/frame-loading-via-document-write-expected.txt: Added.
     37
    1382007-12-13  Dan Bernstein  <mitz@apple.com>
    239
  • trunk/LayoutTests/fast/dom/frame-loading-via-document-write.html

    r21784 r28690  
    77function buildFrameset()
    88{
    9     if (window.layoutTestController)
     9    if (window.layoutTestController) {
    1010        layoutTestController.waitUntilDone();
     11        layoutTestController.dumpAsText();
     12        layoutTestController.dumpChildFramesAsText();
     13    }
    1114
    1215    var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
     
    3033    frames['topRow'].document.close();
    3134
     35    var localImageLocation = "file:////tmp/LayoutTests/fast/dom/resources/abe.png";
     36    if (window.layoutTestController)
     37        localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
     38
    3239    outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
    3340              "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
    3441              "<div id=\"result\"></div>"+
    35               "<img src=\"file:////tmp/LayoutTests/fast/dom/resources/abe.png\" id=\"myImg\">"+
     42              "<img src=\"" + localImageLocation + "\" id=\"myImg\">"+
    3643              "</td></tr></table></body></html>";
    3744
  • trunk/LayoutTests/fast/loader/local-CSS-from-local-expected.txt

    r21687 r28690  
    11This test is to see if a local file can include a local CSS style.
     2Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
     3
    24If the background is yellow then the CSS was loaded.
    35
    4 Test Passed.
     6Test Passed. Local CSS remotely loaded
  • trunk/LayoutTests/fast/loader/local-CSS-from-local.html

    r19952 r28690  
    11<html>
    22<head>
    3     <link rel="stylesheet" type="text/css" href="file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css" />
    43    <script>
    5         if (window.layoutTestController) {
    6             layoutTestController.dumpAsText();
     4        function test() {
     5            if (window.layoutTestController) {
     6                layoutTestController.dumpAsText();
     7                layoutTestController.waitUntilDone();
     8            }
     9
     10            var localStyleSheetLocation = "file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css";
     11            if (window.layoutTestController)
     12                localStyleSheetLocation = layoutTestController.pathToLocalResource(localStyleSheetLocation);
     13
     14            var localLinkElement = document.createElement("link");
     15            localLinkElement.setAttribute("type", "text/css");
     16            localLinkElement.setAttribute("rel", "stylesheet");
     17            localLinkElement.setAttribute("href", localStyleSheetLocation);
     18
     19            document.documentElement.firstChild.appendChild(localLinkElement);
     20
     21            // Unfortunately link tags do not have load events, so we cannot simply make a load handler.
     22            window.setTimeout(backgroundCheck, 1);
     23            window.setTimeout(function() {
     24                if (window.layoutTestController)
     25                    layoutTestController.notifyDone();
     26            }, 5000);
    727        }
    8    
     28
    929        function backgroundCheck() {
    1030            var result = document.getElementById("result");
     
    1333            var bgColor = style.getPropertyValue("background-color");
    1434            if (bgColor[4] == 2) {
    15                 result.innerHTML = "Test Passed.";
     35                result.innerHTML = "Test Passed. Local CSS remotely loaded";
     36                if (window.layoutTestController)
     37                    layoutTestController.notifyDone();
    1638            } else {
    1739                result.innerHTML = "Test Failed: Local CSS not remotely loaded.";
     40                window.setTimeout(backgroundCheck, 1);
    1841            }
    1942        }
     43
    2044    </script>
    2145</head>
    22 <body id="myBody" onload="backgroundCheck()">
     46<body id="myBody" onload="test()">
    2347    <div id="div0">
    2448        This test is to see if a local file can include a local CSS style.
    2549        <br/>
     50        Currently this test cannot be run manually on Windows because we do not have
     51        a function like pathToLocalResource() outside of DRT.
     52        <br/>
     53        <br/>
    2654        If the background is yellow then the CSS was loaded.
    2755    </div>
    28     </br>
     56    <br/>
    2957    <div id="result">
    3058        Test not run correctly.
  • trunk/LayoutTests/fast/loader/local-JavaScript-from-local-expected.txt

    r21687 r28690  
    1 This test is to see if a local file can run a local script.
     1This test is to see if a local file can run a local script.
     2Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    23
    3 Test Passed.
     4Test Passed. Local script loaded and run.
  • trunk/LayoutTests/fast/loader/local-JavaScript-from-local.html

    r21592 r28690  
    11<html>
    22<head>
    3         <script>
    4             var secretness = 0;
    5         </script>
    6         <script src="file:///tmp/LayoutTests/http/tests/security/resources/localScript.js"></script>
    7         <script>
    8             function test() {
    9                 if (window.layoutTestController)
    10                     layoutTestController.dumpAsText();
     3<script>
     4    var secretness = 0;
    115
    12                     var tag = document.getElementById("result");
    13                     if (secretness == 13)
    14                         tag.innerHTML = "Test Passed.";
    15                     else
    16                         tag.innerHTML = "Test Failed: Local script not run by local file.";
    17             }
    18         </script>
     6    function test() {
     7        if (window.layoutTestController)
     8            layoutTestController.dumpAsText();
     9
     10        var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js";
     11        if (window.layoutTestController)
     12            localScriptLocation = layoutTestController.pathToLocalResource(localScriptLocation);
     13
     14        var localScriptElement = document.createElement("script");
     15        localScriptElement.setAttribute("src", localScriptLocation);
     16        localScriptElement.addEventListener("load", function() {
     17            var tag = document.getElementById("result");
     18            if (secretness == 13)
     19                tag.innerHTML = "Test Passed. Local script loaded and run.";
     20            else
     21                tag.innerHTML = "Test Failed. Local script loaded, but not successfully run.";
     22        });
     23        localScriptElement.addEventListener("error", function() {
     24            var tag = document.getElementById("result");
     25            tag.innerHTML = "Test Failed: Local script not loaded.";
     26        });
     27
     28        document.body.appendChild(localScriptElement)
     29    }
     30</script>
    1931</head>
    2032<body onload="test()">
    2133    <div id="div0">
    2234        This test is to see if a local file can run a local script.
     35        <br/>
     36        Currently this test cannot be run manually on Windows because we do not have
     37        a function like pathToLocalResource() outside of DRT.
     38        <br/>
    2339    </div>
    2440    </br>
  • trunk/LayoutTests/fast/loader/local-iFrame-source-from-local-expected.txt

    r19952 r28690  
    1 This test is to see if a local file can include a local page in an iFrame.
     1This test is to see if a local file can include a local page in an iFrame.
     2Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    23
    3 Test Passed.
     4Test Passed. Local page loaded locally into iFrame.
    45
  • trunk/LayoutTests/fast/loader/local-iFrame-source-from-local.html

    r19952 r28690  
    22<head>
    33    <script>
    4         if (window.layoutTestController) {
    5             layoutTestController.dumpAsText();
    6         }
    7    
    84        function iFrameTest() {
    95            if (window.layoutTestController)
    106                layoutTestController.dumpAsText();
    117
     8            var localPageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localPage.html";
     9            if (window.layoutTestController)
     10                localPageLocation = layoutTestController.pathToLocalResource(localPageLocation);
     11
     12            var localIframeElement = document.createElement("iFrame");
     13            localIframeElement.setAttribute("id", "myFrame");
     14            localIframeElement.setAttribute("src", localPageLocation);
     15
     16            document.body.appendChild(localIframeElement);
     17   
    1218            var result = document.getElementById("result");
    1319
    1420            var myFrameDocument = document.getElementById("myFrame").contentDocument;
    15             if (myFrameDocument) {
    16                 result.innerHTML = "Test Passed.";
    17             } else {
     21            if (myFrameDocument)
     22                result.innerHTML = "Test Passed. Local page loaded locally into iFrame.";
     23            else
    1824                result.innerHTML = "Test Failed: Local page not locally loaded into iFrame.";
    19             }
    2025        }
    2126    </script>
    2227</head>
    23 <body>
     28<body onload="iFrameTest()">
    2429    <div id="div0">
    2530        This test is to see if a local file can include a local page in an iFrame.
     31        <br/>
     32        Currently this test cannot be run manually on Windows because we do not have
     33        a function like pathToLocalResource() outside of DRT.
     34        <br/>
    2635    </div>
    2736    </br>
     
    2938        Test not run correctly.
    3039    </div>
    31     <iFrame id="myFrame" onload="iFrameTest()" src="file:///tmp/LayoutTests/http/tests/security/resources/localPage.html" />
    3240</body>
    3341</html>
  • trunk/LayoutTests/fast/loader/local-image-from-local-expected.txt

    r19952 r28690  
    1 This test is to see if a remote file can include a local image.
     1This test is to see if a remote file can include a local image.
     2Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    23
    3 Test Passed.
     4Test Passed. Local image loaded.
    45
    56
  • trunk/LayoutTests/fast/loader/local-image-from-local.html

    r19952 r28690  
    44        if (window.layoutTestController)
    55            layoutTestController.dumpAsText();
     6
     7        var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
     8        if (window.layoutTestController)
     9            localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
     10
     11        var localImageElement = document.createElement("img");
     12        localImageElement.setAttribute("id", "myImg");
     13        localImageElement.setAttribute("src", localImageLocation);
     14        localImageElement.setAttribute("onError", "imgError()");
     15        localImageElement.setAttribute("onLoad", "imgLoad()");
    616
    717        function imgError() {
     
    1222        function imgLoad() {
    1323            var result = document.getElementById("result");
    14             result.innerHTML = "Test Passed.";
     24            result.innerHTML = "Test Passed. Local image loaded.";
    1525        }
    1626    </script>
    1727</head>
    18 <body>
     28<body onload="document.body.appendChild(localImageElement)">
    1929    <div id="div0">
    2030        This test is to see if a remote file can include a local image.
     31        <br/>
     32        Currently this test cannot be run manually on Windows because we do not have
     33        a function like pathToLocalResource() outside of DRT.
     34        <br/>
    2135    </div>
    2236    </br>
     
    2539    </div>
    2640    </br>
    27     <img id="myImg" src="file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg" onError="imgError()" onLoad="imgLoad()"/>
    2841</body>
    2942</html>
  • trunk/LayoutTests/http/tests/security/frame-loading-via-document-write.html

    r21784 r28690  
    11<html>
    22<head>
     3<title/>
    34
    45<script language="JavaScript">
     
    67function buildFrameset()
    78{
    8     if (window.layoutTestController)
     9    if (window.layoutTestController) {
    910        layoutTestController.waitUntilDone();
     11        layoutTestController.dumpAsText();
     12        layoutTestController.dumpChildFramesAsText();
     13    }
    1014
    1115    var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
     
    2630    frames['topRow'].document.open("text/html","replace");
    2731    frames['topRow'].document.charset=document.charset;
    28     frames['topRow'].document. write(outHTML);
     32    frames['topRow'].document.write(outHTML);
    2933    frames['topRow'].document.close();
     34
     35    var localImageLocation = "file:////tmp/LayoutTests/fast/dom/resources/abe.png";
     36    if (window.layoutTestController)
     37        localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
    3038
    3139    outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
    3240              "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
    3341              "<div id=\"result\"></div>"+
    34               "<img src=\"file:////tmp/LayoutTests/fast/dom/resources/abe.png\" id=\"myImg\">"+
     42              "<img src=\"" + localImageLocation + "\" id=\"myImg\">"+
    3543              "</td></tr></table></body></html>";
    3644
    3745    frames['middleRow'].document.open("text/html","replace");
    3846    frames['middleRow'].document.charset=document.charset;
    39     frames['middleRow'].document. write(outHTML);
     47    frames['middleRow'].document.write(outHTML);
    4048    frames['middleRow'].document.close();
    4149
     
    4856    frames['bottomRow'].document.open("text/html","replace");
    4957    frames['bottomRow'].document.charset=document.charset;
    50     frames['bottomRow'].document. write(outHTML);
     58    frames['bottomRow'].document.write(outHTML);
    5159    frames['bottomRow'].document.close();
    5260}
  • trunk/LayoutTests/http/tests/security/local-CSS-from-remote-expected.txt

    r21687 r28690  
    1 CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css
     1CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/cssStyle.css
    22This test is to see if a remote file can include a local CSS style.
     3Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
     4
    35If the background is yellow then the CSS was loaded.
    46
    5 Test Passed.
     7Test Passed: Local CSS not remotely loaded.
  • trunk/LayoutTests/http/tests/security/local-CSS-from-remote.html

    r19952 r28690  
    11<html>
    22<head>
    3     <link rel="stylesheet" type="text/css" href="file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css" />
    4     <script>
     3<script>
     4    function test() {
    55        if (window.layoutTestController) {
    66            layoutTestController.dumpAsText();
     7            layoutTestController.waitUntilDone();
    78        }
    89
    9         function backgroundCheck() {
    10             var result = document.getElementById("result");
    11             var myBody = document.getElementById("myBody");
    12             var style = document.defaultView.getComputedStyle(myBody, null);
    13             var bgColor = style.getPropertyValue("background-color");
    14             if (bgColor[4] == 2) {
    15                 result.innerHTML = "Test Failed: Local CSS remotely loaded.";
    16             } else {
    17                 result.innerHTML = "Test Passed.";
    18             }
     10        var localStyleSheetLocation = "file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css";
     11        if (window.layoutTestController)
     12            localStyleSheetLocation = layoutTestController.pathToLocalResource(localStyleSheetLocation);
     13
     14        var localLinkElement = document.createElement("link");
     15        localLinkElement.setAttribute("type", "text/css");
     16        localLinkElement.setAttribute("rel", "stylesheet");
     17        localLinkElement.setAttribute("href", localStyleSheetLocation);
     18
     19        document.documentElement.firstChild.appendChild(localLinkElement);
     20
     21        // Unfortunately link tags do not have load events, so we cannot simply make a load handler.
     22        window.setTimeout(backgroundCheck, 1);
     23        window.setTimeout(function() {
     24            if (window.layoutTestController)
     25                layoutTestController.notifyDone();
     26        }, 5000);
     27    }
     28
     29    function backgroundCheck() {
     30        var result = document.getElementById("result");
     31        var myBody = document.getElementById("myBody");
     32        var style = document.defaultView.getComputedStyle(myBody, null);
     33        var bgColor = style.getPropertyValue("background-color");
     34        if (bgColor[4] == 2) {
     35            result.innerHTML = "Test Failed: Local CSS remotely loaded.";
     36            window.setTimeout(backgroundCheck, 1);
     37        } else {
     38            result.innerHTML = "Test Passed: Local CSS not remotely loaded.";
     39            if (window.layoutTestController)
     40                layoutTestController.notifyDone();
    1941        }
    20     </script>
     42    }
     43</script>
    2144</head>
    22 <body id="myBody" onload="backgroundCheck()">
     45<body id="myBody" onload="test()">
    2346    <div id="other">
    2447        This test is to see if a remote file can include a local CSS style.
     48        <br/>
     49        Currently this test cannot be run manually on Windows because we do not have
     50        a function like pathToLocalResource() outside of DRT.
     51        <br/>
    2552        <br/>
    2653        If the background is yellow then the CSS was loaded.
  • trunk/LayoutTests/http/tests/security/local-JavaScript-from-remote-expected.txt

    r21687 r28690  
    1 CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/localScript.js
    2 This test is to see if a remote file can run a local script.
     1CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/localScript.js
     2This test is to see if a remote file can run a local script.
     3Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    34
    4 Test Passed.
     5Test Passed: Local script not loaded.
  • trunk/LayoutTests/http/tests/security/local-JavaScript-from-remote.html

    r21595 r28690  
    11<html>
    22<head>
    3         <script>
    4             var secretness = 0;
    5         </script>
    6         <script src="file:///tmp/LayoutTests/http/tests/security/resources/localScript.js"></script>
    7         <script>
    8             function test() {
    9                 if (window.layoutTestController)
    10                     layoutTestController.dumpAsText();
     3    <script>
     4        var secretness = 0;
    115
     6        function test() {
     7            if (window.layoutTestController)
     8                layoutTestController.dumpAsText();
     9
     10            var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js";
     11            if (window.layoutTestController)
     12                localScriptLocation = layoutTestController.pathToLocalResource(localScriptLocation);
     13
     14            var localScriptElement = document.createElement("script");
     15            localScriptElement.setAttribute("src", localScriptLocation);
     16            localScriptElement.addEventListener("load", function() {
    1217                var tag = document.getElementById("result");
    1318                if (secretness == 13)
    14                     tag.innerHTML = "Test Failed: Local script run remotely.";
     19                    tag.innerHTML = "Test Failed. Local script loaded and run.";
    1520                else
    16                     tag.innerHTML = "Test Passed.";
    17             }
    18         </script>
     21                    tag.innerHTML = "Test Failed. Local script loaded, but not successfully run.";
     22            });
     23
     24            localScriptElement.addEventListener("error", function() {
     25                var tag = document.getElementById("result");
     26                tag.innerHTML = "Test Passed: Local script not loaded.";
     27            });
     28
     29            document.body.appendChild(localScriptElement)
     30        }
     31    </script>
    1932</head>
    2033<body onload="test()">
    2134    <div id="div0">
    2235        This test is to see if a remote file can run a local script.
     36        <br/>
     37        Currently this test cannot be run manually on Windows because we do not have
     38        a function like pathToLocalResource() outside of DRT.
     39        <br/>
    2340    </div>
    24     </br>
     41    <br>
    2542    <div id="result">
    2643        Test not run correctly.
  • trunk/LayoutTests/http/tests/security/local-iFrame-from-remote-expected.txt

    r20740 r28690  
    1 CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/localPage.html
    2 This test is to see if a remote file can include a local page in an iFrame.
     1CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/localPage.html
     2This test is to see if a remote file can include a local page in an iFrame.
     3Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    34
    4 Test Passed.
     5Test Passed. Local page not remotely loaded into iFrame.
    56
  • trunk/LayoutTests/http/tests/security/local-iFrame-from-remote.html

    r19952 r28690  
    22<head>
    33    <script>
    4         if (window.layoutTestController) {
     4        if (window.layoutTestController)
    55            layoutTestController.dumpAsText();
    6         }
    7    
     6
     7        var localPageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localPage.html";
     8        if (window.layoutTestController)
     9            localPageLocation = layoutTestController.pathToLocalResource(localPageLocation);
     10
     11        var localIframeElement = document.createElement("iFrame");
     12        localIframeElement.setAttribute("id", "myFrame");
     13        localIframeElement.setAttribute("src", localPageLocation);
     14
    815        function iFrameTest() {
     16            document.body.appendChild(localIframeElement);
     17
    918            var result = document.getElementById("result");
    10 
    1119            var myFrameDocument = document.getElementById("myFrame").contentDocument;
    12             if (myFrameDocument) {
     20            if (myFrameDocument)
    1321                result.innerHTML = "Test Failed: Local page remotely loaded into iFrame.";
    14             } else {
    15                 result.innerHTML = "Test Passed.";
    16             }
    17            
     22            else
     23                result.innerHTML = "Test Passed. Local page not remotely loaded into iFrame.";
    1824        }
    1925    </script>
     
    2228    <div id="div0">
    2329        This test is to see if a remote file can include a local page in an iFrame.
     30        <br/>
     31        Currently this test cannot be run manually on Windows because we do not have
     32        a function like pathToLocalResource() outside of DRT.
     33        <br/>
    2434    </div>
    2535    </br>
     
    2737        Test not run correctly.
    2838    </div>
    29     <iFrame id="myFrame" src="file:///tmp/LayoutTests/http/tests/security/resources/localPage.html" />
    3039</body>
    3140</html>
  • trunk/LayoutTests/http/tests/security/local-image-from-remote-expected.txt

    r20740 r28690  
    1 CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg
    2 This test is to see if a remote file can include a local image.
     1CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/compass.jpg
     2This test is to see if a remote file can include a local image.
     3Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
    34
    4 Test Passed.
     5Test Passed. Local image not loaded remotely.
    56
    67
  • trunk/LayoutTests/http/tests/security/local-image-from-remote.html

    r19952 r28690  
    11<html>
    22<head>
    3     <script>       
    4         if (window.layoutTestController)
    5             layoutTestController.dumpAsText();
    6        
    7         function imageTest() {
    8             var result = document.getElementById("result");
    93
    10             var myImg = document.getElementById("myImg");
    11             if (myImg.height == 0 && myImg.width == 0) {
    12                 result.innerHTML = "Test Passed.";
    13             } else {
    14                 result.innerHTML = "Test Failed: Local image loaded remotely.";
    15             }
    16            
    17         }
    18     </script>
     4<script>
     5    if (window.layoutTestController)
     6        layoutTestController.dumpAsText();
     7
     8    var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
     9    if (window.layoutTestController)
     10        localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
     11
     12    var localImageElement = document.createElement("img");
     13    localImageElement.setAttribute("id", "myImg");
     14    localImageElement.setAttribute("src", localImageLocation);
     15
     16    function imageTest() {
     17        document.body.appendChild(localImageElement);
     18
     19        var result = document.getElementById("result");
     20        var myImg = document.getElementById("myImg");
     21
     22        if (myImg.height == 0 && myImg.width == 0)
     23            result.innerHTML = "Test Passed. Local image not loaded remotely.";
     24        else
     25            result.innerHTML = "Test Failed: Local image loaded remotely.";
     26    }
     27</script>
     28
    1929</head>
    2030<body onLoad="imageTest()">
    2131    <div id="div0">
    2232        This test is to see if a remote file can include a local image.
     33        <br/>
     34        Currently this test cannot be run manually on Windows because we do not have
     35        a function like pathToLocalResource() outside of DRT.
     36        <br/>
    2337    </div>
    2438    </br>
     
    2741    </div>
    2842    </br>
    29     <img id="myImg" src="file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg" />
    3043</body>
    3144</html>
  • trunk/LayoutTests/http/tests/security/local-user-CSS-from-remote.html

    r19977 r28690  
    11<html>
    2     <head>
    3         <title>User Stylesheet Test</title>
    4         <script type="text/javascript">
    5             if (window.layoutTestController) {
    6                 layoutTestController.dumpAsText();
     2<head>
     3<title>User Stylesheet Test</title>
     4<script type="text/javascript">
     5    if (window.layoutTestController) {
     6        layoutTestController.dumpAsText();
    77
    8                 // This won't work outside of DRT!
    9                 if (window.location.hash == '') {
    10                     layoutTestController.waitUntilDone();
    11                     layoutTestController.setUserStyleSheetLocation("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
    12                     layoutTestController.setUserStyleSheetEnabled(true);
    13                     location += '?#done';
    14                 }
    15             }
     8        // This won't work outside of DRT!
     9        if (window.location.hash == '') {
     10            layoutTestController.waitUntilDone();
     11            layoutTestController.setUserStyleSheetLocation("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
     12            layoutTestController.setUserStyleSheetEnabled(true);
     13            location += '?#done';
     14        }
     15    }
    1616
    17             function backgroundCheck() {
    18                 var result = document.getElementById("result");
    19                 var myBody = document.getElementById("myBody");
    20                
    21                 var style = document.defaultView.getComputedStyle(myBody, null);
    22                 var bgColor = style.getPropertyValue("background-color");
    23                 if (bgColor[4] == 2) {
    24                     result.innerHTML = "Test Passed: Local user stylesheet loaded.";
    25                 } else {
    26                     result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
    27                 }
     17    function backgroundCheck() {
     18        var result = document.getElementById("result");
     19        var myBody = document.getElementById("myBody");
     20       
     21        var style = document.defaultView.getComputedStyle(myBody, null);
     22        var bgColor = style.getPropertyValue("background-color");
     23        if (bgColor[4] == 2) {
     24            result.innerHTML = "Test Passed: Local user stylesheet loaded.";
     25        } else {
     26            result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
     27        }
    2828
    29                 if (window.layoutTestController) {
    30                     layoutTestController.setUserStyleSheetEnabled(false);
    31                     layoutTestController.notifyDone();
    32                 }
    33 
    34             }
    35         </script>
    36     </head>
    37     <body id="myBody" onload="backgroundCheck()">
    38         <div id="other">
    39             This test is to see if a remote file can include a local user stylesheet.
    40             <br />
    41             To run this test manually you must set your user style sheet in your Safari preferences
    42             to LayoutTests/http/tests/security/resources/cssStyle.css
    43             <br/>
    44             If the background is yellow then the user stylesheet was loaded.
    45         </div>
    46         </br>
    47         <div id="result">
    48             Test not run correctly.
    49         </div>
    50     </body>
     29        if (window.layoutTestController) {
     30            layoutTestController.setUserStyleSheetEnabled(false);
     31            layoutTestController.notifyDone();
     32        }
     33    }
     34</script>
     35</head>
     36<body id="myBody" onload="backgroundCheck()">
     37    <div id="other">
     38        This test is to see if a remote file can include a local user stylesheet.
     39        <br />
     40        To run this test manually you must set your user style sheet in your Safari preferences
     41        to LayoutTests/http/tests/security/resources/cssStyle.css
     42        <br/>
     43        If the background is yellow then the user stylesheet was loaded.
     44    </div>
     45    </br>
     46    <div id="result">
     47        Test not run correctly.
     48    </div>
     49</body>
    5150</html>
  • trunk/LayoutTests/platform/mac/fast/dom/frame-loading-via-document-write-expected.txt

    r25970 r28690  
    1 layer at (0,0) size 800x600
    2   RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x600
    4   RenderBlock {HTML} at (0,0) size 800x600
    5     RenderFrameSet {FRAMESET} at (0,0) size 800x600
    6       RenderFrame {FRAME} at (0,0) size 800x196
    7         layer at (0,0) size 800x196
    8           RenderView at (0,0) size 800x196
    9         layer at (0,0) size 800x196
    10           RenderBlock {HTML} at (0,0) size 800x196
    11             RenderBody {BODY} at (8,8) size 784x180
    12               RenderBlock {DIV} at (0,0) size 784x54
    13                 RenderInline {SPAN} at (0,0) size 221x18
    14                   RenderText {#text} at (0,0) size 221x18
    15                     text run at (0,0) width 221: "This page was successfully loaded."
    16                   RenderBR {BR} at (221,14) size 0x0
    17                 RenderInline {SPAN} at (0,0) size 120x18
    18                   RenderText {#text} at (0,18) size 120x18
    19                     text run at (0,18) width 120: "My protocol is file:"
    20                   RenderBR {BR} at (120,32) size 0x0
    21                 RenderInline {SPAN} at (0,0) size 125x18
    22                   RenderText {#text} at (0,36) size 125x18
    23                     text run at (0,36) width 125: "My referrer is blank"
    24                   RenderBR {BR} at (125,50) size 0x0
    25       RenderFrame {FRAME} at (0,202) size 800x196
    26         layer at (0,0) size 800x196
    27           RenderView at (0,0) size 800x196
    28         layer at (0,0) size 800x147
    29           RenderBlock {HTML} at (0,0) size 800x147
    30             RenderBody {BODY} at (8,8) size 784x131
    31               RenderTable {TABLE} at (0,0) size 95x131
    32                 RenderTableSection {TBODY} at (0,0) size 95x131
    33                   RenderTableRow {TR} at (0,2) size 95x127
    34                     RenderTableCell {TD} at (2,2) size 91x127 [r=0 c=0 rs=1 cs=1]
    35                       RenderBlock {DIV} at (1,1) size 89x18
    36                         RenderText {#text} at (0,0) size 89x18
    37                           text run at (0,0) width 89: "Image loaded."
    38                       RenderBlock (anonymous) at (1,19) size 89x107
    39                         RenderImage {IMG} at (0,0) size 76x103
    40       RenderFrame {FRAME} at (0,404) size 800x196
    41         layer at (0,0) size 800x196
    42           RenderView at (0,0) size 800x196
    43         layer at (0,0) size 800x147
    44           RenderBlock {HTML} at (0,0) size 800x147
    45             RenderBody {BODY} at (8,8) size 784x131
    46               RenderTable {TABLE} at (0,0) size 95x131
    47                 RenderTableSection {TBODY} at (0,0) size 95x131
    48                   RenderTableRow {TR} at (0,2) size 95x127
    49                     RenderTableCell {TD} at (2,2) size 91x127 [r=0 c=0 rs=1 cs=1]
    50                       RenderBlock {DIV} at (1,1) size 89x18
    51                         RenderText {#text} at (0,0) size 89x18
    52                           text run at (0,0) width 89: "Image loaded."
    53                       RenderBlock (anonymous) at (1,19) size 89x107
    54                         RenderImage {IMG} at (0,0) size 76x103
     1
     2
     3--------
     4Frame: 'topRow'
     5--------
     6This page was successfully loaded.
     7My protocol is file:
     8My referrer is blank
     9
     10
     11--------
     12Frame: 'middleRow'
     13--------
     14Image loaded.
     15
     16
     17--------
     18Frame: 'bottomRow'
     19--------
     20Image loaded.
     21
  • trunk/LayoutTests/platform/win/Skipped

    r28671 r28690  
    2626# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727#
     28
     29# Access violation when trying to run local script. <rdar://5631705>
     30fast/dom/frame-loading-via-document-write.html
     31fast/loader/local-iFrame-source-from-local.html
     32fast/loader/local-image-from-local.html
     33fast/loader/local-CSS-from-local.html
     34fast/loader/local-JavaScript-from-local.html
     35http/tests/security/local-JavaScript-from-remote.html
     36http/tests/security/local-iFrame-from-remote.html
     37http/tests/security/local-CSS-from-remote.html
     38http/tests/security/local-user-CSS-from-remote.html
     39http/tests/security/frame-loading-via-document-write.html
     40http/tests/security/local-image-from-remote.html
    2841
    2942# Should be moved to platform/mac <rdar://5621425>
     
    294307http/tests/navigation/anchor-frames.html
    295308
    296 # Symlinks arn't working correctly. <rdar://problem/5128536>
    297 fast/dom/frame-loading-via-document-write.html
    298 fast/loader/local-CSS-from-local.html
    299 fast/loader/local-JavaScript-from-local.html
    300 fast/loader/local-iFrame-source-from-local.html
    301 fast/loader/local-image-from-local.html
    302 
    303 # Need a way to specify local resources from http tests that works on Windows <rdar://5621435>
    304 http/tests/security/frame-loading-via-document-write.html
    305 http/tests/security/local-CSS-from-remote.html
    306 http/tests/security/local-JavaScript-from-remote.html
    307 http/tests/security/local-image-from-remote.html
    308 
    309309# No built-in plugin in DRT <rdar://problem/5074411>
    310310plugins/call-as-function-test.html
  • trunk/WebKitTools/ChangeLog

    r28661 r28690  
     12007-12-12  Kevin McCullough  <kmccullough@apple.com>
     2
     3        Reviewed by Alice and Sam.
     4
     5        - <rdar://5621435> Need a way to specify local resources (being loaded
     6        from HTTP tests) on Windows.
     7        - Implemented pathToLocalResource which exposes the functionality of
     8        converting a given unix path to the correct location on Windows.
     9
     10        * DumpRenderTree/LayoutTestController.cpp:
     11        (pathToLocalResourceCallback):
     12        (LayoutTestController::staticFunctions):
     13        * DumpRenderTree/LayoutTestController.h:
     14        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     15        (LayoutTestController::pathToLocalResource):
     16        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     17        (LayoutTestController::pathToLocalResource):
     18
    1192007-12-11  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r28071 r28690  
    137137}
    138138
     139static JSValueRef pathToLocalResourceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     140{
     141    if (argumentCount < 1)
     142        return JSValueMakeUndefined(context);
     143
     144    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     145    JSRetainPtr<JSStringRef> localPath = JSValueToStringCopy(context, arguments[0], exception);
     146    ASSERT(!*exception);
     147
     148    return JSValueMakeString(context, controller->pathToLocalResource(context, localPath.get()));
     149}
     150
    139151static JSValueRef repaintSweepHorizontallyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    140152{
     
    561573        { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    562574        { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     575        { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    563576        { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    564577        { "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r28071 r28690  
    4747    void keepWebHistory();
    4848    void notifyDone();
     49    JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
    4950    void queueBackNavigation(int howFarBackward);
    5051    void queueForwardNavigation(int howFarForward);
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r28071 r28690  
    116116}
    117117
     118JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
     119{
     120    return url; // Do nothing on mac.
     121}
     122
    118123void LayoutTestController::queueBackNavigation(int howFarBack)
    119124{
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r28412 r28690  
    5454using std::wstring;
    5555
     56static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath);
     57
    5658LayoutTestController::~LayoutTestController()
    5759{
     
    144146        dump();
    145147    m_waitToDump = false;
     148}
     149
     150JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
     151{
     152    wstring localPath;
     153    if (!resolveCygwinPath(wstring(JSStringGetCharactersPtr(url), JSStringGetLength(url)), localPath))
     154        return 0;
     155
     156    return JSStringCreateWithCharacters(localPath.c_str(), localPath.length());
    146157}
    147158
     
    354365static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath)
    355366{
    356     if (cygwinPath[0] != '/')
     367    wstring fileProtocol = L"file://";
     368    bool isFileProtocol = cygwinPath.find(fileProtocol) != string::npos;
     369    if (cygwinPath[isFileProtocol ? 7 : 0] != '/')  // ensure path is absolute
    357370        return false;
    358371
     
    368381    windowsPath = wstring(rootPath, rootPathSize);
    369382
    370     int oldPos = 1;
     383    int oldPos = isFileProtocol ? 8 : 1;
    371384    while (1) {
    372385        int newPos = cygwinPath.find('/', oldPos);
     
    393406        oldPos = newPos + 1;
    394407    }
     408
     409    if (isFileProtocol)
     410        windowsPath = fileProtocol + windowsPath;
     411
    395412    return true;
    396413}
Note: See TracChangeset for help on using the changeset viewer.