Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

next() is aware of the Hub's mountpoint.

  • Loading branch information...
commit 1e6a5d4888f3e03049319cee7535f96b0e9541ed 1 parent f2eb862
@reid reid authored
View
11 lib/hub/agent.js
@@ -9,7 +9,9 @@ var parseUA = require("./ua");
// TODO: Periodic GC of missing Agents.
// var periodic = require("./periodic");
-function Agent(registration) {
+function Agent(manager, registration) {
+ this.manager = manager;
+
this.id = registration.id;
this.ua = registration.ua;
@@ -80,7 +82,7 @@ Agent.prototype.next = function () {
this.waiting = false;
} else {
this.waiting = true;
- this.socketEmitter.emit("complete");
+ this.socketEmitter.emit("test", this.manager.hub.mountpoint);
this.emit("complete");
}
@@ -106,7 +108,8 @@ Agent.prototype.alive = function () {
(!this.waiting && ((Date.now() - this.seen) > 3600));
};
-function AgentManager() {
+function AgentManager(hub) {
+ this.hub = hub;
this.agents = {};
EventEmitter2.call(this, {
verbose: true
@@ -143,7 +146,7 @@ AgentManager.prototype.connectAgent = function (id, ua, socket) {
agent.connect(socket);
} else {
firstConnect = true;
- agent = self.agents[id] = new Agent({
+ agent = self.agents[id] = new Agent(self, {
id: id,
ua: ua,
socket: socket
View
12 lib/hub/batch.js
@@ -25,7 +25,11 @@ function Batch(manager, id, session, tests, useProxy) {
this.useProxy = useProxy;
this.agentManager = manager.agentManager;
- var mountpoint = manager.hub.mountpoint || "";
+ var mountpoint = manager.hub.mountpoint;
+
+ if (mountpoint === "/") {
+ mountpoint = "";
+ }
this.testServer = new TestServer(
'<script src="' + mountpoint + '/socket.io/socket.io.js"></script>' +
@@ -116,12 +120,12 @@ Batch.prototype.dispatch = function () {
urls = [],
self = this;
- if (!mountpoint) {
+ this.manager.lockAgents(this.id, agents);
+
+ if (mountpoint === "/") {
mountpoint = "";
}
- this.manager.lockAgents(this.id, agents);
-
if (self.useProxy) {
self.tests.forEach(function (test) {
urls.push(mountpoint + "/batch/" + self.id + "/test/" + test);
View
4 lib/hub/index.js
@@ -57,10 +57,12 @@ var Hub = module.exports = function Hub(options) {
this.io.of("/run").on("connection", this._onRunConnection.bind(this));
this.io.sockets.on("connection", this._onGlobalConnection.bind(this));
- this.agentManager = new AgentManager();
+ this.agentManager = new AgentManager(this);
this.batchManager = new BatchManager(this);
this._setupEvents();
+
+ this.mountpoint = "/";
};
util.inherits(Hub, EventEmitter2);
View
2  lib/hub/view/public/capture.js
@@ -1,6 +1,6 @@
var Yeti = {
capture: function (resource) {
- if (!resource) {
+ if (resource === "/") {
resource = "";
}
resource += "/socket.io";
View
5 lib/hub/view/public/inject.js
@@ -42,11 +42,6 @@ function $yetify(firstRunConfiguration) {
document.location.href = test;
});
- // TODO Throttle test navigation for Opera and slow mobile devices.
- socket.on("complete", function () {
- document.location.href = config.mountpoint;
- });
-
socket.json.emit("register", {
agentId: getCookie("yeti-agent"),
});
Please sign in to comment.
Something went wrong with that request. Please try again.