Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Unified Diff: media/test/data/eme_player_js/utils.js

Issue 614423002: Retry license request on timeouts and errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change log messages Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698