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..dbb764959f98693fc59ae5ff41411c4976cd8e92 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; |
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; |
} |
@@ -227,8 +228,10 @@ Utils.sendRequest = function(requestType, responseType, message, serverURL, |
xmlhttp.responseType = responseType; |
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('Request error: ' + this.statusText); |
+ Utils.timeLog('Retrying request if possible in ' + |
+ REQUEST_RETRY_DELAY_MS + 'ms'); |
sandersd (OOO until July 31)
2014/10/01 17:46:12
statusText is typically uninformative (it's probab
jrummell
2014/10/01 20:49:07
Done.
|
+ setTimeout(sendRequestAttempt, REQUEST_RETRY_DELAY_MS); |
}; |
xmlhttp.onload = function(e) { |
if (this.status == 200) { |
@@ -242,6 +245,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('Attempt (' + requestAttemptCount + ') timeout'); |
sandersd (OOO until July 31)
2014/10/01 17:46:11
It would be good to format the three kinds of fail
jrummell
2014/10/01 20:49:07
Done.
|
+ 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); |