| OLD | NEW | 
|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> | 
| 2 <html> | 2 <title>Video element with src="" should invoke media element's load algorithm an
    d should fire "error" event. Network state should be NETWORK_NO_SOURCE and the e
    rror code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</title> | 
| 3     <head> | 3 <script src="../resources/testharness.js"></script> | 
| 4         <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> | 
| 5              (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> | 
| 6         <script src=video-test.js></script> | 6 <video></video> | 
| 7         <script src=media-file.js></script> | 7 <script> | 
| 8         <script> | 8 async_test(function(t) { | 
|  | 9     var video = document.querySelector("video"); | 
| 9 | 10 | 
| 10             function start() | 11     video.onloadstart = t.step_func(function() {}); | 
| 11             { | 12     video.onloadedmetadata = t.step_func(function() {}); | 
| 12                 findMediaElement(); | 13     video.onloadeddata = t.step_func(function() {}); | 
|  | 14     video.onabort = t.step_func(function() {}); | 
|  | 15     video.onemptied = t.step_func(function() {}); | 
|  | 16     video.onerror = t.unreached_func(); | 
| 13 | 17 | 
| 14                 waitForEvent("loadstart"); | 18     video.oncanplaythrough = t.step_func(function() { | 
| 15                 waitForEvent("loadedmetadata"); | 19         // video with empty src attribute. | 
| 16                 waitForEvent("loadeddata"); | 20         video.src = ""; | 
| 17                 waitForEvent("abort"); | 21         video.onerror = t.step_func_done(function(event) { | 
| 18                 waitForEvent("emptied"); | 22             assert_equals(event.target, video); | 
| 19                 waitForEvent("canplaythrough", testLoad); | 23             assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORT
    ED); | 
| 20                 waitForEvent("error", errorEvent); | 24             assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE
    ); | 
| 21                 consoleWrite("** <video> with valid non-empty 'src' attrib
    ute**"); | 25         }); | 
| 22                 video.src = findMediaFile("video", "content/test"); | 26     }); | 
| 23             } |  | 
| 24 | 27 | 
| 25             function errorEvent() | 28     // video with valid non-empty "src" attribute. | 
| 26             { | 29     video.src = findMediaFile("video", "content/test"); | 
| 27                 consoleWrite("<br>'error' event:"); | 30 }); | 
| 28                 testExpected('event.target', video); | 31 </script> | 
| 29                 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU
    PPORTED); |  | 
| 30                 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_S
    OURCE); |  | 
| 31                 endTest(); |  | 
| 32             } |  | 
| 33 |  | 
| 34             function testLoad() |  | 
| 35             { |  | 
| 36                 consoleWrite("<br>** <video> with empty src attribute**"); |  | 
| 37                 run('video.src = ""'); |  | 
| 38             } |  | 
| 39         </script> |  | 
| 40     </head> |  | 
| 41     <body onload="start()"> |  | 
| 42         <video width=320 height=60 controls></video> |  | 
| 43         <p> <video> element with src="" should invoke media element's load
     algorithm and should fire 'error' event. Network state should be NETWORK_NO_SOU
    RCE and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.</p> |  | 
| 44     </body> |  | 
| 45 </html> |  | 
| OLD | NEW | 
|---|