Bug 1070110 - Ensure the testcase will receive at least 2 blob. r=jwwang
authorBenjamin Chen <bechen@mozilla.com>
Thu, 06 Aug 2015 15:25:37 +0800
changeset 288471 25a43f6817f4acf33832ca8543ecf3ba083d9ce2
parent 288470 4ea1373a7a77c1a2c750eef234dcc07b1568a349
child 288472 bfe67700a88e9dad7b7894b951fe3461cbc14bbe
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1070110
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1070110 - Ensure the testcase will receive at least 2 blob. r=jwwang
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();
 }