Bug 1070110 - Ensure the testcase will receive at least 2 blob. r=jwwang, a=testonly
authorBenjamin Chen <bechen@mozilla.com>
Thu, 06 Aug 2015 15:25:37 +0800
changeset 281845 792de4230fce432a3b8f7e50ed0a9c93bab9519f
parent 281844 16c30b544f064524e52c3a47f41f2055b3511af9
child 281846 c35fc1ed213ed4b4fc2df34169e6321ef5b3c007
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, testonly
bugs1070110
milestone41.0a2
Bug 1070110 - Ensure the testcase will receive at least 2 blob. r=jwwang, a=testonly
dom/media/test/test_mediarecorder_record_timeslice.html
--- a/dom/media/test/test_mediarecorder_record_timeslice.html
+++ b/dom/media/test/test_mediarecorder_record_timeslice.html
@@ -20,16 +20,17 @@ function startTest(test, token) {
   var expectedMimeType = test.type.substring(0, test.type.indexOf(';'));
 
   element.token = token;
   manager.started(token);
 
   element.src = test.name;
   element.test = test;
   element.stream = element.mozCaptureStream();
+  element.loop = true;
 
   var mediaRecorder = new MediaRecorder(element.stream);
 
   mediaRecorder.onerror = function () {
     ok(false, 'Unexpected onerror callback fired');
   };
 
   mediaRecorder.onwarning = function () {
@@ -63,35 +64,35 @@ function startTest(test, token) {
     // We'll stop recording upon the 1st blob being received
     if (dataAvailableCount === 1) {
       mediaRecorder.onstop = function (evt) {
         info('onstop fired');
 
         if (!onDataAvailableFirst) {
           ok(false, 'onstop unexpectedly fired before ondataavailable');
         }
-
+        element.pause();
         manager.finished(token);
       };
 
       mediaRecorder.stop();
       is(mediaRecorder.state, 'inactive',
          'Media recorder is inactive after being stopped');
       is(mediaRecorder.stream, element.stream,
          'Media recorder stream = element stream post recording');
 
     } else if (dataAvailableCount === 2) {
       // Ensure we've received at least two ondataavailable events before onstop
       onDataAvailableFirst = true;
     }
   };
 
-  // Start recording once canplaythrough fires
-  element.oncanplaythrough = function() {
-    element.oncanplaythrough = null;
+  // Start recording once metadataloaded fires
+  element.onloadedmetadata = function() {
+    element.onloadedmetadata = null;
     mediaRecorder.start(250);
     is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
     is(mediaRecorder.stream, element.stream,
        'Media recorder stream = element stream at the start of recording');
   };
 
   element.play();
 }