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

Unified Diff: LayoutTests/fast/events/constructors/midi-message-event-constructor.html

Issue 14192043: Web MIDI: implement MIDIMessageEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: OWNERS Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/constructors/midi-message-event-constructor.html
diff --git a/LayoutTests/fast/events/constructors/midi-message-event-constructor.html b/LayoutTests/fast/events/constructors/midi-message-event-constructor.html
new file mode 100644
index 0000000000000000000000000000000000000000..5908d3da9dd067daf64fbdb0c93330d58cad6bd8
--- /dev/null
+++ b/LayoutTests/fast/events/constructors/midi-message-event-constructor.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("This tests the constructor for the MIDIMessageEvent DOM class.");
+
+// No initializer is passed.
+shouldBe("new MIDIMessageEvent('eventType').bubbles", "false");
+shouldBe("new MIDIMessageEvent('eventType').cancelable", "false");
+shouldBe("new MIDIMessageEvent('eventType').receivedTime", "0.0");
+shouldBe("new MIDIMessageEvent('eventType').data", "null");
+
+// bubbles is passed.
+shouldBe("new MIDIMessageEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new MIDIMessageEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// cancelable is passed.
+shouldBe("new MIDIMessageEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new MIDIMessageEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// receivedTime is passed.
+shouldBe("new MIDIMessageEvent('eventType', { receivedTime: 3.14 }).receivedTime", "3.14");
+
+// data is passed.
+shouldBeEqualToString("new MIDIMessageEvent('eventType', { data: new Uint8Array(16) }).data.toString()", "[object Uint8Array]");
+
+// All initializers are passed.
+shouldBe("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, receivedTime: 1976.0501, data: new Uint8Array(3) }).bubbles", "true");
+shouldBe("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, receivedTime: 1976.0501, data: new Uint8Array(3) }).cancelable", "true");
+shouldBe("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, receivedTime: 1976.0501, data: new Uint8Array(3) }).receivedTime", "1976.0501");
+shouldBeEqualToString("new MIDIMessageEvent('eventType', { bubbles: true, cancelable: true, receivedTime: 1976.0501, data: new Uint8Array(3) }).data.toString()", "[object Uint8Array]");
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698