Selecting bot_type changed to be specified in the test file

Selecting bot_type changed to be specified in the test file instead of
specify it in the running command.

Now we can write test for rtcBot that run one bot on chrome for android
and the other bot on chrome for desktop.

R=andresp@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/23069004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7458 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
houssainy@google.com
2014-10-15 15:01:11 +00:00
parent e93cbd13d5
commit 3e2f8ff36c
6 changed files with 53 additions and 22 deletions

View File

@ -25,10 +25,10 @@ function getUserMedia(constraints, onSuccessCallback, onFailCallback){
}
}
function createPeerConnection(doneCallback, failCallback) {
function createPeerConnection(config, doneCallback, failCallback) {
console.log("Creating peer connection");
var obj = {};
var pc = new webkitRTCPeerConnection(null);
var pc = new webkitRTCPeerConnection(config);
expose(obj, pc, "close");
expose(obj, pc, "createOffer");
@ -113,9 +113,38 @@ function getStreamFromIdentifier_(id) {
return null;
};
// Ask computeengineondemand to give us TURN server credentials and URIs.
function asyncCreateTurnConfig(onSuccess, onError) {
var CEOD_URL = ('https://computeengineondemand.appspot.com/turn?' +
'username=1234&key=5678');
var xhr = new XMLHttpRequest();
function onResult() {
if (xhr.readyState != 4)
return;
if (xhr.status != 200) {
onError('TURN request failed');
return;
}
var response = JSON.parse(xhr.responseText);
var iceServer = {
'username': response.username,
'credential': response.password,
'urls': response.uris
};
onSuccess({ 'iceServers': [ iceServer ] });
}
xhr.onreadystatechange = onResult;
xhr.open('GET', CEOD_URL, true);
xhr.send();
};
connectToServer({
ping: ping,
getUserMedia: getUserMedia,
createPeerConnection: createPeerConnection,
showStream: showStream,
asyncCreateTurnConfig: asyncCreateTurnConfig,
});