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

Side by Side Diff: chrome/test/data/webrtc/getusermedia.js

Issue 10696115: Add test to verify we can cancel the GetUserMedia request right after sending the request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Patrik's comments. Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * Keeps track of our local stream (e.g. what our local webcam is streaming). 8 * Keeps track of our local stream (e.g. what our local webcam is streaming).
9 * @private 9 * @private
10 */ 10 */
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 debug("Requesting webcam and microphone."); 32 debug("Requesting webcam and microphone.");
33 navigator.webkitGetUserMedia({video: requestVideo, audio: requestAudio}, 33 navigator.webkitGetUserMedia({video: requestVideo, audio: requestAudio},
34 getUserMediaOkCallback, 34 getUserMediaOkCallback,
35 getUserMediaFailedCallback); 35 getUserMediaFailedCallback);
36 returnToPyAuto('ok-requested'); 36 returnToPyAuto('ok-requested');
37 } 37 }
38 38
39 /** 39 /**
40 * This function realods the web page which will cancel the previous
Nirnimesh 2012/07/12 14:07:01 This function reloads -> Reload
41 * GetUserMedia requests.
42 */
43 function ReloadWebPage() {
44 // Reload the web page.
45 location.reload();
46
47 debug("Reloading page.");
48 returnToPyAuto('ok-reloaded-page');
49 }
50
51 /**
40 * Must be called after calling getUserMedia. Returns not-called-yet if we have 52 * Must be called after calling getUserMedia. Returns not-called-yet if we have
41 * not yet been called back by WebRTC. Otherwise it returns either ok-got-stream 53 * not yet been called back by WebRTC. Otherwise it returns either ok-got-stream
42 * or failed-with-error-x (where x is the error code from the error callback) 54 * or failed-with-error-x (where x is the error code from the error callback)
43 * depending on which callback got called by WebRTC. 55 * depending on which callback got called by WebRTC.
44 */ 56 */
45 function obtainGetUserMediaResult() { 57 function obtainGetUserMediaResult() {
46 returnToPyAuto(gRequestWebcamAndMicrophoneResult); 58 returnToPyAuto(gRequestWebcamAndMicrophoneResult);
47 } 59 }
48 60
49 61
(...skipping 16 matching lines...) Expand all
66 function getUserMediaOkCallback(stream) { 78 function getUserMediaOkCallback(stream) {
67 gLocalStream = stream; 79 gLocalStream = stream;
68 var streamUrl = webkitURL.createObjectURL(stream); 80 var streamUrl = webkitURL.createObjectURL(stream);
69 document.getElementById("local_view").src = streamUrl; 81 document.getElementById("local_view").src = streamUrl;
70 82
71 gRequestWebcamAndMicrophoneResult = 'ok-got-stream'; 83 gRequestWebcamAndMicrophoneResult = 'ok-got-stream';
72 } 84 }
73 85
74 function getUserMediaFailedCallback(error) { 86 function getUserMediaFailedCallback(error) {
75 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + error.code; 87 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + error.code;
76 } 88 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/functional/webrtc_call.py » ('j') | chrome/test/functional/webrtc_call.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698