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

Unified Diff: content/test/data/media/mediarecorder_test.html

Issue 2639693003: MediaRecorder: add timecode validation in content_browsertests (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/mediarecorder_test.html
diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html
index 287037ecaf2d822e8f6703abdff0872ce1e3a992..95a66894fe68ad1c3b4cb37818b3e779e6130052 100644
--- a/content/test/data/media/mediarecorder_test.html
+++ b/content/test/data/media/mediarecorder_test.html
@@ -171,7 +171,7 @@ function testStartStopAndRecorderState() {
function testStartAndDataAvailable(mimeType) {
var videoSize = 0;
var emptyBlobs = 0;
- var timeStamps = [];
+ var lastTimecode = NaN;
navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
.then(function(stream) {
return createAndStartMediaRecorder(stream, mimeType);
@@ -179,11 +179,14 @@ function testStartAndDataAvailable(mimeType) {
.then(function(recorder) {
// Save history of Blobs received via dataavailable.
recorder.ondataavailable = function(event) {
- timeStamps.push(event.timeStamp);
if (event.data.size > 0)
videoSize += event.data.size;
else
emptyBlobs += 1;
+
+ if (!isNaN(lastTimecode))
+ assertTrue(event.timecode > lastTimecode, 'timecodes');
+ lastTimecode = event.timecode;
};
})
.then(function() {
@@ -210,6 +213,7 @@ function testStartWithTimeSlice(mimeType) {
var videoSize = 0;
var emptyBlobs = 0;
var timeStamps = [];
+ var lastTimecode = NaN;
navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
.then(function(stream) {
return createAndStartMediaRecorder(stream, mimeType,
@@ -222,6 +226,10 @@ function testStartWithTimeSlice(mimeType) {
videoSize += event.data.size;
else
emptyBlobs += 1;
+
+ if (!isNaN(lastTimecode))
+ assertTrue(event.timecode > lastTimecode, 'timecodes');
+ lastTimecode = event.timecode;
};
})
.then(function() {
@@ -289,6 +297,7 @@ function testIllegalResumeThrowsDOMError() {
function testResumeAndDataAvailable(mimeType) {
var videoSize = 0;
var emptyBlobs = 0;
+ var lastTimecode = NaN;
navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
.then(function(stream) {
return createAndStartMediaRecorder(stream, mimeType);
@@ -302,6 +311,10 @@ function testResumeAndDataAvailable(mimeType) {
console.log('This dataavailable event is empty', event);
emptyBlobs += 1;
}
+
+ if (!isNaN(lastTimecode))
+ assertTrue(event.timecode > lastTimecode, 'timecodes');
+ lastTimecode = event.timecode;
};
recorder.resume();
})
@@ -414,6 +427,7 @@ function testIllegalPauseThrowsDOMError() {
function testRecordRemotePeerConnection(mimeType) {
var videoSize = 0;
var timeStamps = [];
+ var lastTimecode = NaN;
navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
.then(function(localStream) {
return setupPeerConnection(localStream);
@@ -425,6 +439,10 @@ function testRecordRemotePeerConnection(mimeType) {
recorder.ondataavailable = function(event) {
timeStamps.push(event.timeStamp);
videoSize += event.data.size;
+
+ if (!isNaN(lastTimecode))
+ assertTrue(event.timecode > lastTimecode, 'timecodes');
+ lastTimecode = event.timecode;
};
recorder.start(0);
})
@@ -492,10 +510,14 @@ function testTwoChannelAudio() {
var dest = context.createMediaStreamDestination();
dest.channelCount = 2;
oscillator.connect(dest);
+ var lastTimecode = NaN;
createMediaRecorder(dest.stream, DEFAULT_RECORDER_MIME_TYPE)
.then(function(recorder) {
recorder.ondataavailable = function(event) {
audioSize += event.data.size;
+ if (!isNaN(lastTimecode))
+ assertTrue(event.timecode > lastTimecode, 'timecodes');
+ lastTimecode = event.timecode;
};
recorder.start(0);
oscillator.start();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698