Test Latency with callback to jam client working now.

This commit is contained in:
Jonathon Wilson 2012-12-08 13:14:00 -07:00
parent b4fcd0fdee
commit 7b78ec225b
3 changed files with 7 additions and 7 deletions

View File

@ -8,11 +8,12 @@
logger.info("*** Fake JamClient instance initialized. ***");
function testLatency(client, callbackFunctionName) {
logger.debug("Fake JamClient: testLatency called with client, " + client + " and callback function name: " + callbackFunctionName);
var response = {
id: client.id,
latency: 50
};
var js = callbackFunctionName + "(" + response + ");";
var js = callbackFunctionName + "(" + JSON.stringify(response) + ");";
eval(js);
}

View File

@ -76,14 +76,13 @@
function testLatencyHandler(evt) {
var clientId = $(selectors.testLatency + ' input[type="text"]').val();
logger.debug('testLatencyHandler: clientId: ' + clientId);
logger.debug('TODO: need to change TestLatency to accept string function name');
// TODO: Change 2nd param to string like below. Update fakeJamClient
// and any tests that break to take a string naming the function to call.
//context.jamClient.TestLatency(clientId, 'JK.TestBridgeLatencyResponse');
logger.debug('testBridge Screen: testLatencyHandler: clientId: ' + clientId);
var jsFunction = "JK.TestBridgeLatencyResponse";
context.jamClient.TestLatency(clientId, jsFunction);
}
function latencyResponse(response) {
logger.debug("latencyResponse, called from jamClient: " + response);
var latency = response.latency;
$(selectors.testLatencyResponse).html(latency);
}

View File

@ -19,7 +19,7 @@
<input type="button" value="Join!"/>
</label>
</div>
<div id="testBridge-TestLatency">
<div id="testBridge-TestLatency" style="clear:both;">
<h2>TestLatency</h2>
<label>Client ID (to ping)
<input type="text" style="width:300px"/>