Index: LayoutTests/webmidi/open_close.html |
diff --git a/LayoutTests/webmidi/open_close.html b/LayoutTests/webmidi/open_close.html |
deleted file mode 100644 |
index 39d70234d57bc0000e5b4794517122e7e3e7560c..0000000000000000000000000000000000000000 |
--- a/LayoutTests/webmidi/open_close.html |
+++ /dev/null |
@@ -1,91 +0,0 @@ |
-<!DOCTYPE html> |
-<html> |
-<head> |
-<script src="../resources/js-test.js"></script> |
-</head> |
-<body> |
-<script> |
-description("Tests MIDIPort.open and MIDIPort.close."); |
- |
-function checkStateTransition(options) { |
- debug("Check state transition for " + options.method + " on " + |
- options.initialconnection + " state."); |
- debug("- check initial state."); |
- window.port = options.port; |
- shouldBeEqualToString("port.connection", options.initialconnection); |
- var checkHandler = function(e) { |
- window.eventport = e.port; |
- testPassed("handler is called with port " + eventport + "."); |
- if (options.initialconnection == options.finalconnection) { |
- testFailed("onstatechange handler should not be called here."); |
- } |
- shouldBeEqualToString("eventport.id", options.port.id); |
- shouldBeEqualToString("eventport.connection", options.finalconnection); |
- }; |
- port.onstatechange = function(e) { |
- debug("- check port handler."); |
- checkHandler(e); |
- }; |
- access.onstatechange = function(e) { |
- debug("- check access handler."); |
- checkHandler(e); |
- }; |
- return port[options.method]().then(function(p) { |
- window.callbackport = p; |
- debug("- check callback arguments."); |
- testPassed("callback is called with port " + callbackport + "."); |
- shouldBeEqualToString("callbackport.id", options.port.id); |
- shouldBeEqualToString("callbackport.connection", options.finalconnection); |
- debug("- check final state."); |
- shouldBeEqualToString("port.connection", options.finalconnection); |
- }, function(e) { |
- testFailed("error callback should not be called here."); |
- throw e; |
- }); |
-} |
- |
-function runTests(port) { |
- return Promise.resolve().then(checkStateTransition.bind(undefined, { |
- port: port, |
- method: "close", |
- initialconnection: "closed", |
- finalconnection: "closed", |
- })).then(checkStateTransition.bind(undefined, { |
- port: port, |
- method: "open", |
- initialconnection: "closed", |
- finalconnection: "open", |
- })).then(checkStateTransition.bind(undefined, { |
- port: port, |
- method: "open", |
- initialconnection: "open", |
- finalconnection: "open", |
- })).then(checkStateTransition.bind(undefined, { |
- port: port, |
- method: "close", |
- initialconnection: "open", |
- finalconnection: "closed", |
- })); |
-} |
- |
-function successAccessCallback(a) { |
- window.access = a; |
- testPassed("requestMIDIAccess() succeeded with access " + access + "."); |
- |
- runTests(access.inputs.values().next().value) |
- .then(finishJSTest, finishJSTest); |
-} |
- |
-function errorAccessCallback(error) { |
- testFailed("requestMIDIAccess() error callback should not be called when requesting basic access."); |
- finishJSTest(); |
-} |
- |
-window.jsTestIsAsync = true; |
- |
-// Test MIDIPort state transition by open() and close(). |
-navigator.requestMIDIAccess().then(successAccessCallback, errorAccessCallback); |
- |
-</script> |
-</body> |
-</html> |