summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/loader/local-image-from-local.html
blob: 7e613f7a09d4e600bf47036a67347c41b4a6249d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<html>
<head>
    <script>        
        if (window.testRunner)
            testRunner.dumpAsText();

        var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
        if (window.testRunner)
            localImageLocation = testRunner.pathToLocalResource(localImageLocation);

        var localImageElement = document.createElement("img");
        localImageElement.setAttribute("id", "myImg");
        localImageElement.setAttribute("src", localImageLocation);
        localImageElement.setAttribute("onError", "imgError()");
        localImageElement.setAttribute("onLoad", "imgLoad()");

        function imgError() {
            var result = document.getElementById("result");
            result.innerHTML = "Test Failed: Image Load Error.";
        }

        function imgLoad() {
            var result = document.getElementById("result");
            result.innerHTML = "Test Passed. Local image loaded.";
        }
    </script>
</head>
<body onload="document.body.appendChild(localImageElement)">
    <div id="div0">
        This test is to see if a remote file can include a local image.
        <br/>
        Currently this test cannot be run manually on Windows because we do not have
        a function like pathToLocalResource() outside of DRT.
        <br/>
    </div>
    </br>
    <div id="result">
        Test has not run.
    </div>
    </br>
</body>
</html>