summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
blob: c7d4171521cdd866a90ff618c6e8a35dcd51cbb4 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<html>
    <head>
        <script src=media-file.js></script>
        <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
             (Please avoid writing new tests using video-test.js) -->
        <script src=video-test.js></script>


        <script>
            function loadedmetadata()
            {
                failTest(relativeURL(video.currentSrc) + "loaded but should not" );
                consoleWrite("");
            }

            function errorEvent()
            {
                testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);

                // "setTimeout()" is generally bad form in a layout test, but we need to verify
                // that changing the 'src' attribute does not do something that happens
                // asynchronously so we don't have a lot of options.
                setTimeout(function () { endTest(); }, 200) ;
                run("video.removeAttribute('src')");
                consoleWrite("");
            }

            function setup()
            {
                findMediaElement();

                video.src = "bogus.mov";

                var source = document.createElement("source");
                source.setAttribute("src", findMediaFile("video", "content/test"));
                video.appendChild(source);

                waitForEvent('loadedmetadata', loadedmetadata);
                waitForEvent('error', errorEvent);
                consoleWrite("");
            }

        </script>
    </head>
<body onload="setup()">

    <video controls></video>

    <p>Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements</p>

    <script>

    </script>

</body>
</html>