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

Unified Diff: chrome/test/data/webrtc/getusermedia.js

Issue 293123009: Cleaned up WebRTC browser test js, removed unneeded stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « chrome/browser/media/webrtc_browsertest_base.cc ('k') | chrome/test/data/webrtc/jsep01_call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webrtc/getusermedia.js
diff --git a/chrome/test/data/webrtc/getusermedia.js b/chrome/test/data/webrtc/getusermedia.js
index bb66b59bac2f50a264fc34a08190ced5a4db19a8..4307e60609e84321f4f1174f87497e6a68cb243e 100644
--- a/chrome/test/data/webrtc/getusermedia.js
+++ b/chrome/test/data/webrtc/getusermedia.js
@@ -45,23 +45,17 @@ $ = function(id) {
* appears in Chrome, which will run either the OK or failed callback as a
* a result. To see which callback was called, use obtainGetUserMediaResult().
*
- * @param {string} constraints Defines what to be requested, with mandatory
+ * @param {!object} constraints Defines what to be requested, with mandatory
kjellander_chromium 2014/05/26 14:30:47 nit: Object starting with uppercase according to h
phoglund_chromium 2014/05/27 09:29:44 Done.
* and optional constraints defined. The contents of this parameter depends
- * on the WebRTC version. This should be JavaScript code that we eval().
+ * on the WebRTC version.
*/
function doGetUserMedia(constraints) {
if (!getUserMedia) {
returnToTest('Browser does not support WebRTC.');
return;
}
- try {
- var evaluatedConstraints;
- eval('evaluatedConstraints = ' + constraints);
- } catch (exception) {
- throw failTest('Not valid JavaScript expression: ' + constraints);
- }
debug('Requesting doGetUserMedia: constraints: ' + constraints);
- getUserMedia(evaluatedConstraints,
+ getUserMedia(constraints,
function(stream) {
ensureGotAllExpectedStreams_(stream, constraints);
getUserMediaOkCallback_(stream);
@@ -131,19 +125,17 @@ function getLocalStream() {
/**
* @private
- * @param {MediaStream} stream Media stream from getUserMedia.
- * @param {String} constraints The constraints passed
+ * @param {!MediaStream} stream Media stream from getUserMedia.
+ * @param {!object} constraints The getUserMedia constraints object.
*/
function ensureGotAllExpectedStreams_(stream, constraints) {
- var requestedVideo = /video\s*:\s*true/i;
- if (requestedVideo.test(constraints) && stream.getVideoTracks().length == 0) {
+ if (constraints['video'] && stream.getVideoTracks().length == 0) {
gRequestWebcamAndMicrophoneResult = 'failed-to-get-video';
throw ('Requested video, but did not receive a video stream from ' +
'getUserMedia. Perhaps the machine you are running on ' +
'does not have a webcam.');
}
- var requestedAudio = /audio\s*:\s*true/i;
- if (requestedAudio.test(constraints) && stream.getAudioTracks().length == 0) {
+ if (constraints['audio'] && stream.getAudioTracks().length == 0) {
gRequestWebcamAndMicrophoneResult = 'failed-to-get-audio';
throw ('Requested audio, but did not receive an audio stream ' +
'from getUserMedia. Perhaps the machine you are running ' +
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.cc ('k') | chrome/test/data/webrtc/jsep01_call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698