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

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-playback-two-videos.html

Issue 1463763002: Add event name to bare removeEventListener(listener) calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Clear Key Play Two Videos At Same Time</title> 4 <title>Clear Key Play Two Videos At Same Time</title>
5 <script src="encrypted-media-utils.js"></script> 5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <video id="testVideo"></video> 10 <video id="testVideo"></video>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 { 46 {
47 var encryptedEventCount = 0; 47 var encryptedEventCount = 0;
48 return new Promise(function(resolve) { 48 return new Promise(function(resolve) {
49 video.addEventListener('encrypted', function listener(e) { 49 video.addEventListener('encrypted', function listener(e) {
50 // The same decryption key is used by both the audio 50 // The same decryption key is used by both the audio
51 // and the video streams so only create a session once. 51 // and the video streams so only create a session once.
52 // Create the session on the second event. This also 52 // Create the session on the second event. This also
53 // ensures we see both events. 53 // ensures we see both events.
54 if (++encryptedEventCount != 2) 54 if (++encryptedEventCount != 2)
55 return; 55 return;
56 video.removeEventListener(listener); 56 video.removeEventListener('encrypted', listener);
57 57
58 var mediaKeySession = video.mediaKeys.createSession(); 58 var mediaKeySession = video.mediaKeys.createSession();
59 mediaKeySession.generateRequest(e.initDataType, e.initDa ta).then(function(result) { 59 mediaKeySession.generateRequest(e.initDataType, e.initDa ta).then(function(result) {
60 // Don't bother waiting for the 'message' event. 60 // Don't bother waiting for the 'message' event.
61 // Just call update() since we know the keyId 61 // Just call update() since we know the keyId
62 // needed. 62 // needed.
63 var jwkSet = stringToUint8Array(createJWKSet(createJ WK(keyId, rawKey))); 63 var jwkSet = stringToUint8Array(createJWKSet(createJ WK(keyId, rawKey)));
64 return mediaKeySession.update(jwkSet); 64 return mediaKeySession.update(jwkSet);
65 }).then(function(result) { 65 }).then(function(result) {
66 resolve(result); 66 resolve(result);
67 }); 67 });
68 }); 68 });
69 }); 69 });
70 }; 70 };
71 71
72 function wait_for_timeupdate_message(video) 72 function wait_for_timeupdate_message(video)
73 { 73 {
74 return new Promise(function(resolve) { 74 return new Promise(function(resolve) {
75 video.addEventListener('timeupdate', function listener(e) { 75 video.addEventListener('timeupdate', function listener(e) {
76 if (e.target.currentTime < 0.2) 76 if (e.target.currentTime < 0.2)
77 return; 77 return;
78 video.removeEventListener(listener); 78 video.removeEventListener('timeupdate', listener);
79 resolve(e); 79 resolve(e);
80 }); 80 });
81 }); 81 });
82 }; 82 };
83 </script> 83 </script>
84 </body> 84 </body>
85 </html> 85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698