Index: media/test/data/eme_player_js/utils.js |
diff --git a/media/test/data/eme_player_js/utils.js b/media/test/data/eme_player_js/utils.js |
index b7d2d6d4f03d58eee5f8e45bbca7c1e612baad80..8b76ff3609072f2b689eade1e5913aaf765fbd43 100644 |
--- a/media/test/data/eme_player_js/utils.js |
+++ b/media/test/data/eme_player_js/utils.js |
@@ -216,10 +216,11 @@ Utils.sendRequest = function(requestType, responseType, message, serverURL, |
var requestAttemptCount = 0; |
var MAXIMUM_REQUEST_ATTEMPTS = 3; |
ddorwin
2014/10/01 21:00:29
If we're seeing this sometimes requiring 3 locally
jrummell
2014/10/01 21:28:34
Removed this so we try until the framework decides
|
var REQUEST_RETRY_DELAY_MS = 3000; |
+ var REQUEST_TIMEOUT_MS = 1000; |
function sendRequestAttempt() { |
requestAttemptCount++; |
- if (requestAttemptCount == MAXIMUM_REQUEST_ATTEMPTS) { |
+ if (requestAttemptCount > MAXIMUM_REQUEST_ATTEMPTS) { |
Utils.failTest('FAILED: Exceeded maximum license request attempts.'); |
return; |
} |
@@ -228,7 +229,10 @@ Utils.sendRequest = function(requestType, responseType, message, serverURL, |
xmlhttp.open(requestType, serverURL, true); |
xmlhttp.onerror = function(e) { |
Utils.timeLog('Request status: ' + this.statusText); |
- Utils.failTest('FAILED: License request XHR failed with network error.'); |
+ Utils.timeLog('FAILED: License request XHR failed with network error.'); |
+ Utils.timeLog('Retrying request if possible in ' + |
+ REQUEST_RETRY_DELAY_MS + 'ms'); |
+ setTimeout(sendRequestAttempt, REQUEST_RETRY_DELAY_MS); |
ddorwin
2014/10/01 21:00:28
Why do we wait? Is there an advantage to fewer ret
jrummell
2014/10/01 21:28:34
In this case the license server isn't up, so we mi
|
}; |
xmlhttp.onload = function(e) { |
if (this.status == 200) { |
@@ -242,6 +246,13 @@ Utils.sendRequest = function(requestType, responseType, message, serverURL, |
setTimeout(sendRequestAttempt, REQUEST_RETRY_DELAY_MS); |
} |
}; |
+ xmlhttp.timeout = REQUEST_TIMEOUT_MS; |
+ xmlhttp.ontimeout = function(e) { |
+ Utils.timeLog('Request timeout'); |
+ Utils.timeLog('Retrying request if possible in ' + |
+ REQUEST_RETRY_DELAY_MS + 'ms'); |
+ setTimeout(sendRequestAttempt, REQUEST_RETRY_DELAY_MS); |
+ } |
Utils.timeLog('Attempt (' + requestAttemptCount + |
'): sending request to server: ' + serverURL); |
xmlhttp.send(message); |