summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorhoussainy@google.com <houssainy@google.com>2014-10-22 16:34:25 +0000
committerhoussainy@google.com <houssainy@google.com>2014-10-22 16:34:25 +0000
commitcd3135ae5162f84867296f22322f497eb2846d1b (patch)
tree73c3bc651d0721a43ef34578ac5758ce95547d1a /tools
parent1c079a9f1734f8318e655b85328cc02efb470ea5 (diff)
downloadwebrtc-cd3135ae5162f84867296f22322f497eb2846d1b.tar.gz
HTTPS Server used instead of HTTP for loading the bots to avoid the media permission pop-up clicks every time running the test.
This code review based on the running issue: https://webrtc-codereview.appspot.com/24939004/ R=andresp@webrtc.org Review URL: https://webrtc-codereview.appspot.com/27769004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7497 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'tools')
-rw-r--r--tools/rtcbot/README14
-rw-r--r--tools/rtcbot/bot/api.js2
-rw-r--r--tools/rtcbot/botmanager.js19
3 files changed, 27 insertions, 8 deletions
diff --git a/tools/rtcbot/README b/tools/rtcbot/README
index bfa981c5..1f4d7c11 100644
--- a/tools/rtcbot/README
+++ b/tools/rtcbot/README
@@ -17,8 +17,18 @@ access its exposed API. Details are in botmanager.js.
== How to run the test ==
$ cd trunk/webrtc/tool/rtcbot
$ npm install express browserify ws websocket-stream dnode
+ $ mkdir configurations
+ $ cd configurations
+ $ openssl genrsa -out priv.pem 1024
+ $ openssl req -x509 -new -key priv.pem -days 3650 -out cert.crt
+ $ cd trunk/webrtc/tool/rtcbot
$ node main.js "<test_name>"
+* Note:
+ In first time you will use rtcBot you will receive a warning telling
+ you that your connection is not private. Just avoid this warning and
+ click Proceed to localhost (unsafe).
+
== How can I see the list of available tests? ==
$ node main.js
@@ -29,6 +39,10 @@ access its exposed API. Details are in botmanager.js.
$ nvm install 0.10
$ nvm use 0.10
+== Why generating the private key and self signed certificate? ==
+ - Private key and certificate are used for creating HTTPs server in
+ rtcBot for loading the required files on the different types of the bots.
+
== Supported Bot Types ==
- "chrome": chrome on host machine.
- "android-chrome": chrome on android device. Details in "Android" Section.
diff --git a/tools/rtcbot/bot/api.js b/tools/rtcbot/bot/api.js
index b51d49df..7e1a436e 100644
--- a/tools/rtcbot/bot/api.js
+++ b/tools/rtcbot/bot/api.js
@@ -15,7 +15,7 @@ var WebSocketStream = require('websocket-stream');
var Dnode = require('dnode');
function connectToServer(api) {
- var stream = new WebSocketStream("ws://127.0.0.1:8080/");
+ var stream = new WebSocketStream("wss://localhost:8080/");
var dnode = new Dnode(api);
dnode.on('error', function (error) { console.log(error); });
dnode.pipe(stream).pipe(dnode);
diff --git a/tools/rtcbot/botmanager.js b/tools/rtcbot/botmanager.js
index cd88f19f..5b325bd8 100644
--- a/tools/rtcbot/botmanager.js
+++ b/tools/rtcbot/botmanager.js
@@ -8,7 +8,8 @@
//
// botmanager.js module allows a test to spawn bots that expose an RPC API
// to be controlled by tests.
-var http = require('http');
+var https = require('https');
+var fs = require('fs');
var child = require('child_process');
var Browserify = require('browserify');
var Dnode = require('dnode');
@@ -16,7 +17,7 @@ var Express = require('express');
var WebSocketServer = require('ws').Server;
var WebSocketStream = require('websocket-stream');
-// BotManager runs a HttpServer that serves bots assets and and WebSocketServer
+// BotManager runs a HttpsServer that serves bots assets and and WebSocketServer
// that listens to incoming connections. Once a connection is available it
// connects it to bots pending endpoints.
//
@@ -66,7 +67,11 @@ BotManager.prototype = {
this.app_.use('/bot/', Express.static(__dirname + '/bot'));
- this.server_ = http.createServer(this.app_);
+ var options = options = {
+ key: fs.readFileSync('configurations/priv.pem', 'utf8'),
+ cert: fs.readFileSync('configurations/cert.crt', 'utf8')
+ };
+ this.server_ = https.createServer(options, this.app_);
this.webSocketServer_ = new WebSocketServer({ server: this.server_ });
this.webSocketServer_.on('connection', this.onConnection_.bind(this));
@@ -116,7 +121,7 @@ Bot.prototype = {
}
}
-// BrowserBot spawns a process to open "http://localhost:8080/bot/browser".
+// BrowserBot spawns a process to open "https://localhost:8080/bot/browser".
//
// That page once loaded, connects to the websocket server run by BotManager
// and exposes the bot api.
@@ -128,14 +133,14 @@ BrowserBot = function (name, callback) {
BrowserBot.prototype = {
spawnBotProcess_: function () {
this.log('Spawning browser');
- child.exec('google-chrome "http://localhost:8080/bot/browser/"');
+ child.exec('google-chrome "https://localhost:8080/bot/browser/"');
},
__proto__: Bot.prototype
}
// AndroidChromeBot spawns a process to open
-// "http://localhost:8080/bot/browser/" on chrome for Android.
+// "https://localhost:8080/bot/browser/" on chrome for Android.
AndroidChromeBot = function (name, androidDeviceManager, callback) {
Bot.call(this, name, callback);
androidDeviceManager.getNewDevice(function (serialNumber) {
@@ -149,7 +154,7 @@ AndroidChromeBot.prototype = {
this.log('Spawning Android device with serial ' + this.serialNumber_);
var runChrome = 'adb -s ' + this.serialNumber_ + ' shell am start ' +
'-n com.android.chrome/com.google.android.apps.chrome.Main ' +
- '-d http://localhost:8080/bot/browser/';
+ '-d https://localhost:8080/bot/browser/';
child.exec(runChrome, function (error, stdout, stderr) {
if (error) {
this.log(error);