зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1041362 - Modify testcases because during the oncanplaythrough callback function, the element might not ended but the mediastream is ended. r=roc
This commit is contained in:
Родитель
cd19a8d6b0
Коммит
e22f960990
|
@ -97,9 +97,9 @@ function startTest(test, token) {
|
|||
|
||||
// This handler completes a start and stop of recording and verifies
|
||||
// respective media recorder state.
|
||||
var canPlayThrough = function() {
|
||||
element.removeEventListener('canplaythrough', canPlayThrough, false);
|
||||
|
||||
element.onloadedmetadata = function () {
|
||||
element.onloadedmetadata = null;
|
||||
element.play();
|
||||
mediaRecorder.start();
|
||||
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
|
||||
is(mediaRecorder.stream, element.stream,
|
||||
|
@ -112,8 +112,7 @@ function startTest(test, token) {
|
|||
'Media recorder stream = element stream post recording');
|
||||
};
|
||||
|
||||
element.addEventListener('canplaythrough', canPlayThrough, false);
|
||||
element.play();
|
||||
element.preload = "metadata";
|
||||
}
|
||||
|
||||
manager.runTests(gMediaRecorderTests, startTest);
|
||||
|
|
|
@ -84,24 +84,18 @@ function startTest(test, token) {
|
|||
}
|
||||
};
|
||||
|
||||
element.oncanplaythrough = function () {
|
||||
element.oncanplaythrough = null;
|
||||
// If content has ended, skip the test
|
||||
if (element.ended) {
|
||||
ok(true, 'ended fired before canplaythrough, skipping test');
|
||||
manager.finished(token);
|
||||
} else {
|
||||
// If content hasn't ended, start recording
|
||||
mediaRecorder.start();
|
||||
is(mediaRecorder.state, 'recording',
|
||||
'Media recorder should be recording');
|
||||
is(mediaRecorder.stream, element.stream,
|
||||
'Media recorder stream = element stream at the start of recording');
|
||||
// Recording will automatically stop when the stream ends.
|
||||
}
|
||||
}
|
||||
element.preload = "metadata";
|
||||
|
||||
element.play();
|
||||
element.onloadedmetadata = function () {
|
||||
element.onloadedmetadata = null;
|
||||
mediaRecorder.start();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
manager.runTests(gMediaRecorderTests, startTest);
|
||||
|
|
|
@ -54,15 +54,17 @@ function startTest(test, token) {
|
|||
ok(false, 'Unexpected warning fired');
|
||||
}
|
||||
|
||||
element.oncanplaythrough = function () {
|
||||
element.oncanplaythrough = null;
|
||||
element.preload = "metadata";
|
||||
|
||||
element.onloadedmetadata = function () {
|
||||
element.onloadedmetadata = null;
|
||||
element.play();
|
||||
for (var i = 0; i < mExpectStopCount; i++) {
|
||||
mediaRecorder.start(1000);
|
||||
mediaRecorder.stop();
|
||||
}
|
||||
}
|
||||
|
||||
element.play();
|
||||
}
|
||||
|
||||
manager.runTests(gMediaRecorderTests, startTest);
|
||||
|
|
Загрузка…
Ссылка в новой задаче