<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test the WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent constructors.");

evalAndLog('event = new WebKitMediaKeyMessageEvent("foo")');
shouldBeEqualToString("event.type", "foo");
shouldBeFalse("event.bubbles");
shouldBeFalse("event.cancelable");
shouldBeNull("event.message");
shouldBeEqualToString("event.destinationURL", "");
debug("");

var testMessage = new Uint8Array(8);
evalAndLog('event = new WebKitMediaKeyMessageEvent("foo", { bubbles: true, cancelable: true, message: testMessage, destinationURL: "testURL" })');
shouldBeEqualToString("event.type", "foo");
shouldBeTrue("event.bubbles");
shouldBeTrue("event.cancelable");
shouldBe("event.message", "testMessage");
shouldBeEqualToString("event.destinationURL", "testURL");
debug("");

evalAndLog('event = new WebKitMediaKeyNeededEvent("foo")');
shouldBeEqualToString("event.type", "foo");
shouldBeFalse("event.bubbles");
shouldBeFalse("event.cancelable");
shouldBeNull("event.initData");
debug("");

evalAndLog('event = new WebKitMediaKeyNeededEvent("foo", { bubbles: true, cancelable: true, initData: testMessage })');
shouldBeEqualToString("event.type", "foo");
shouldBeTrue("event.bubbles");
shouldBeTrue("event.cancelable");
shouldBe("event.initData", "testMessage");
debug("");

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
