Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-syntax.html |
| diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-syntax.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-syntax.html |
| index 76b536846fa1668da4011cae130a87890a85cb12..6ca6b01fbd8ff92954b44e80a6ca42d67c119bca 100644 |
| --- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-syntax.html |
| +++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-syntax.html |
| @@ -936,16 +936,6 @@ |
| { |
| exception: 'InvalidAccessError', |
| func: function(mk) { return mk.setServerCertificate(new Uint8Array(0)); } |
| - }, |
| - // Valid calls, but not supported by Clear Key. |
| - { |
| - exception: 'NotSupportedError', |
| - func: function(mk) { var cert = new Uint8Array(200); assert_true(ArrayBuffer.isView(cert)); return mk.setServerCertificate(cert); } |
| - }, |
| - { |
| - // Pass in ArrayBuffer |
| - exception: 'NotSupportedError', |
| - func: function(mk) { var cert = new Uint8Array(200); assert_false(ArrayBuffer.isView(cert.buffer)); return mk.setServerCertificate(cert.buffer); } |
| } |
| ]; |
| @@ -967,8 +957,53 @@ |
| }); |
| }, 'Test MediaKeys setServerCertificate() exceptions.'); |
| - // FIXME: Add test for successful setServerCertificate(). Note that |
| - // Clear Key does not support it. |
| + // All calls to |func| in this group are expected to resolve. |
| + var kSetServerCertificateTestCases = [ |
| + { |
| + // Pass in ArrayBufferView |
| + func: function(mk) { |
| + var cert = new Uint8Array(200); |
| + assert_true(ArrayBuffer.isView(cert)); |
| + return mk.setServerCertificate(cert); |
| + } |
| + }, |
| + { |
| + // Pass in ArrayBuffer |
| + func: function(mk) { |
| + var cert = new Uint8Array(200); |
| + assert_false(ArrayBuffer.isView(cert.buffer)); |
|
ddorwin
2016/06/13 17:28:09
What does isView() of the buffer tell us? Aren't w
jrummell
2016/06/13 18:54:13
isView() tells us that cert.buffer is not an Array
|
| + return mk.setServerCertificate(cert.buffer); |
| + } |
| + } |
| + ]; |
| + |
| + function test_setServerCertificate(testCase, mediaKeys) |
| + { |
| + // As Clear Key does not support setServerCertificate(), |
| + // successful calls should return false. |
| + return testCase.func.call(null, mediaKeys).then(function(result) { |
| + assert_false(result); |
| + }); |
| + } |
| + |
| + async_test(function(test) |
| + { |
| + navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) { |
|
ddorwin
2016/06/13 17:28:09
FYI, an empty configuration is no longer allowed b
jrummell
2016/06/13 18:54:13
Acknowledged. I'll do a subsequent CL to handle th
|
| + return access.createMediaKeys(); |
| + }).then(function(mediaKeys) { |
| + var promises = kSetServerCertificateTestCases.map(function(testCase) { |
| + return test_setServerCertificate(testCase, mediaKeys); |
| + }); |
| + |
| + assert_not_equals(promises.length, 0); |
| + return Promise.all(promises); |
| + }).then(function(result) { |
| + test.done(); |
|
ddorwin
2016/06/13 17:28:09
We don't check the result. What is the result for
jrummell
2016/06/13 18:54:13
It returns an array of the results from each promi
|
| + }).catch(function(error) { |
| + forceTestFailureFromPromise(test, error, 'setServerCertificate() test failed'); |
| + }); |
| + }, 'Test MediaKeys setServerCertificate().'); |
| + |
| // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). |
| // FIXME: Add syntax checks for MediaKeyError and MediaKeySession events. |