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

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

Issue 133903004: Cleaned up the WebRtcAudioCapturer a bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and fixed the comment. Created 6 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 | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/getusermedia.html
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
index 92037cfb53752b854b205e66e6a1587f8776a1de..7481613291288c2a410d50ad87e206be27bfc33c 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -64,25 +64,61 @@
createAndRenderClone, failedCallback);
}
+ // Creates two MediaStream and renders them locally. When the video of both
+ // streams are detected to be rolling, we stop the local stream. Since both
+ // streams have the same source, both video streams should stop. If they do,
+ // the test succeeds.
+ function twoGetUserMediaAndStop(constraints) {
+ document.title = 'Calling Two GetUserMedia';
+ navigator.webkitGetUserMedia(
+ constraints,
+ function(stream) {
+ displayAndDetectVideo(stream, requestSecondGetUserMedia);
+ },
+ failedCallback);
+ var requestSecondGetUserMedia = function() {
+ navigator.webkitGetUserMedia(
+ constraints,
+ function(stream) {
+ displayIntoVideoElement(stream,
+ stopStreamAndVerifyAllLocalViewsDontPlayVideo, 'local-view-2');
+ },
+ failedCallback);
+ };
+
+ var stopStreamAndVerifyAllLocalViewsDontPlayVideo = function() {
+ gLocalStream.getVideoTracks()[0].stop();
+
+ // Since local-view and local-view-2 are playing the video from the same
+ // source, both of them should stop.
+ waitForVideoToStop('local-view');
+ waitForVideoToStop('local-view-2');
+ };
+ }
+
function failedCallback(error) {
document.title = 'GetUserMedia call failed with code ' + error.code;
sendValueToTest(document.title);
}
- function plugStreamIntoLocalView(stream) {
+ function plugStreamIntoVideoElement(stream, videoElement) {
gLocalStream = stream;
var localStreamUrl = URL.createObjectURL(stream);
- $('local-view').src = localStreamUrl;
+ $(videoElement).src = localStreamUrl;
}
- function displayAndDetectVideo(stream, callback) {
- plugStreamIntoLocalView(stream);
+ function displayIntoVideoElement(stream, callback, videoElement) {
+ plugStreamIntoVideoElement(stream, videoElement);
document.title = 'Waiting for video...';
- detectVideoPlaying('local-view', callback);
+ detectVideoPlaying(videoElement, callback);
+ }
+
+ function displayAndDetectVideo(stream, callback) {
+ displayIntoVideoElement(stream, callback, 'local-view');
}
function displayDetectAndAnalyzeVideo(stream) {
- plugStreamIntoLocalView(stream);
+ plugStreamIntoVideoElement(stream, 'local-view');
analyzeVideo();
}
@@ -134,10 +170,19 @@
<tr>
<td><video width="320" height="240" id="local-view"
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>
</tr>
+ <tr>
+ <td>Local Preview 2</td>
+ </tr>
+ <tr>
+ <td><video width="320" height="240" id="local-view-2"
+ autoplay="autoplay"></video></td>
+ <!-- Canvases are named after their corresponding video elements. -->
+ <td><canvas width="320" height="240" id="local-view-2-canvas"
+ style="display:none"></canvas></td>
+ </tr>
</table>
</body>
</html>
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698