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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-v2-syntax.html

Issue 641433002: Implement MediaKeySession.load() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize variable for Windows 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/modules/encryptedmedia/MediaKeySession.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test EME syntax</title> 4 <title>Test EME syntax</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 <div id="log"></div> 10 <div id="log"></div>
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 assert_not_equals(sessionPromises.length, 0); 317 assert_not_equals(sessionPromises.length, 0);
318 return Promise.all(sessionPromises); 318 return Promise.all(sessionPromises);
319 }).then(function(result) { 319 }).then(function(result) {
320 test.done(); 320 test.done();
321 }).catch(function(error) { 321 }).catch(function(error) {
322 forceTestFailureFromPromise(test, error, 'generateRequest() tests failed'); 322 forceTestFailureFromPromise(test, error, 'generateRequest() tests failed');
323 }); 323 });
324 }, 'Test MediaKeys generateRequest() exceptions.'); 324 }, 'Test MediaKeys generateRequest() exceptions.');
325 325
326 var kLoadExceptionsTestCases = [
327 // Too few parameters.
328 {
329 exception: 'TypeError',
330 func: function(mk1) { return mk1.createSession('temporary'). load(); }
331 },
332 {
333 exception: 'TypeError',
334 func: function(mk2) { return mk2.createSession('persistent') .load(); }
335 },
336 // Invalid parameters.
337 // 'temporary' sessions are never allowed, so always return
338 // 'InvalidAccessError'. For 'persistent' sessions, JS calls
339 // .toString() on the parameter if it is not already a string
340 // before passing it to code. So tests like mk6 or mk8 pass in
341 // "null" or "undefined" as the sessionId.
342 {
343 exception: 'InvalidAccessError',
344 func: function(mk3) { return mk3.createSession('temporary'). load(''); }
345 },
346 {
347 exception: 'InvalidAccessError',
348 func: function(mk4) { return mk4.createSession('persistent') .load(''); }
349 },
350 {
351 exception: 'InvalidAccessError',
352 func: function(mk5) { return mk5.createSession('temporary'). load(null); }
353 },
354 {
355 exception: 'NotSupportedError',
356 func: function(mk6) { return mk6.createSession('persistent') .load(null); }
357 },
358 {
359 exception: 'InvalidAccessError',
360 func: function(mk7) { return mk7.createSession('temporary'). load(undefined); }
361 },
362 {
363 exception: 'NotSupportedError',
364 func: function(mk8) { return mk8.createSession('persistent') .load(undefined); }
365 },
366 {
367 exception: 'InvalidAccessError',
368 func: function(mk9) { return mk9.createSession('temporary'). load(1); }
369 },
370 {
371 exception: 'NotSupportedError',
372 func: function(mk10) { return mk10.createSession('persistent ').load(1); }
373 },
374 {
375 exception: 'InvalidAccessError',
376 func: function(mk11) { return mk11.createSession('temporary' ).load(new Uint8Array(0)); }
377 },
378 {
379 exception: 'InvalidAccessError',
380 func: function(mk12) { return mk12.createSession('persistent ').load(new Uint8Array(0)); }
381 },
382 // Invalid session id.
383 {
384 exception: 'InvalidAccessError',
385 func: function(mk13) { return mk13.createSession('temporary' ).load('!@#$%^&*()'); }
386 },
387 {
388 exception: 'InvalidAccessError',
389 func: function(mk14) { return mk14.createSession('persistent ').load('!@#$%^&*()'); }
390 },
391 // Valid session id (but not supported by ClearKey).
392 {
393 exception: 'InvalidAccessError',
394 func: function(mk15) { return mk15.createSession('temporary' ).load('1234'); }
395 },
396 {
397 exception: 'NotSupportedError',
398 func: function(mk16) { return mk16.createSession('persistent ').load('1234'); }
399 }
400 ];
401
402 async_test(function(test)
403 {
404 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) {
405 // FIXME: Remove "video/" from the calls to isTypeSupported( ) once it is updated.
406 // http://crbug.com/405731.
407 var initData = stringToUint8Array('init data');
408 var sessionPromises = kLoadExceptionsTestCases.map(function( testCase) {
409 return test_exception(testCase, mediaKeys);
410 });
411
412 assert_not_equals(sessionPromises.length, 0);
413 return Promise.all(sessionPromises);
414 }).then(function(result) {
415 test.done();
416 }).catch(function(error) {
417 forceTestFailureFromPromise(test, error, 'load() tests faile d');
418 });
419 }, 'Test MediaKeys load() exceptions.');
420
326 // All calls to |func| in this group are supposed to succeed. 421 // All calls to |func| in this group are supposed to succeed.
327 // However, the spec notes that some things are optional for 422 // However, the spec notes that some things are optional for
328 // Clear Key. In particular, support for persistent sessions 423 // Clear Key. In particular, support for persistent sessions
329 // is optional. Since some implementations won't support some 424 // is optional. Since some implementations won't support some
330 // features, a NotSupportedError is treated as a success 425 // features, a NotSupportedError is treated as a success
331 // if |isNotSupportedAllowed| is true. 426 // if |isNotSupportedAllowed| is true.
332 var kCreateSessionTestCases = [ 427 var kCreateSessionTestCases = [
333 // Use the default sessionType. 428 // Use the default sessionType.
334 { 429 {
335 func: function(mk) { return mk.createSession(); }, 430 func: function(mk) { return mk.createSession(); },
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 872
778 // FIXME: Add test for successful setServerCertificate(). Note that 873 // FIXME: Add test for successful setServerCertificate(). Note that
779 // ClearKey does not support it. 874 // ClearKey does not support it.
780 875
781 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). 876 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported().
782 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev ents. 877 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev ents.
783 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med iakeys, onencrypted. 878 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med iakeys, onencrypted.
784 </script> 879 </script>
785 </body> 880 </body>
786 </html> 881 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/modules/encryptedmedia/MediaKeySession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698