Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / event_order_canplay_playing.html
index a5a67dd..3571e51 100644 (file)
   <div id="log"></div>
   <script>
 test(function() {
-  var t = async_test("setting src attribute on autoplay audio should trigger canplay then playing event", {timeout:5000});
+  var t = async_test("setting src attribute on autoplay audio should trigger canplay then playing event");
   var a = document.getElementById("a");
   var found_canplay = false;
-  a.addEventListener("canplay", function() {
+  a.addEventListener("error", t.unreached_func());
+  a.addEventListener("canplay", t.step_func(function() {
     found_canplay = true;
-  });
-  a.addEventListener("playing", function() {
-    t.step(function() {
-     assert_true(found_canplay);
-    });
+  }));
+  a.addEventListener("playing", t.step_func(function() {
+    assert_true(found_canplay);
     t.done();
     a.pause();
-  }, false);
+  }), false);
   a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
 }, "audio events - canplay, then playing");
 
 test(function() {
-  var t = async_test("setting src attribute on autoplay video should trigger canplay then playing event", {timeout:5000});
+  var t = async_test("setting src attribute on autoplay video should trigger canplay then playing event");
   var v = document.getElementById("v");
   var found_canplay = false;
-  v.addEventListener("canplay", function() {
+  v.addEventListener("error", t.unreached_func());
+  v.addEventListener("canplay", t.step_func(function() {
     found_canplay = true;
-  });
-  v.addEventListener("playing", function() {
-    t.step(function() {
-     assert_true(found_canplay);
-    });
+  }));
+  v.addEventListener("playing", t.step_func(function() {
+    assert_true(found_canplay);
     t.done();
     v.pause();
-  }, false);
+  }), false);
   v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
 }, "video events - canplay, then playing");
   </script>