Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: third_party/WebKit/LayoutTests/media/invalid-media-url-crash.html

Issue 2024533002: Convert csp-*, event-* and invalid-* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <body> 2 <title>Tests that invalid media src url does not result in crash.</title>
3 <p>Tests that invalid media src url does not result in crash.</p> 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>
6 <script src=video-test.js></script> 6 function check_invalid_media_src(elementName) {
7 <script> 7 async_test(function(t) {
8 var invalid_url = "!:/" + String.fromCharCode(0) + "%aa#aa"; 8 var mediaElement = document.createElement(elementName);
9 var error_count = 0; 9 mediaElement.src = "!:/" + String.fromCharCode(0) + "%aa#aa";
10 10
11 function errorEvent() 11 mediaElement.onerror = t.step_func_done(function() {
12 { 12 assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_SRC_NOT_ SUPPORTED);
13 error_count++; 13 assert_equals(mediaElement.networkState, HTMLMediaElement.NETWORK_NO _SOURCE);
14 if (error_count == 2) 14 });
15 { 15 });
16 testExpected("audio.error.code", MediaError.MEDIA_ERR_SRC_NO T_SUPPORTED); 16 }
17 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NO T_SUPPORTED);
18 testExpected("audio.networkState", HTMLMediaElement.NETWORK_ NO_SOURCE);
19 testExpected("video.networkState", HTMLMediaElement.NETWORK_ NO_SOURCE);
20 endTest();
21 }
22 }
23 17
24 var audio = document.createElement('audio'); 18 check_invalid_media_src("audio");
25 var video = document.createElement('video'); 19 check_invalid_media_src("video");
26 audio.src = invalid_url; 20 </script>
27 video.src = invalid_url;
28 audio.onerror = errorEvent;
29 video.onerror = errorEvent;
30 document.body.appendChild(audio);
31 document.body.appendChild(video);
32 </script>
33 </body>
34 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698