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
diff --git a/webrtc/tools/rtcbot/test.js b/webrtc/tools/rtcbot/test.js
index 785d5e8..e117398 100644
--- a/webrtc/tools/rtcbot/test.js
+++ b/webrtc/tools/rtcbot/test.js
@@ -16,11 +16,10 @@
var vm = require('vm');
var BotManager = require('./botmanager.js');
-function Test(botType) {
+function Test() {
this.timeout_ = setTimeout(
this.fail.bind(this, "Test timeout!"),
100000);
- this.botType_ = botType;
}
Test.prototype = {
@@ -67,11 +66,11 @@
}
},
- spawnBot: function (name, doneCallback) {
+ spawnBot: function (name, botType, doneCallback) {
// Lazy initialization of botmanager.
if (!this.botManager_)
this.botManager_ = new BotManager();
- this.botManager_.spawnNewBot(name, this.botType_, doneCallback);
+ this.botManager_.spawnNewBot(name, botType, doneCallback);
},
createStatisticsReport: function (outputFileName) {
@@ -137,11 +136,11 @@
},
}
-function runTest(botType, testfile) {
+function runTest(testfile) {
console.log("Running test: " + testfile);
var script = vm.createScript(fs.readFileSync(testfile), testfile);
- script.runInNewContext({ test: new Test(botType), setInterval: setInterval,
+ script.runInNewContext({ test: new Test(), setInterval: setInterval,
setTimeout: setTimeout });
}
-runTest(process.argv[2], process.argv[3]);
+runTest(process.argv[2]);