Commit 59648009 authored by sheu@chromium.org's avatar sheu@chromium.org

Fix onLocalDescriptionError callback in WebRtcBrowserTest

Make sure the onLocalDescriptionError callback is set before it can possibly
be called as a side-effect of webkitGetUserMedia().

BUG=339286
TEST=local build, run on desktop Linux

Review URL: https://codereview.chromium.org/149703004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247953 0039d316-1c4b-4281-b951-d872f2087c98
parent 3bf84960
...@@ -144,8 +144,6 @@ ...@@ -144,8 +144,6 @@
function negotiateUnsupportedVideoCodec() { function negotiateUnsupportedVideoCodec() {
createConnections(null); createConnections(null);
transformSdp = removeVideoCodec; transformSdp = removeVideoCodec;
navigator.webkitGetUserMedia({audio: true, video: true},
addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
onLocalDescriptionError = function(error) { onLocalDescriptionError = function(error) {
var expectedMsg = 'Failed to set local offer sdp:' + var expectedMsg = 'Failed to set local offer sdp:' +
' Session error code: ERROR_CONTENT. Session error description:' + ' Session error code: ERROR_CONTENT. Session error description:' +
...@@ -155,14 +153,14 @@ ...@@ -155,14 +153,14 @@
// Got the right message, test succeeded. // Got the right message, test succeeded.
document.title = 'OK'; document.title = 'OK';
}; };
navigator.webkitGetUserMedia({audio: true, video: true},
addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
} }
// Test that we can't setup a call if one peer does not support encryption // Test that we can't setup a call if one peer does not support encryption
function negotiateNonCryptoCall() { function negotiateNonCryptoCall() {
createConnections(null); createConnections(null);
transformSdp = removeCrypto; transformSdp = removeCrypto;
navigator.webkitGetUserMedia({audio: true, video: true},
addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
onLocalDescriptionError = function(error) { onLocalDescriptionError = function(error) {
var expectedMsg = 'Failed to set local offer sdp:' + var expectedMsg = 'Failed to set local offer sdp:' +
' Called with a SDP without crypto enabled.'; ' Called with a SDP without crypto enabled.';
...@@ -171,6 +169,8 @@ ...@@ -171,6 +169,8 @@
// Got the right message, test succeeded. // Got the right message, test succeeded.
document.title = 'OK'; document.title = 'OK';
}; };
navigator.webkitGetUserMedia({audio: true, video: true},
addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
} }
// Test that we can negotiate a call with an SDP offer that includes a // Test that we can negotiate a call with an SDP offer that includes a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment