diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
commit | 39dac57259cff8b61db0b22cb2ad0a8adb02692e (patch) | |
tree | 52a026cc8c22793eb17fd0f5e22adce1ae08a1dd /dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html | |
parent | a1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff) | |
parent | c2d9ab62f3d097c9e0e00184cab1f546554f5eaa (diff) | |
download | UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.gz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.lz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.xz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.zip |
Merge branch 'redwood' into 28.9-platform
Diffstat (limited to 'dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html')
-rw-r--r-- | dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html b/dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html deleted file mode 100644 index 370cb92e1..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html +++ /dev/null @@ -1,95 +0,0 @@ -<!DOCTYPE HTML> -<!-- vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: --> -<html> - <head> - <meta charset="utf-8"> - <title>Test for B2G PresentationReceiver at receiver side</title> - </head> - <body> - <div id="content"></div> -<script type="application/javascript;version=1.7"> - -"use strict"; - -function is(a, b, msg) { - if (a === b) { - alert('OK ' + msg); - } else { - alert('KO ' + msg + ' | reason: ' + a + ' != ' + b); - } -} - -function ok(a, msg) { - alert((a ? 'OK ' : 'KO ') + msg); -} - -function info(msg) { - alert('INFO ' + msg); -} - -function command(name, data) { - alert('COMMAND ' + JSON.stringify({name: name, data: data})); -} - -function finish() { - alert('DONE'); -} - -var connection; - -function testConnectionAvailable() { - return new Promise(function(aResolve, aReject) { - info('Receiver: --- testConnectionAvailable ---'); - ok(navigator.presentation, "Receiver: navigator.presentation should be available."); - ok(navigator.presentation.receiver, "Receiver: navigator.presentation.receiver should be available."); - - navigator.presentation.receiver.connectionList - .then((aList) => { - is(aList.connections.length, 1, "Should get one conncetion."); - connection = aList.connections[0]; - ok(connection.id, "Connection ID should be set: " + connection.id); - is(connection.state, "connected", "Connection state at receiver side should be connected."); - aResolve(); - }) - .catch((aError) => { - ok(false, "Receiver: Error occurred when getting the connection: " + aError); - finish(); - aReject(); - }); - }); -} - -function testConnectionReady() { - return new Promise(function(aResolve, aReject) { - info('Receiver: --- testConnectionReady ---'); - connection.onconnect = function() { - connection.onconnect = null; - ok(false, "Should not get |onconnect| event.") - aReject(); - }; - if (connection.state === "connected") { - connection.onconnect = null; - is(connection.state, "connected", "Receiver: Connection state should become connected."); - aResolve(); - } - }); -} - -function testConnectionWentaway() { - return new Promise(function(aResolve, aReject) { - info('Receiver: --- testConnectionWentaway ---\n'); - command('forward-command', JSON.stringify({ name: 'ready-to-remove-receiverFrame' })); - }); -} - -function runTests() { - testConnectionAvailable() - .then(testConnectionReady) - .then(testConnectionWentaway); -} - -runTests(); - -</script> - </body> -</html> |