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

Unified Diff: LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html

Issue 658633002: Update EME playback-multiple-sessions test to avoid flakiness (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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: LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
diff --git a/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html b/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
index 7c3335f9c30307fabf89166d5e65b4d62b20cfb0..acbc52181f037db60e1660de20aedfb4dec1cce5 100644
--- a/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
+++ b/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
@@ -16,6 +16,10 @@
var video = document.getElementById('testVideo');
var audioMediaKeySession = null;
var videoMediaKeySession = null;
+ var audioInitDataType = null;
+ var videoInitDataType = null;
+ var audioInitData = null;
+ var videoInitData = null;
var audioKeyProvided = false;
var videoKeyProvided = false;
@@ -32,17 +36,40 @@
var keyId = String.fromCharCode.apply(null, new Uint8Array(event.initData));
var mediaKeySession = video.mediaKeys.createSession();
- waitForEventAndRunStep('message', mediaKeySession, onMessage, test);
- mediaKeySession.generateRequest(event.initDataType, event.initData).then(function() {
- if (keyId == videoKeyId) {
- assert_equals(videoMediaKeySession, null);
- videoMediaKeySession = mediaKeySession;
- } else {
- assert_equals(keyId, audioKeyId);
- assert_equals(audioMediaKeySession, null);
- audioMediaKeySession = mediaKeySession;
- }
- }).catch(function(error) {
+ if (keyId == videoKeyId) {
+ assert_equals(videoMediaKeySession, null);
+ videoMediaKeySession = mediaKeySession;
+ videoInitDataType = event.initDataType;
+ videoInitData = event.initData;
+ // Return if audio "onencrypted" event not yet received.
+ if (audioMediaKeySession == null)
+ return;
+ } else {
+ assert_equals(keyId, audioKeyId);
+ assert_equals(audioMediaKeySession, null);
+ audioMediaKeySession = mediaKeySession;
+ audioInitDataType = event.initDataType;
+ audioInitData = event.initData;
+ // Return if video "onencrypted" event not yet received.
+ if (videoMediaKeySession == null)
+ return;
+ }
+
+ // Both sessions have been created. Process both audio and
+ // video generateRequests() at the same time (prevents a
+ // "message" event from occurring before both "onencrypted"
ddorwin 2014/10/16 16:14:32 nit: This comment would probably be better before
jrummell 2014/10/16 17:42:56 Done.
+ // events are received).
ddorwin 2014/10/16 16:14:32 Include the reason: expected text
jrummell 2014/10/16 17:42:56 Done.
+ assert_not_equals(videoMediaKeySession, null);
+ assert_not_equals(audioMediaKeySession, null);
+
+ var promises = [];
+ waitForEventAndRunStep('message', videoMediaKeySession, onMessage, test);
+ promises.push(videoMediaKeySession.generateRequest(videoInitDataType, videoInitData));
+
+ waitForEventAndRunStep('message', audioMediaKeySession, onMessage, test);
+ promises.push(audioMediaKeySession.generateRequest(audioInitDataType, audioInitData));
+
+ Promise.all(promises).catch(function(error) {
forceTestFailureFromPromise(test, error);
});
}
« 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