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 fb1e83aebac60d91b984f3c5d14db3e5908c47c3..6285c3f0791389a695df0bf6497abad94b2b6a72 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 |
@@ -1001,6 +1001,45 @@ |
}); |
}, 'Test MediaKeys setServerCertificate().'); |
+ function test_valid_message_type(message_type) |
+ { |
+ var event = new MediaKeyMessageEvent('eventType', { messageType: message_type, message: new ArrayBuffer(0) } ); |
+ assert_equals(message_type, event.messageType); |
foolip
2016/09/21 08:32:07
testharness.js uses the order actual, expected, so
jrummell
2016/09/22 20:12:24
Done.
|
+ } |
+ |
+ async_test(function(test) |
+ { |
+ // Valid MediaKeyMessageType values. |
+ test_valid_message_type('license-request'); |
+ test_valid_message_type('license-renewal'); |
+ test_valid_message_type('license-release'); |
+ // TODO(jrummell): Add 'individualization-request' if the final |
+ // spec includes it. http://crbug.com/628437. |
+ |
+ // Invalid MediaKeyMessageType values should throw a TypeError. |
foolip
2016/09/21 08:32:07
assert_throws(new TypeError, function() {
new Me
jrummell
2016/09/22 20:12:24
Done.
|
+ try { |
+ var event = new MediaKeyMessageEvent('eventType', { messageType: 'something-else', message: new ArrayBuffer(0) } ); |
+ assert_unreached('MediaKeyMessageEvent with invalid messageType should not be created.'); |
+ } catch (error) { |
+ assert_equals('TypeError', error.name); |
+ } |
+ |
+ // Missing required values should throw a TypeError. |
foolip
2016/09/21 08:32:07
assert_throws for these too.
jrummell
2016/09/22 20:12:24
Done.
|
+ try { |
+ var event = new MediaKeyMessageEvent('eventType', { message: new ArrayBuffer(0) } ); |
+ assert_unreached('MediaKeyMessageEvent with missing messageType should not be created.'); |
+ } catch (error) { |
+ assert_equals('TypeError', error.name); |
+ } |
+ try { |
+ var event = new MediaKeyMessageEvent('eventType', { messageType: 'license-request' } ); |
+ assert_unreached('MediaKeyMessageEvent with missing message should not be created.'); |
+ } catch (error) { |
+ assert_equals('TypeError', error.name); |
+ } |
+ |
+ test.done(); |
foolip
2016/09/21 08:32:07
This can be a sync test if you drop this and just
jrummell
2016/09/22 20:12:24
Done. Was just copying the pattern used for the ot
|
+ }, 'Test MediaKeyMessageEvent.'); |
// FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). |
// FIXME: Add syntax checks for MediaKeyError and MediaKeySession events. |