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

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-onencrypted.html

Issue 2270383002: clean up encrypted-media tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>onencrypted</title> 4 <title>onencrypted</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" controls></video> 10 <video></video>
11 <div id="log"></div>
12 <script> 11 <script>
13 var expectedInitData = stringToUint8Array('0123456789012345'); 12 var expectedInitData = stringToUint8Array('0123456789012345');
14 13
15 // Will get 2 identical events, one for audio, one for video. 14 // Will get 2 identical events, one for audio, one for video.
16 var expectedEvents = 2; 15 var expectedEvents = 2;
17 16
18 async_test(function(test) 17 async_test(function(test)
19 { 18 {
20 var video = document.getElementById('testVideo'); 19 var video = document.querySelector('video');
21 var content = '../content/test-encrypted.webm'; 20 var content = '../content/test-encrypted.webm';
22 21
23 var onEncrypted = function(event) 22 var onEncrypted = function(event)
24 { 23 {
25 assert_equals(event.target, video); 24 assert_equals(event.target, video);
26 assert_true(event instanceof window.MediaEncryptedEvent); 25 assert_true(event instanceof window.MediaEncryptedEvent);
27 assert_equals(event.type, 'encrypted'); 26 assert_equals(event.type, 'encrypted');
28 assert_equals(event.initDataType, 'webm'); 27 assert_equals(event.initDataType, 'webm');
29 assert_array_equals(new Uint8Array(event.initData), expected InitData); 28 assert_array_equals(new Uint8Array(event.initData), expected InitData);
30 29
31 if (--expectedEvents == 0) 30 if (--expectedEvents == 0)
32 test.done(); 31 test.done();
33 }; 32 };
34 33
35 waitForEventAndRunStep('encrypted', video, onEncrypted, test); 34 waitForEventAndRunStep('encrypted', video, onEncrypted, test);
36 video.src = content; 35 video.src = content;
37 }, 'encrypted fired on encrypted media file.'); 36 }, 'encrypted fired on encrypted media file.');
38 </script> 37 </script>
39 </body> 38 </body>
40 </html> 39 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698