| Index: content/test/data/media/getusermedia.html
|
| diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
|
| index 14ce8d5755df0ef0e87e984232cbd8ece99066bc..6fbe5e502afbf15edec0f7cee8a7a4e870cf3e8c 100644
|
| --- a/content/test/data/media/getusermedia.html
|
| +++ b/content/test/data/media/getusermedia.html
|
| @@ -5,19 +5,19 @@
|
| $ = function(id) {
|
| return document.getElementById(id);
|
| };
|
| -
|
| +
|
| var gLocalStream = null;
|
| -
|
| +
|
| setAllEventsOccuredHandler(function() {
|
| gLocalStream.stop();
|
| - document.title = 'OK';
|
| + document.title = 'OK';
|
| });
|
| -
|
| - // This test that a MediaStream can be created and a local preview
|
| +
|
| + // This test that a MediaStream can be created and a local preview
|
| // rendered.
|
| function getUserMedia(constraints) {
|
| - navigator.webkitGetUserMedia(constraints, displayAndWaitForVideo,
|
| - failedCallback);
|
| + navigator.webkitGetUserMedia(constraints,
|
| + displayAndWaitForVideoToStartAndStop, failedCallback);
|
| }
|
|
|
| function getUserMediaWithAnalysis(constraints) {
|
| @@ -25,22 +25,25 @@
|
| constraints, displayAndWaitForAndAnalyzeVideo, failedCallback);
|
| }
|
|
|
| - // This test that a MediaStream can be cloned and that the clone can
|
| + // This test that a MediaStream can be cloned and that the clone can
|
| // be rendered.
|
| function getUserMediaAndClone() {
|
| navigator.webkitGetUserMedia({video: true, audio: true},
|
| createAndRenderClone, failedCallback);
|
| }
|
| -
|
| +
|
| function failedCallback(error) {
|
| document.title = 'GetUserMedia call failed with code ' + error.code;
|
| }
|
|
|
| - function displayAndWaitForVideo(stream) {
|
| + function displayAndWaitForVideoToStartAndStop(stream) {
|
| gLocalStream = stream;
|
| var localStreamUrl = webkitURL.createObjectURL(stream);
|
| $('local-view').src = localStreamUrl;
|
| - waitForVideo('local-view');
|
| + document.title = 'Waiting for video...';
|
| + // Wait for video to play, then stop the track and wait for video to stop
|
| + // playing.
|
| + detectVideoPlaying('local-view', stopVideoTrack);
|
| }
|
|
|
| function displayAndWaitForAndAnalyzeVideo(stream) {
|
| @@ -53,7 +56,7 @@
|
| function createAndRenderClone(stream) {
|
| gLocalStream = stream;
|
| // TODO(perkj): --use-fake-device-for-media-stream do not currently
|
| - // work with audio devices and not all bots has a microphone.
|
| + // work with audio devices and not all bots has a microphone.
|
| new_stream = new webkitMediaStream();
|
| new_stream.addTrack(stream.getVideoTracks()[0]);
|
| expectEquals(new_stream.getVideoTracks().length, 1);
|
| @@ -63,12 +66,17 @@
|
| new_stream.removeTrack(new_stream.getAudioTracks()[0]);
|
| expectEquals(new_stream.getAudioTracks().length, 0);
|
| }
|
| -
|
| +
|
| var newStreamUrl = webkitURL.createObjectURL(new_stream);
|
| - $('local-view').src = newStreamUrl;
|
| + $('local-view').src = newStreamUrl;
|
| waitForVideo('local-view');
|
| }
|
|
|
| + function stopVideoTrack() {
|
| + gLocalStream.getVideoTracks()[0].stop();
|
| + waitForVideoToStop('local-view');
|
| + }
|
| +
|
| function analyzeVideo() {
|
| document.title = 'Waiting for video...';
|
| addExpectedEvent();
|
| @@ -78,7 +86,7 @@
|
| });
|
| }
|
|
|
| - </script>
|
| + </script>
|
| </head>
|
| <body>
|
| <table border="0">
|
| @@ -87,7 +95,7 @@
|
| </tr>
|
| <tr>
|
| <td><video width="320" height="240" id="local-view"
|
| - autoplay="autoplay"></video></td>
|
| + autoplay="autoplay"></video></td>
|
| <!-- Canvases are named after their corresponding video elements. -->
|
| <td><canvas width="320" height="240" id="local-view-canvas"
|
| style="display:none"></canvas></td>
|
|
|