From 5483f807c2663be8c63caf8d59ee151b3ef499d3 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Thu, 6 Feb 2020 16:03:39 -0500 Subject: Issue #1390 - Get rid of the Presentation API --- .../PresentationDeviceInfoChromeScript.js | 150 ------ .../mochitest/PresentationSessionChromeScript.js | 470 ------------------- .../PresentationSessionChromeScript1UA.js | 366 --------------- .../mochitest/PresentationSessionFrameScript.js | 258 ----------- dom/presentation/tests/mochitest/chrome.ini | 14 - .../mochitest/file_presentation_1ua_receiver.html | 220 --------- .../mochitest/file_presentation_1ua_wentaway.html | 95 ---- .../file_presentation_mixed_security_contexts.html | 159 ------- .../mochitest/file_presentation_non_receiver.html | 41 -- ...ile_presentation_non_receiver_inner_iframe.html | 26 -- .../mochitest/file_presentation_receiver.html | 140 ------ ...presentation_receiver_auxiliary_navigation.html | 60 --- ...tation_receiver_establish_connection_error.html | 79 ---- .../file_presentation_receiver_inner_iframe.html | 26 -- .../mochitest/file_presentation_reconnect.html | 102 ---- .../file_presentation_sandboxed_presentation.html | 114 ----- .../mochitest/file_presentation_terminate.html | 104 ----- ...ation_terminate_establish_connection_error.html | 114 ----- .../file_presentation_unknown_content_type.test | 1 - ...presentation_unknown_content_type.test^headers^ | 1 - dom/presentation/tests/mochitest/mochitest.ini | 77 --- .../test_presentation_1ua_connection_wentaway.js | 175 ------- ...resentation_1ua_connection_wentaway_inproc.html | 18 - ...t_presentation_1ua_connection_wentaway_oop.html | 18 - .../test_presentation_1ua_sender_and_receiver.js | 370 --------------- ...resentation_1ua_sender_and_receiver_inproc.html | 18 - ...t_presentation_1ua_sender_and_receiver_oop.html | 18 - .../mochitest/test_presentation_availability.html | 236 ---------- ..._presentation_datachannel_sessiontransport.html | 245 ---------- .../mochitest/test_presentation_dc_receiver.html | 141 ------ .../test_presentation_dc_receiver_oop.html | 213 --------- .../mochitest/test_presentation_dc_sender.html | 291 ------------ .../mochitest/test_presentation_device_info.html | 144 ------ .../test_presentation_device_info_permission.html | 35 -- .../test_presentation_mixed_security_contexts.html | 81 ---- ...t_presentation_receiver_auxiliary_navigation.js | 77 --- ...ation_receiver_auxiliary_navigation_inproc.html | 18 - ...entation_receiver_auxiliary_navigation_oop.html | 18 - .../mochitest/test_presentation_reconnect.html | 379 --------------- .../test_presentation_sandboxed_presentation.html | 75 --- ...t_presentation_sender_on_terminate_request.html | 187 -------- .../test_presentation_sender_startWithDevice.html | 173 ------- .../mochitest/test_presentation_tcp_receiver.html | 137 ------ ...on_tcp_receiver_establish_connection_error.html | 110 ----- ..._tcp_receiver_establish_connection_timeout.html | 81 ---- ...er_establish_connection_unknown_content_type.js | 88 ---- ...ish_connection_unknown_content_type_inproc.html | 16 - ...ablish_connection_unknown_content_type_oop.html | 16 - .../test_presentation_tcp_receiver_oop.html | 178 ------- .../mochitest/test_presentation_tcp_sender.html | 260 ----------- ...st_presentation_tcp_sender_default_request.html | 151 ------ .../test_presentation_tcp_sender_disconnect.html | 160 ------- ...tion_tcp_sender_establish_connection_error.html | 514 --------------------- .../tests/mochitest/test_presentation_terminate.js | 243 ---------- ...ntation_terminate_establish_connection_error.js | 197 -------- ...erminate_establish_connection_error_inproc.html | 18 - ...n_terminate_establish_connection_error_oop.html | 18 - .../test_presentation_terminate_inproc.html | 18 - .../mochitest/test_presentation_terminate_oop.html | 18 - 59 files changed, 7770 deletions(-) delete mode 100644 dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js delete mode 100644 dom/presentation/tests/mochitest/PresentationSessionChromeScript.js delete mode 100644 dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js delete mode 100644 dom/presentation/tests/mochitest/PresentationSessionFrameScript.js delete mode 100644 dom/presentation/tests/mochitest/chrome.ini delete mode 100644 dom/presentation/tests/mochitest/file_presentation_1ua_receiver.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_1ua_wentaway.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_non_receiver.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_non_receiver_inner_iframe.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_receiver.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_receiver_auxiliary_navigation.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_receiver_establish_connection_error.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_receiver_inner_iframe.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_reconnect.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_sandboxed_presentation.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_terminate.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_terminate_establish_connection_error.html delete mode 100644 dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test delete mode 100644 dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test^headers^ delete mode 100644 dom/presentation/tests/mochitest/mochitest.ini delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_availability.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_dc_receiver.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_dc_receiver_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_dc_sender.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_device_info.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_device_info_permission.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_reconnect.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_sandboxed_presentation.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_error.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_timeout.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_receiver_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_sender.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_sender_disconnect.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_tcp_sender_establish_connection_error.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error.js delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_oop.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate_inproc.html delete mode 100644 dom/presentation/tests/mochitest/test_presentation_terminate_oop.html (limited to 'dom/presentation/tests/mochitest') diff --git a/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js b/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js deleted file mode 100644 index 2bc069f6b..000000000 --- a/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import('resource://gre/modules/PresentationDeviceInfoManager.jsm'); - -const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm'); - -const manager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - -var testProvider = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceProvider]), - forceDiscovery: function() { - sendAsyncMessage('force-discovery'); - }, - listener: null, -}; - -var testDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - establishControlChannel: function() { - return null; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - return true; - }, - id: null, - name: null, - type: null, - listener: null, -}; - -var testDevice1 = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'dummyid', - name: 'dummyName', - type: 'dummyType', - establishControlChannel: function(url, presentationId) { - return null; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - return true; - }, -}; - -var testDevice2 = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'dummyid', - name: 'dummyName', - type: 'dummyType', - establishControlChannel: function(url, presentationId) { - return null; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - return true; - }, -}; - -var mockedDeviceWithoutSupportedURL = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'dummyid', - name: 'dummyName', - type: 'dummyType', - establishControlChannel: function(url, presentationId) { - return null; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - return false; - }, -}; - -var mockedDeviceSupportHttpsURL = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'dummyid', - name: 'dummyName', - type: 'dummyType', - establishControlChannel: function(url, presentationId) { - return null; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - if (requestedUrl.indexOf("https://") != -1) { - return true; - } - return false; - }, -}; - -addMessageListener('setup', function() { - manager.addDeviceProvider(testProvider); - - sendAsyncMessage('setup-complete'); -}); - -addMessageListener('trigger-device-add', function(device) { - testDevice.id = device.id; - testDevice.name = device.name; - testDevice.type = device.type; - manager.addDevice(testDevice); -}); - -addMessageListener('trigger-add-unsupport-url-device', function() { - manager.addDevice(mockedDeviceWithoutSupportedURL); -}); - -addMessageListener('trigger-add-multiple-devices', function() { - manager.addDevice(testDevice1); - manager.addDevice(testDevice2); -}); - -addMessageListener('trigger-add-https-devices', function() { - manager.addDevice(mockedDeviceSupportHttpsURL); -}); - - -addMessageListener('trigger-device-update', function(device) { - testDevice.id = device.id; - testDevice.name = device.name; - testDevice.type = device.type; - manager.updateDevice(testDevice); -}); - -addMessageListener('trigger-device-remove', function() { - manager.removeDevice(testDevice); -}); - -addMessageListener('trigger-remove-unsupported-device', function() { - manager.removeDevice(mockedDeviceWithoutSupportedURL); -}); - -addMessageListener('trigger-remove-multiple-devices', function() { - manager.removeDevice(testDevice1); - manager.removeDevice(testDevice2); -}); - -addMessageListener('trigger-remove-https-devices', function() { - manager.removeDevice(mockedDeviceSupportHttpsURL); -}); - -addMessageListener('teardown', function() { - manager.removeDeviceProvider(testProvider); -}); diff --git a/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js b/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js deleted file mode 100644 index 3052bdcb1..000000000 --- a/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js +++ /dev/null @@ -1,470 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components; - -Cu.import('resource://gre/modules/XPCOMUtils.jsm'); -Cu.import('resource://gre/modules/Services.jsm'); -Cu.import('resource://gre/modules/Timer.jsm'); - -const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] - .getService(Ci.nsIUUIDGenerator); - -function registerMockedFactory(contractId, mockedClassId, mockedFactory) { - var originalClassId, originalFactory; - - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - if (!registrar.isCIDRegistered(mockedClassId)) { - try { - originalClassId = registrar.contractIDToCID(contractId); - originalFactory = Cm.getClassObject(Cc[contractId], Ci.nsIFactory); - } catch (ex) { - originalClassId = ""; - originalFactory = null; - } - if (originalFactory) { - registrar.unregisterFactory(originalClassId, originalFactory); - } - registrar.registerFactory(mockedClassId, "", contractId, mockedFactory); - } - - return { contractId: contractId, - mockedClassId: mockedClassId, - mockedFactory: mockedFactory, - originalClassId: originalClassId, - originalFactory: originalFactory }; -} - -function registerOriginalFactory(contractId, mockedClassId, mockedFactory, originalClassId, originalFactory) { - if (originalFactory) { - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - registrar.unregisterFactory(mockedClassId, mockedFactory); - registrar.registerFactory(originalClassId, "", contractId, originalFactory); - } -} - -var sessionId = 'test-session-id-' + uuidGenerator.generateUUID().toString(); - -const address = Cc["@mozilla.org/supports-cstring;1"] - .createInstance(Ci.nsISupportsCString); -address.data = "127.0.0.1"; -const addresses = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); -addresses.appendElement(address, false); - -const mockedChannelDescription = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), - get type() { - if (Services.prefs.getBoolPref("dom.presentation.session_transport.data_channel.enable")) { - return Ci.nsIPresentationChannelDescription.TYPE_DATACHANNEL; - } - return Ci.nsIPresentationChannelDescription.TYPE_TCP; - }, - tcpAddress: addresses, - tcpPort: 1234, -}; - -const mockedServerSocket = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIServerSocket, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - get port() { - return this._port; - }, - set listener(listener) { - this._listener = listener; - }, - init: function(port, loopbackOnly, backLog) { - if (port != -1) { - this._port = port; - } else { - this._port = 5678; - } - }, - asyncListen: function(listener) { - this._listener = listener; - }, - close: function() { - this._listener.onStopListening(this, Cr.NS_BINDING_ABORTED); - }, - simulateOnSocketAccepted: function(serverSocket, socketTransport) { - this._listener.onSocketAccepted(serverSocket, socketTransport); - } -}; - -const mockedSocketTransport = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISocketTransport]), -}; - -const mockedControlChannel = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), - set listener(listener) { - this._listener = listener; - }, - get listener() { - return this._listener; - }, - sendOffer: function(offer) { - sendAsyncMessage('offer-sent', this._isValidSDP(offer)); - }, - sendAnswer: function(answer) { - sendAsyncMessage('answer-sent', this._isValidSDP(answer)); - - if (answer.type == Ci.nsIPresentationChannelDescription.TYPE_TCP) { - this._listener.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyTransportReady(); - } - }, - _isValidSDP: function(aSDP) { - var isValid = false; - if (aSDP.type == Ci.nsIPresentationChannelDescription.TYPE_TCP) { - try { - var addresses = aSDP.tcpAddress; - if (addresses.length > 0) { - for (var i = 0; i < addresses.length; i++) { - // Ensure CString addresses are used. Otherwise, an error will be thrown. - addresses.queryElementAt(i, Ci.nsISupportsCString); - } - - isValid = true; - } - } catch (e) { - isValid = false; - } - } else if (aSDP.type == Ci.nsIPresentationChannelDescription.TYPE_DATACHANNEL) { - isValid = (aSDP.dataChannelSDP == "test-sdp"); - } - return isValid; - }, - launch: function(presentationId, url) { - sessionId = presentationId; - }, - terminate: function(presentationId) { - sendAsyncMessage('sender-terminate', presentationId); - }, - reconnect: function(presentationId, url) { - sendAsyncMessage('start-reconnect', url); - }, - notifyReconnected: function() { - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyReconnected(); - }, - disconnect: function(reason) { - sendAsyncMessage('control-channel-closed', reason); - this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyDisconnected(reason); - }, - simulateReceiverReady: function() { - this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyReceiverReady(); - }, - simulateOnOffer: function() { - sendAsyncMessage('offer-received'); - this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).onOffer(mockedChannelDescription); - }, - simulateOnAnswer: function() { - sendAsyncMessage('answer-received'); - this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).onAnswer(mockedChannelDescription); - }, - simulateNotifyConnected: function() { - sendAsyncMessage('control-channel-opened'); - this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyConnected(); - }, -}; - -const mockedDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'id', - name: 'name', - type: 'type', - establishControlChannel: function(url, presentationId) { - sendAsyncMessage('control-channel-established'); - return mockedControlChannel; - }, - disconnect: function() {}, - isRequestedUrlSupported: function(requestedUrl) { - return true; - }, -}; - -const mockedDevicePrompt = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevicePrompt, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - set request(request) { - this._request = request; - }, - get request() { - return this._request; - }, - promptDeviceSelection: function(request) { - this._request = request; - sendAsyncMessage('device-prompt'); - }, - simulateSelect: function() { - this._request.select(mockedDevice); - }, - simulateCancel: function(result) { - this._request.cancel(result); - } -}; - -const mockedSessionTransport = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport, - Ci.nsIPresentationSessionTransportBuilder, - Ci.nsIPresentationTCPSessionTransportBuilder, - Ci.nsIPresentationDataChannelSessionTransportBuilder, - Ci.nsIPresentationControlChannelListener, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - set callback(callback) { - this._callback = callback; - }, - get callback() { - return this._callback; - }, - get selfAddress() { - return this._selfAddress; - }, - buildTCPSenderTransport: function(transport, listener) { - this._listener = listener; - this._role = Ci.nsIPresentationService.ROLE_CONTROLLER; - this._listener.onSessionTransport(this); - this._listener = null; - sendAsyncMessage('data-transport-initialized'); - - setTimeout(()=>{ - this.simulateTransportReady(); - }, 0); - }, - buildTCPReceiverTransport: function(description, listener) { - this._listener = listener; - this._role = Ci.nsIPresentationService.ROLE_RECEIVER; - - var addresses = description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpAddress; - this._selfAddress = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetAddr]), - address: (addresses.length > 0) ? - addresses.queryElementAt(0, Ci.nsISupportsCString).data : "", - port: description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpPort, - }; - - setTimeout(()=>{ - this._listener.onSessionTransport(this); - this._listener = null; - }, 0); - }, - // in-process case - buildDataChannelTransport: function(role, window, listener) { - this._listener = listener; - this._role = role; - - var hasNavigator = window ? (typeof window.navigator != "undefined") : false; - sendAsyncMessage('check-navigator', hasNavigator); - - setTimeout(()=>{ - this._listener.onSessionTransport(this); - this._listener = null; - this.simulateTransportReady(); - }, 0); - }, - enableDataNotification: function() { - sendAsyncMessage('data-transport-notification-enabled'); - }, - send: function(data) { - sendAsyncMessage('message-sent', data); - }, - close: function(reason) { - sendAsyncMessage('data-transport-closed', reason); - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyTransportClosed(reason); - }, - simulateTransportReady: function() { - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyTransportReady(); - }, - simulateIncomingMessage: function(message) { - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyData(message, false); - }, - onOffer: function(aOffer) { - }, - onAnswer: function(aAnswer) { - } -}; - -const mockedNetworkInfo = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo]), - getAddresses: function(ips, prefixLengths) { - ips.value = ["127.0.0.1"]; - prefixLengths.value = [0]; - return 1; - }, -}; - -const mockedNetworkManager = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkManager, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - get activeNetworkInfo() { - return mockedNetworkInfo; - }, -}; - -var requestPromise = null; - -const mockedRequestUIGlue = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationRequestUIGlue, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - sendRequest: function(aUrl, aSessionId) { - sendAsyncMessage('receiver-launching', aSessionId); - return requestPromise; - }, -}; - -// Register mocked factories. -const originalFactoryData = []; -originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation-device/prompt;1", - uuidGenerator.generateUUID(), - mockedDevicePrompt)); -originalFactoryData.push(registerMockedFactory("@mozilla.org/network/server-socket;1", - uuidGenerator.generateUUID(), - mockedServerSocket)); -originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/presentationtcpsessiontransport;1", - uuidGenerator.generateUUID(), - mockedSessionTransport)); -originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/datachanneltransportbuilder;1", - uuidGenerator.generateUUID(), - mockedSessionTransport)); -originalFactoryData.push(registerMockedFactory("@mozilla.org/network/manager;1", - uuidGenerator.generateUUID(), - mockedNetworkManager)); -originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/requestuiglue;1", - uuidGenerator.generateUUID(), - mockedRequestUIGlue)); - -function tearDown() { - requestPromise = null; - mockedServerSocket.listener = null; - mockedControlChannel.listener = null; - mockedDevice.listener = null; - mockedDevicePrompt.request = null; - mockedSessionTransport.callback = null; - - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener).removeDevice(mockedDevice); - - // Register original factories. - for (var data of originalFactoryData) { - registerOriginalFactory(data.contractId, data.mockedClassId, - data.mockedFactory, data.originalClassId, - data.originalFactory); - } - - sendAsyncMessage('teardown-complete'); -} - -addMessageListener('trigger-device-add', function() { - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener).addDevice(mockedDevice); -}); - -addMessageListener('trigger-device-prompt-select', function() { - mockedDevicePrompt.simulateSelect(); -}); - -addMessageListener('trigger-device-prompt-cancel', function(result) { - mockedDevicePrompt.simulateCancel(result); -}); - -addMessageListener('trigger-incoming-session-request', function(url) { - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .onSessionRequest(mockedDevice, url, sessionId, mockedControlChannel); -}); - -addMessageListener('trigger-incoming-terminate-request', function() { - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .onTerminateRequest(mockedDevice, sessionId, mockedControlChannel, true); -}); - -addMessageListener('trigger-reconnected-acked', function(url) { - mockedControlChannel.notifyReconnected(); -}); - -addMessageListener('trigger-incoming-offer', function() { - mockedControlChannel.simulateOnOffer(); -}); - -addMessageListener('trigger-incoming-answer', function() { - mockedControlChannel.simulateOnAnswer(); -}); - -addMessageListener('trigger-incoming-transport', function() { - mockedServerSocket.simulateOnSocketAccepted(mockedServerSocket, mockedSocketTransport); -}); - -addMessageListener('trigger-control-channel-open', function(reason) { - mockedControlChannel.simulateNotifyConnected(); -}); - -addMessageListener('trigger-control-channel-close', function(reason) { - mockedControlChannel.disconnect(reason); -}); - -addMessageListener('trigger-data-transport-close', function(reason) { - mockedSessionTransport.close(reason); -}); - -addMessageListener('trigger-incoming-message', function(message) { - mockedSessionTransport.simulateIncomingMessage(message); -}); - -addMessageListener('teardown', function() { - tearDown(); -}); - -var controlChannelListener; -addMessageListener('save-control-channel-listener', function() { - controlChannelListener = mockedControlChannel.listener; -}); - -addMessageListener('restore-control-channel-listener', function(message) { - mockedControlChannel.listener = controlChannelListener; - controlChannelListener = null; -}); - -var obs = Cc["@mozilla.org/observer-service;1"] - .getService(Ci.nsIObserverService); -obs.addObserver(function observer(aSubject, aTopic, aData) { - obs.removeObserver(observer, aTopic); - - requestPromise = aSubject; -}, 'setup-request-promise', false); diff --git a/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js b/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js deleted file mode 100644 index 82d7362b2..000000000 --- a/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js +++ /dev/null @@ -1,366 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, -* You can obtain one at http://mozilla.org/MPL/2.0/. */ - -'use strict'; - -const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components; - -Cu.import('resource://gre/modules/XPCOMUtils.jsm'); -Cu.import('resource://gre/modules/Services.jsm'); - -const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] - .getService(Ci.nsIUUIDGenerator); - -function debug(str) { - // dump('DEBUG -*- PresentationSessionChromeScript1UA -*-: ' + str + '\n'); -} - -const originalFactoryData = []; -var sessionId; // Store the uuid generated by PresentationRequest. -var triggerControlChannelError = false; // For simulating error during control channel establishment. - -// control channel of sender -const mockControlChannelOfSender = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), - set listener(listener) { - // PresentationControllingInfo::SetControlChannel - if (listener) { - debug('set listener for mockControlChannelOfSender without null'); - } else { - debug('set listener for mockControlChannelOfSender with null'); - } - this._listener = listener; - }, - get listener() { - return this._listener; - }, - notifyConnected: function() { - // send offer after notifyConnected immediately - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyConnected(); - }, - notifyReconnected: function() { - // send offer after notifyOpened immediately - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyReconnected(); - }, - sendOffer: function(offer) { - Services.tm.mainThread.dispatch(() => { - mockControlChannelOfReceiver.onOffer(offer); - }, Ci.nsIThread.DISPATCH_NORMAL); - }, - onAnswer: function(answer) { - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .onAnswer(answer); - }, - launch: function(presentationId, url) { - sessionId = presentationId; - sendAsyncMessage('sender-launch', url); - }, - disconnect: function(reason) { - if (!this._listener) { - return; - } - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyDisconnected(reason); - mockControlChannelOfReceiver.disconnect(); - }, - terminate: function(presentationId) { - sendAsyncMessage('sender-terminate'); - }, - reconnect: function(presentationId, url) { - sendAsyncMessage('start-reconnect', url); - }, - sendIceCandidate: function(candidate) { - mockControlChannelOfReceiver.notifyIceCandidate(candidate); - }, - notifyIceCandidate: function(candidate) { - if (!this._listener) { - return; - } - - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .onIceCandidate(candidate); - }, -}; - -// control channel of receiver -const mockControlChannelOfReceiver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), - set listener(listener) { - // PresentationPresentingInfo::SetControlChannel - if (listener) { - debug('set listener for mockControlChannelOfReceiver without null'); - } else { - debug('set listener for mockControlChannelOfReceiver with null'); - } - this._listener = listener; - - if (this._pendingOpened) { - this._pendingOpened = false; - this.notifyConnected(); - } - }, - get listener() { - return this._listener; - }, - notifyConnected: function() { - // do nothing - if (!this._listener) { - this._pendingOpened = true; - return; - } - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyConnected(); - }, - onOffer: function(offer) { - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .onOffer(offer); - }, - sendAnswer: function(answer) { - Services.tm.mainThread.dispatch(() => { - mockControlChannelOfSender.onAnswer(answer); - }, Ci.nsIThread.DISPATCH_NORMAL); - }, - disconnect: function(reason) { - if (!this._listener) { - return; - } - - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .notifyDisconnected(reason); - sendAsyncMessage('control-channel-receiver-closed', reason); - }, - terminate: function(presentaionId) { - }, - sendIceCandidate: function(candidate) { - mockControlChannelOfReceiver.notifyIceCandidate(candidate); - }, - notifyIceCandidate: function(candidate) { - if (!this._listener) { - return; - } - - this._listener - .QueryInterface(Ci.nsIPresentationControlChannelListener) - .onIceCandidate(candidate); - }, -}; - -const mockDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), - id: 'id', - name: 'name', - type: 'type', - establishControlChannel: function(url, presentationId) { - if (triggerControlChannelError) { - throw Cr.NS_ERROR_FAILURE; - } - sendAsyncMessage('control-channel-established'); - return mockControlChannelOfSender; - }, - disconnect: function() { - sendAsyncMessage('device-disconnected'); - }, - isRequestedUrlSupported: function(requestedUrl) { - return true; - }, -}; - -const mockDevicePrompt = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevicePrompt, - Ci.nsIFactory]), - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - set request(request) { - this._request = request; - }, - get request() { - return this._request; - }, - promptDeviceSelection: function(request) { - this._request = request; - sendAsyncMessage('device-prompt'); - }, - simulateSelect: function() { - this._request.select(mockDevice); - }, - simulateCancel: function() { - this._request.cancel(); - } -}; - -const mockRequestUIGlue = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationRequestUIGlue, - Ci.nsIFactory]), - set promise(aPromise) { - this._promise = aPromise - }, - get promise() { - return this._promise; - }, - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - sendRequest: function(aUrl, aSessionId) { - return this.promise; - }, -}; - -function initMockAndListener() { - - function registerMockFactory(contractId, mockClassId, mockFactory) { - var originalClassId, originalFactory; - - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - if (!registrar.isCIDRegistered(mockClassId)) { - try { - originalClassId = registrar.contractIDToCID(contractId); - originalFactory = Cm.getClassObject(Cc[contractId], Ci.nsIFactory); - } catch (ex) { - originalClassId = ""; - originalFactory = null; - } - if (originalFactory) { - registrar.unregisterFactory(originalClassId, originalFactory); - } - registrar.registerFactory(mockClassId, "", contractId, mockFactory); - } - - return { contractId: contractId, - mockClassId: mockClassId, - mockFactory: mockFactory, - originalClassId: originalClassId, - originalFactory: originalFactory }; - } - // Register mock factories. - const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] - .getService(Ci.nsIUUIDGenerator); - originalFactoryData.push(registerMockFactory("@mozilla.org/presentation-device/prompt;1", - uuidGenerator.generateUUID(), - mockDevicePrompt)); - originalFactoryData.push(registerMockFactory("@mozilla.org/presentation/requestuiglue;1", - uuidGenerator.generateUUID(), - mockRequestUIGlue)); - - addMessageListener('trigger-device-add', function() { - debug('Got message: trigger-device-add'); - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .addDevice(mockDevice); - }); - - addMessageListener('trigger-device-prompt-select', function() { - debug('Got message: trigger-device-prompt-select'); - mockDevicePrompt.simulateSelect(); - }); - - addMessageListener('trigger-on-session-request', function(url) { - debug('Got message: trigger-on-session-request'); - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .onSessionRequest(mockDevice, - url, - sessionId, - mockControlChannelOfReceiver); - }); - - addMessageListener('trigger-on-terminate-request', function() { - debug('Got message: trigger-on-terminate-request'); - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .onTerminateRequest(mockDevice, - sessionId, - mockControlChannelOfReceiver, - false); - }); - - addMessageListener('trigger-control-channel-open', function(reason) { - debug('Got message: trigger-control-channel-open'); - mockControlChannelOfSender.notifyConnected(); - mockControlChannelOfReceiver.notifyConnected(); - }); - - addMessageListener('trigger-control-channel-error', function(reason) { - debug('Got message: trigger-control-channel-open'); - triggerControlChannelError = true; - }); - - addMessageListener('trigger-reconnected-acked', function(url) { - debug('Got message: trigger-reconnected-acked'); - mockControlChannelOfSender.notifyReconnected(); - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .onReconnectRequest(mockDevice, - url, - sessionId, - mockControlChannelOfReceiver); - }); - - // Used to call sendAsyncMessage in chrome script from receiver. - addMessageListener('forward-command', function(command_data) { - let command = JSON.parse(command_data); - sendAsyncMessage(command.name, command.data); - }); - - addMessageListener('teardown', teardown); - - var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); - obs.addObserver(function setupRequestPromiseHandler(aSubject, aTopic, aData) { - debug('Got observer: setup-request-promise'); - obs.removeObserver(setupRequestPromiseHandler, aTopic); - mockRequestUIGlue.promise = aSubject; - sendAsyncMessage('promise-setup-ready'); - }, 'setup-request-promise', false); -} - -function teardown() { - - function registerOriginalFactory(contractId, mockedClassId, mockedFactory, originalClassId, originalFactory) { - if (originalFactory) { - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - registrar.unregisterFactory(mockedClassId, mockedFactory); - registrar.registerFactory(originalClassId, "", contractId, originalFactory); - } - } - - mockRequestUIGlue.promise = null; - mockControlChannelOfSender.listener = null; - mockControlChannelOfReceiver.listener = null; - mockDevicePrompt.request = null; - - var deviceManager = Cc['@mozilla.org/presentation-device/manager;1'] - .getService(Ci.nsIPresentationDeviceManager); - deviceManager.QueryInterface(Ci.nsIPresentationDeviceListener) - .removeDevice(mockDevice); - // Register original factories. - for (var data of originalFactoryData) { - registerOriginalFactory(data.contractId, data.mockClassId, - data.mockFactory, data.originalClassId, - data.originalFactory); - } - sendAsyncMessage('teardown-complete'); -} - -initMockAndListener(); diff --git a/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js b/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js deleted file mode 100644 index 77240ab5f..000000000 --- a/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function loadPrivilegedScriptTest() { - /** - * The script is loaded as - * (a) a privileged script in content process for dc_sender.html - * (b) a frame script in the remote iframe process for dc_receiver_oop.html - * |type port == "undefined"| indicates the script is load by - * |loadPrivilegedScript| which is the first case. - */ - function sendMessage(type, data) { - if (typeof port == "undefined") { - sendAsyncMessage(type, {'data': data}); - } else { - port.postMessage({'type': type, - 'data': data - }); - } - } - - if (typeof port != "undefined") { - /** - * When the script is loaded by |loadPrivilegedScript|, these APIs - * are exposed to this script. - */ - port.onmessage = (e) => { - var type = e.data['type']; - if (!handlers.hasOwnProperty(type)) { - return; - } - var args = [e]; - handlers[type].forEach(handler => handler.apply(null, args)); - }; - var handlers = {}; - addMessageListener = function(message, handler) { - if (handlers.hasOwnProperty(message)) { - handlers[message].push(handler); - } else { - handlers[message] = [handler]; - } - }; - removeMessageListener = function(message, handler) { - if (!handler || !handlers.hasOwnProperty(message)) { - return; - } - var index = handlers[message].indexOf(handler); - if (index != -1) { - handlers[message].splice(index, 1); - } - }; - } - - const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components; - - const mockedChannelDescription = { - QueryInterface : function (iid) { - const interfaces = [Ci.nsIPresentationChannelDescription]; - - if (!interfaces.some(v => iid.equals(v))) { - throw Cr.NS_ERROR_NO_INTERFACE; - } - return this; - }, - get type() { - if (Services.prefs.getBoolPref("dom.presentation.session_transport.data_channel.enable")) { - return Ci.nsIPresentationChannelDescription.TYPE_DATACHANNEL; - } - return Ci.nsIPresentationChannelDescription.TYPE_TCP; - }, - get dataChannelSDP() { - return "test-sdp"; - } - }; - - function setTimeout(callback, delay) { - let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - timer.initWithCallback({ notify: callback }, - delay, - Ci.nsITimer.TYPE_ONE_SHOT); - return timer; - } - - const mockedSessionTransport = { - QueryInterface : function (iid) { - const interfaces = [Ci.nsIPresentationSessionTransport, - Ci.nsIPresentationDataChannelSessionTransportBuilder, - Ci.nsIFactory]; - - if (!interfaces.some(v => iid.equals(v))) { - throw Cr.NS_ERROR_NO_INTERFACE; - } - return this; - }, - createInstance: function(aOuter, aIID) { - if (aOuter) { - throw Components.results.NS_ERROR_NO_AGGREGATION; - } - return this.QueryInterface(aIID); - }, - set callback(callback) { - this._callback = callback; - }, - get callback() { - return this._callback; - }, - /* OOP case */ - buildDataChannelTransport: function(role, window, listener) { - dump("PresentationSessionFrameScript: build data channel transport\n"); - this._listener = listener; - this._role = role; - - var hasNavigator = window ? (typeof window.navigator != "undefined") : false; - sendMessage('check-navigator', hasNavigator); - - if (this._role == Ci.nsIPresentationService.ROLE_CONTROLLER) { - this._listener.sendOffer(mockedChannelDescription); - } - }, - - enableDataNotification: function() { - sendMessage('data-transport-notification-enabled'); - }, - send: function(data) { - sendMessage('message-sent', data); - }, - close: function(reason) { - sendMessage('data-transport-closed', reason); - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyTransportClosed(reason); - this._callback = null; - }, - simulateTransportReady: function() { - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyTransportReady(); - }, - simulateIncomingMessage: function(message) { - this._callback.QueryInterface(Ci.nsIPresentationSessionTransportCallback).notifyData(message, false); - }, - onOffer: function(aOffer) { - this._listener.sendAnswer(mockedChannelDescription); - this._onSessionTransport(); - }, - onAnswer: function(aAnswer) { - this._onSessionTransport(); - }, - _onSessionTransport: function() { - setTimeout(()=>{ - this._listener.onSessionTransport(this); - this.simulateTransportReady(); - this._listener = null; - }, 0); - } - }; - - - function tearDown() { - mockedSessionTransport.callback = null; - - /* Register original factories. */ - for (var data of originalFactoryData) { - registerOriginalFactory(data.contractId, data.mockedClassId, - data.mockedFactory, data.originalClassId, - data.originalFactory); - } - sendMessage("teardown-complete"); - } - - - function registerMockedFactory(contractId, mockedClassId, mockedFactory) { - var originalClassId, originalFactory; - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - - if (!registrar.isCIDRegistered(mockedClassId)) { - try { - originalClassId = registrar.contractIDToCID(contractId); - originalFactory = Cm.getClassObject(Cc[contractId], Ci.nsIFactory); - } catch (ex) { - originalClassId = ""; - originalFactory = null; - } - if (originalFactory) { - registrar.unregisterFactory(originalClassId, originalFactory); - } - registrar.registerFactory(mockedClassId, "", contractId, mockedFactory); - } - - return { contractId: contractId, - mockedClassId: mockedClassId, - mockedFactory: mockedFactory, - originalClassId: originalClassId, - originalFactory: originalFactory }; - } - - function registerOriginalFactory(contractId, mockedClassId, mockedFactory, originalClassId, originalFactory) { - if (originalFactory) { - var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); - registrar.unregisterFactory(mockedClassId, mockedFactory); - registrar.registerFactory(originalClassId, "", contractId, originalFactory); - } - } - - /* Register mocked factories. */ - const originalFactoryData = []; - const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] - .getService(Ci.nsIUUIDGenerator); - originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/datachanneltransportbuilder;1", - uuidGenerator.generateUUID(), - mockedSessionTransport)); - - addMessageListener('trigger-incoming-message', function(event) { - mockedSessionTransport.simulateIncomingMessage(event.data.data); - }); - addMessageListener('teardown', ()=>tearDown()); -} - -// Exposed to the caller of |loadPrivilegedScript| -var contentScript = { - handlers: {}, - addMessageListener: function(message, handler) { - if (this.handlers.hasOwnProperty(message)) { - this.handlers[message].push(handler); - } else { - this.handlers[message] = [handler]; - } - }, - removeMessageListener: function(message, handler) { - if (!handler || !this.handlers.hasOwnProperty(message)) { - return; - } - var index = this.handlers[message].indexOf(handler); - if (index != -1) { - this.handlers[message].splice(index, 1); - } - }, - sendAsyncMessage: function(message, data) { - port.postMessage({'type': message, - 'data': data - }); - } -} - -if (!SpecialPowers.isMainProcess()) { - var port; - try { - port = SpecialPowers.loadPrivilegedScript(loadPrivilegedScriptTest.toSource()); - } catch (e) { - ok(false, "loadPrivilegedScript shoulde not throw" + e); - } - - port.onmessage = (e) => { - var type = e.data['type']; - if (!contentScript.handlers.hasOwnProperty(type)) { - return; - } - var args = [e.data['data']]; - contentScript.handlers[type].forEach(handler => handler.apply(null, args)); - }; -} diff --git a/dom/presentation/tests/mochitest/chrome.ini b/dom/presentation/tests/mochitest/chrome.ini deleted file mode 100644 index 83841f4f8..000000000 --- a/dom/presentation/tests/mochitest/chrome.ini +++ /dev/null @@ -1,14 +0,0 @@ -[DEFAULT] -support-files = - PresentationDeviceInfoChromeScript.js - PresentationSessionChromeScript.js - -[test_presentation_datachannel_sessiontransport.html] -skip-if = os == 'android' -[test_presentation_device_info.html] -[test_presentation_sender_startWithDevice.html] -skip-if = toolkit == 'android' # Bug 1129785 -[test_presentation_tcp_sender.html] -skip-if = toolkit == 'android' # Bug 1129785 -[test_presentation_tcp_sender_default_request.html] -skip-if = toolkit == 'android' # Bug 1129785 diff --git a/dom/presentation/tests/mochitest/file_presentation_1ua_receiver.html b/dom/presentation/tests/mochitest/file_presentation_1ua_receiver.html deleted file mode 100644 index cf02d2b2c..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_1ua_receiver.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - Test for B2G PresentationReceiver at receiver side - - -
- - - 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 @@ - - - - - - Test for B2G PresentationReceiver at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html b/dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html deleted file mode 100644 index f042d2994..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - -Test allow-presentation sandboxing flag - - - - - diff --git a/dom/presentation/tests/mochitest/file_presentation_non_receiver.html b/dom/presentation/tests/mochitest/file_presentation_non_receiver.html deleted file mode 100644 index 1203523ac..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_non_receiver.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Test for B2G PresentationReceiver on a non-receiver page at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_non_receiver_inner_iframe.html b/dom/presentation/tests/mochitest/file_presentation_non_receiver_inner_iframe.html deleted file mode 100644 index c95eddf57..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_non_receiver_inner_iframe.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Test for B2G PresentationReceiver on a non-receiver inner iframe of the receiver page at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_receiver.html b/dom/presentation/tests/mochitest/file_presentation_receiver.html deleted file mode 100644 index 46a330b5f..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_receiver.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Test for B2G PresentationReceiver at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_receiver_auxiliary_navigation.html b/dom/presentation/tests/mochitest/file_presentation_receiver_auxiliary_navigation.html deleted file mode 100644 index 3a6060310..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_receiver_auxiliary_navigation.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - Test for sandboxed auxiliary navigation flag in receiver page - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_receiver_establish_connection_error.html b/dom/presentation/tests/mochitest/file_presentation_receiver_establish_connection_error.html deleted file mode 100644 index 6b1f2152f..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_receiver_establish_connection_error.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Test for connection establishing errors of B2G Presentation API at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_receiver_inner_iframe.html b/dom/presentation/tests/mochitest/file_presentation_receiver_inner_iframe.html deleted file mode 100644 index 3bd5ac4b1..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_receiver_inner_iframe.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Test for B2G PresentationReceiver in an inner iframe of the receiver page at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_reconnect.html b/dom/presentation/tests/mochitest/file_presentation_reconnect.html deleted file mode 100644 index 174ccd3f3..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_reconnect.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - -Test allow-presentation sandboxing flag - - - - - diff --git a/dom/presentation/tests/mochitest/file_presentation_sandboxed_presentation.html b/dom/presentation/tests/mochitest/file_presentation_sandboxed_presentation.html deleted file mode 100644 index 369621cee..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_sandboxed_presentation.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - -Test allow-presentation sandboxing flag - - - - - diff --git a/dom/presentation/tests/mochitest/file_presentation_terminate.html b/dom/presentation/tests/mochitest/file_presentation_terminate.html deleted file mode 100644 index a26a44b90..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_terminate.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - Test for B2G PresentationReceiver at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_terminate_establish_connection_error.html b/dom/presentation/tests/mochitest/file_presentation_terminate_establish_connection_error.html deleted file mode 100644 index d8df8a1a6..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_terminate_establish_connection_error.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - Test for B2G PresentationReceiver at receiver side - - -
- - - diff --git a/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test b/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test deleted file mode 100644 index 8b1378917..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test^headers^ b/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test^headers^ deleted file mode 100644 index fc044e3c4..000000000 --- a/dom/presentation/tests/mochitest/file_presentation_unknown_content_type.test^headers^ +++ /dev/null @@ -1 +0,0 @@ -Content-Type: application/unknown diff --git a/dom/presentation/tests/mochitest/mochitest.ini b/dom/presentation/tests/mochitest/mochitest.ini deleted file mode 100644 index f96e07f1e..000000000 --- a/dom/presentation/tests/mochitest/mochitest.ini +++ /dev/null @@ -1,77 +0,0 @@ -[DEFAULT] -support-files = - PresentationDeviceInfoChromeScript.js - PresentationSessionChromeScript.js - PresentationSessionFrameScript.js - PresentationSessionChromeScript1UA.js - file_presentation_1ua_receiver.html - test_presentation_1ua_sender_and_receiver.js - file_presentation_non_receiver_inner_iframe.html - file_presentation_non_receiver.html - file_presentation_receiver.html - file_presentation_receiver_establish_connection_error.html - file_presentation_receiver_inner_iframe.html - file_presentation_1ua_wentaway.html - test_presentation_1ua_connection_wentaway.js - file_presentation_receiver_auxiliary_navigation.html - test_presentation_receiver_auxiliary_navigation.js - file_presentation_sandboxed_presentation.html - file_presentation_terminate.html - test_presentation_terminate.js - file_presentation_terminate_establish_connection_error.html - test_presentation_terminate_establish_connection_error.js - file_presentation_reconnect.html - file_presentation_unknown_content_type.test - file_presentation_unknown_content_type.test^headers^ - test_presentation_tcp_receiver_establish_connection_unknown_content_type.js - file_presentation_mixed_security_contexts.html - -[test_presentation_dc_sender.html] -[test_presentation_dc_receiver.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_dc_receiver_oop.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_1ua_sender_and_receiver_inproc.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_1ua_sender_and_receiver_oop.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_1ua_connection_wentaway_inproc.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_1ua_connection_wentaway_oop.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_device_info_permission.html] -[test_presentation_tcp_sender_disconnect.html] -skip-if = toolkit == 'android' # Bug 1129785 -[test_presentation_tcp_sender_establish_connection_error.html] -skip-if = toolkit == 'android' # Bug 1129785 -[test_presentation_tcp_receiver_establish_connection_error.html] -skip-if = (e10s || toolkit == 'android' || os == 'mac' || os == 'win') # Bug 1129785, Bug 1204709 -[test_presentation_tcp_receiver_establish_connection_timeout.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_tcp_receiver_establish_connection_unknown_content_type_inproc.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_tcp_receiver_establish_connection_unknown_content_type_oop.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_tcp_receiver.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_tcp_receiver_oop.html] -skip-if = (e10s || toolkit == 'android') # Bug 1129785 -[test_presentation_receiver_auxiliary_navigation_inproc.html] -skip-if = e10s -[test_presentation_receiver_auxiliary_navigation_oop.html] -skip-if = e10s -[test_presentation_terminate_inproc.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_terminate_oop.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_terminate_establish_connection_error_inproc.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_terminate_establish_connection_error_oop.html] -skip-if = (e10s || toolkit == 'android') -[test_presentation_sender_on_terminate_request.html] -skip-if = toolkit == 'android' -[test_presentation_sandboxed_presentation.html] -skip-if = true # bug 1315867 -[test_presentation_reconnect.html] -[test_presentation_mixed_security_contexts.html] -[test_presentation_availability.html] diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway.js b/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway.js deleted file mode 100644 index dbeb4ffcc..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway.js +++ /dev/null @@ -1,175 +0,0 @@ -'use strict'; - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout('Test for guarantee not firing async event'); - -function debug(str) { - // info(str); -} - -var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript1UA.js')); -var receiverUrl = SimpleTest.getTestFileURL('file_presentation_1ua_wentaway.html'); -var request; -var connection; -var receiverIframe; - -function setup() { - gScript.addMessageListener('device-prompt', function devicePromptHandler() { - debug('Got message: device-prompt'); - gScript.removeMessageListener('device-prompt', devicePromptHandler); - gScript.sendAsyncMessage('trigger-device-prompt-select'); - }); - - gScript.addMessageListener('control-channel-established', function controlChannelEstablishedHandler() { - gScript.removeMessageListener('control-channel-established', - controlChannelEstablishedHandler); - gScript.sendAsyncMessage("trigger-control-channel-open"); - }); - - gScript.addMessageListener('sender-launch', function senderLaunchHandler(url) { - debug('Got message: sender-launch'); - gScript.removeMessageListener('sender-launch', senderLaunchHandler); - is(url, receiverUrl, 'Receiver: should receive the same url'); - receiverIframe = document.createElement('iframe'); - receiverIframe.setAttribute("mozbrowser", "true"); - receiverIframe.setAttribute("mozpresentation", receiverUrl); - var oop = location.pathname.indexOf('_inproc') == -1; - receiverIframe.setAttribute("remote", oop); - - receiverIframe.setAttribute('src', receiverUrl); - receiverIframe.addEventListener("mozbrowserloadend", function mozbrowserloadendHander() { - receiverIframe.removeEventListener("mozbrowserloadend", mozbrowserloadendHander); - info("Receiver loaded."); - }); - - // This event is triggered when the iframe calls "alert". - receiverIframe.addEventListener("mozbrowsershowmodalprompt", function receiverListener(evt) { - var message = evt.detail.message; - if (/^OK /.exec(message)) { - ok(true, message.replace(/^OK /, "")); - } else if (/^KO /.exec(message)) { - ok(false, message.replace(/^KO /, "")); - } else if (/^INFO /.exec(message)) { - info(message.replace(/^INFO /, "")); - } else if (/^COMMAND /.exec(message)) { - var command = JSON.parse(message.replace(/^COMMAND /, "")); - gScript.sendAsyncMessage(command.name, command.data); - } else if (/^DONE$/.exec(message)) { - receiverIframe.removeEventListener("mozbrowsershowmodalprompt", - receiverListener); - teardown(); - } - }, false); - - var promise = new Promise(function(aResolve, aReject) { - document.body.appendChild(receiverIframe); - aResolve(receiverIframe); - }); - - var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"] - .getService(SpecialPowers.Ci.nsIObserverService); - obs.notifyObservers(promise, 'setup-request-promise', null); - }); - - gScript.addMessageListener('promise-setup-ready', function promiseSetupReadyHandler() { - debug('Got message: promise-setup-ready'); - gScript.removeMessageListener('promise-setup-ready', - promiseSetupReadyHandler); - gScript.sendAsyncMessage('trigger-on-session-request', receiverUrl); - }); - - return Promise.resolve(); -} - -function testCreateRequest() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testCreateRequest ---'); - request = new PresentationRequest(receiverUrl); - request.getAvailability().then((aAvailability) => { - is(aAvailability.value, false, "Sender: should have no available device after setup"); - aAvailability.onchange = function() { - aAvailability.onchange = null; - ok(aAvailability.value, "Sender: Device should be available."); - aResolve(); - } - - gScript.sendAsyncMessage('trigger-device-add'); - }).catch((aError) => { - ok(false, "Sender: Error occurred when getting availability: " + aError); - teardown(); - aReject(); - }); - }); -} - -function testStartConnection() { - return new Promise(function(aResolve, aReject) { - request.start().then((aConnection) => { - connection = aConnection; - ok(connection, "Sender: Connection should be available."); - ok(connection.id, "Sender: Connection ID should be set."); - is(connection.state, "connecting", "Sender: The initial state should be connecting."); - connection.onconnect = function() { - connection.onconnect = null; - is(connection.state, "connected", "Connection should be connected."); - aResolve(); - }; - }).catch((aError) => { - ok(false, "Sender: Error occurred when establishing a connection: " + aError); - teardown(); - aReject(); - }); - }); -} - -function testConnectionWentaway() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testConnectionWentaway ---'); - connection.onclose = function() { - connection.onclose = null; - is(connection.state, "closed", "Sender: Connection should be closed."); - receiverIframe.addEventListener('mozbrowserclose', function closeHandler() { - ok(false, 'wentaway should not trigger receiver close'); - aResolve(); - }); - setTimeout(aResolve, 3000); - }; - gScript.addMessageListener('ready-to-remove-receiverFrame', function onReadyToRemove() { - gScript.removeMessageListener('ready-to-remove-receiverFrame', onReadyToRemove); - receiverIframe.src = "http://example.com"; - }); - }); -} - -function teardown() { - gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() { - debug('Got message: teardown-complete'); - gScript.removeMessageListener('teardown-complete', teardownCompleteHandler); - gScript.destroy(); - SimpleTest.finish(); - }); - - gScript.sendAsyncMessage('teardown'); -} - -function runTests() { - setup().then(testCreateRequest) - .then(testStartConnection) - .then(testConnectionWentaway) - .then(teardown); -} - -SpecialPowers.pushPermissions([ - {type: 'presentation-device-manage', allow: false, context: document}, - {type: "browser", allow: true, context: document}, -], () => { - SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true], - ["dom.presentation.controller.enabled", true], - ["dom.presentation.receiver.enabled", true], - ["dom.presentation.test.enabled", true], - ["dom.mozBrowserFramesEnabled", true], - ["dom.ipc.tabs.disabled", false], - ["network.disable.ipc.security", true], - ["dom.presentation.test.stage", 0]]}, - runTests); -}); diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html b/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html deleted file mode 100644 index 68491d81b..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Test for B2G Presentation API when sender and receiver at the same side - - - - - - Test for PresentationConnectionCloseEvent with wentaway reason - - - diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html b/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html deleted file mode 100644 index 68491d81b..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Test for B2G Presentation API when sender and receiver at the same side - - - - - - Test for PresentationConnectionCloseEvent with wentaway reason - - - diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver.js b/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver.js deleted file mode 100644 index 8a7787b40..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver.js +++ /dev/null @@ -1,370 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, -* You can obtain one at http://mozilla.org/MPL/2.0/. */ - -'use strict'; - -function debug(str) { - // info(str); -} - -var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript1UA.js')); -var receiverUrl = SimpleTest.getTestFileURL('file_presentation_1ua_receiver.html'); -var request; -var connection; -var receiverIframe; -var presentationId; -const DATA_ARRAY = [0, 255, 254, 0, 1, 2, 3, 0, 255, 255, 254, 0]; -const DATA_ARRAY_BUFFER = new ArrayBuffer(DATA_ARRAY.length); -const TYPED_DATA_ARRAY = new Uint8Array(DATA_ARRAY_BUFFER); -TYPED_DATA_ARRAY.set(DATA_ARRAY); - -function postMessageToIframe(aType) { - receiverIframe.src = receiverUrl + "#" + - encodeURIComponent(JSON.stringify({ type: aType })); -} - -function setup() { - - gScript.addMessageListener('device-prompt', function devicePromptHandler() { - debug('Got message: device-prompt'); - gScript.removeMessageListener('device-prompt', devicePromptHandler); - gScript.sendAsyncMessage('trigger-device-prompt-select'); - }); - - gScript.addMessageListener('control-channel-established', function controlChannelEstablishedHandler() { - gScript.removeMessageListener('control-channel-established', - controlChannelEstablishedHandler); - gScript.sendAsyncMessage("trigger-control-channel-open"); - }); - - gScript.addMessageListener('sender-launch', function senderLaunchHandler(url) { - debug('Got message: sender-launch'); - gScript.removeMessageListener('sender-launch', senderLaunchHandler); - is(url, receiverUrl, 'Receiver: should receive the same url'); - receiverIframe = document.createElement('iframe'); - receiverIframe.setAttribute('src', receiverUrl); - receiverIframe.setAttribute("mozbrowser", "true"); - receiverIframe.setAttribute("mozpresentation", receiverUrl); - var oop = location.pathname.indexOf('_inproc') == -1; - receiverIframe.setAttribute("remote", oop); - - // This event is triggered when the iframe calls "alert". - receiverIframe.addEventListener("mozbrowsershowmodalprompt", function receiverListener(evt) { - var message = evt.detail.message; - debug('Got iframe message: ' + message); - if (/^OK /.exec(message)) { - ok(true, message.replace(/^OK /, "")); - } else if (/^KO /.exec(message)) { - ok(false, message.replace(/^KO /, "")); - } else if (/^INFO /.exec(message)) { - info(message.replace(/^INFO /, "")); - } else if (/^COMMAND /.exec(message)) { - var command = JSON.parse(message.replace(/^COMMAND /, "")); - gScript.sendAsyncMessage(command.name, command.data); - } else if (/^DONE$/.exec(message)) { - receiverIframe.removeEventListener("mozbrowsershowmodalprompt", - receiverListener); - } - }, false); - - var promise = new Promise(function(aResolve, aReject) { - document.body.appendChild(receiverIframe); - aResolve(receiverIframe); - }); - - var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"] - .getService(SpecialPowers.Ci.nsIObserverService); - obs.notifyObservers(promise, 'setup-request-promise', null); - }); - - gScript.addMessageListener('promise-setup-ready', function promiseSetupReadyHandler() { - debug('Got message: promise-setup-ready'); - gScript.removeMessageListener('promise-setup-ready', promiseSetupReadyHandler); - gScript.sendAsyncMessage('trigger-on-session-request', receiverUrl); - }); - - return Promise.resolve(); -} - -function testCreateRequest() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testCreateRequest ---'); - request = new PresentationRequest("file_presentation_1ua_receiver.html"); - request.getAvailability().then((aAvailability) => { - is(aAvailability.value, false, "Sender: should have no available device after setup"); - aAvailability.onchange = function() { - aAvailability.onchange = null; - ok(aAvailability.value, "Sender: Device should be available."); - aResolve(); - } - - gScript.sendAsyncMessage('trigger-device-add'); - }).catch((aError) => { - ok(false, "Sender: Error occurred when getting availability: " + aError); - teardown(); - aReject(); - }); - }); -} - -function testStartConnection() { - return new Promise(function(aResolve, aReject) { - request.start().then((aConnection) => { - connection = aConnection; - ok(connection, "Sender: Connection should be available."); - ok(connection.id, "Sender: Connection ID should be set."); - is(connection.state, "connecting", "The initial state should be connecting."); - is(connection.url, receiverUrl, "request URL should be expanded to absolute URL"); - connection.onconnect = function() { - connection.onconnect = null; - is(connection.state, "connected", "Connection should be connected."); - presentationId = connection.id; - aResolve(); - }; - }).catch((aError) => { - ok(false, "Sender: Error occurred when establishing a connection: " + aError); - teardown(); - aReject(); - }); - - let request2 = new PresentationRequest("/"); - request2.start().then(() => { - ok(false, "Sender: session start should fail while there is an unsettled promise."); - }).catch((aError) => { - is(aError.name, "OperationError", "Expect to get OperationError."); - }); - }); -} - -function testSendMessage() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testSendMessage ---'); - gScript.addMessageListener('trigger-message-from-sender', function triggerMessageFromSenderHandler() { - debug('Got message: trigger-message-from-sender'); - gScript.removeMessageListener('trigger-message-from-sender', triggerMessageFromSenderHandler); - info('Send message to receiver'); - connection.send('msg-sender-to-receiver'); - }); - - gScript.addMessageListener('message-from-sender-received', function messageFromSenderReceivedHandler() { - debug('Got message: message-from-sender-received'); - gScript.removeMessageListener('message-from-sender-received', messageFromSenderReceivedHandler); - aResolve(); - }); - }); -} - -function testIncomingMessage() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testIncomingMessage ---'); - connection.addEventListener('message', function messageHandler(evt) { - connection.removeEventListener('message', messageHandler); - let msg = evt.data; - is(msg, "msg-receiver-to-sender", "Sender: Sender should receive message from Receiver"); - postMessageToIframe('message-from-receiver-received'); - aResolve(); - }); - postMessageToIframe('trigger-message-from-receiver'); - }); -} - -function testSendBlobMessage() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testSendBlobMessage ---'); - connection.addEventListener('message', function messageHandler(evt) { - connection.removeEventListener('message', messageHandler); - let msg = evt.data; - is(msg, "testIncomingBlobMessage", "Sender: Sender should receive message from Receiver"); - let blob = new Blob(["Hello World"], {type : 'text/plain'}); - connection.send(blob); - aResolve(); - }); - }); -} - -function testSendArrayBuffer() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testSendArrayBuffer ---'); - connection.addEventListener('message', function messageHandler(evt) { - connection.removeEventListener('message', messageHandler); - let msg = evt.data; - is(msg, "testIncomingArrayBuffer", "Sender: Sender should receive message from Receiver"); - connection.send(DATA_ARRAY_BUFFER); - aResolve(); - }); - }); -} - -function testSendArrayBufferView() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testSendArrayBufferView ---'); - connection.addEventListener('message', function messageHandler(evt) { - connection.removeEventListener('message', messageHandler); - let msg = evt.data; - is(msg, "testIncomingArrayBufferView", "Sender: Sender should receive message from Receiver"); - connection.send(TYPED_DATA_ARRAY); - aResolve(); - }); - }); -} - -function testCloseConnection() { - info('Sender: --- testCloseConnection ---'); - // Test terminate immediate after close. - function controlChannelEstablishedHandler() - { - gScript.removeMessageListener('control-channel-established', - controlChannelEstablishedHandler); - ok(false, "terminate after close should do nothing"); - } - gScript.addMessageListener('ready-to-close', function onReadyToClose() { - gScript.removeMessageListener('ready-to-close', onReadyToClose); - connection.close(); - - gScript.addMessageListener('control-channel-established', controlChannelEstablishedHandler); - connection.terminate(); - }); - - return Promise.all([ - new Promise(function(aResolve, aReject) { - connection.onclose = function() { - connection.onclose = null; - is(connection.state, 'closed', 'Sender: Connection should be closed.'); - gScript.removeMessageListener('control-channel-established', - controlChannelEstablishedHandler); - aResolve(); - }; - }), - new Promise(function(aResolve, aReject) { - let timeout = setTimeout(function() { - gScript.removeMessageListener('device-disconnected', - deviceDisconnectedHandler); - ok(true, "terminate after close should not trigger device.disconnect"); - aResolve(); - }, 3000); - - function deviceDisconnectedHandler() { - gScript.removeMessageListener('device-disconnected', - deviceDisconnectedHandler); - ok(false, "terminate after close should not trigger device.disconnect"); - clearTimeout(timeout); - aResolve(); - } - - gScript.addMessageListener('device-disconnected', deviceDisconnectedHandler); - }), - new Promise(function(aResolve, aReject) { - gScript.addMessageListener('receiver-closed', function onReceiverClosed() { - gScript.removeMessageListener('receiver-closed', onReceiverClosed); - gScript.removeMessageListener('control-channel-established', - controlChannelEstablishedHandler); - aResolve(); - }); - }), - ]); -} - -function testTerminateAfterClose() { - info('Sender: --- testTerminateAfterClose ---'); - return Promise.race([ - new Promise(function(aResolve, aReject) { - connection.onterminate = function() { - connection.onterminate = null; - ok(false, 'terminate after close should do nothing'); - aResolve(); - }; - connection.terminate(); - }), - new Promise(function(aResolve, aReject) { - setTimeout(function() { - is(connection.state, 'closed', 'Sender: Connection should be closed.'); - aResolve(); - }, 3000); - }), - ]); -} - -function testReconnect() { - return new Promise(function(aResolve, aReject) { - info('Sender: --- testReconnect ---'); - gScript.addMessageListener('control-channel-established', function controlChannelEstablished() { - gScript.removeMessageListener('control-channel-established', controlChannelEstablished); - gScript.sendAsyncMessage("trigger-control-channel-open"); - }); - - gScript.addMessageListener('start-reconnect', function startReconnectHandler(url) { - debug('Got message: start-reconnect'); - gScript.removeMessageListener('start-reconnect', startReconnectHandler); - is(url, receiverUrl, "URLs should be the same.") - gScript.sendAsyncMessage('trigger-reconnected-acked', url); - }); - - gScript.addMessageListener('ready-to-reconnect', function onReadyToReconnect() { - gScript.removeMessageListener('ready-to-reconnect', onReadyToReconnect); - request.reconnect(presentationId).then((aConnection) => { - connection = aConnection; - ok(connection, "Sender: Connection should be available."); - is(connection.id, presentationId, "The presentationId should be the same."); - is(connection.state, "connecting", "The initial state should be connecting."); - connection.onconnect = function() { - connection.onconnect = null; - is(connection.state, "connected", "Connection should be connected."); - aResolve(); - }; - }).catch((aError) => { - ok(false, "Sender: Error occurred when establishing a connection: " + aError); - teardown(); - aReject(); - }); - }); - - postMessageToIframe('prepare-for-reconnect'); - }); -} - -function teardown() { - gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() { - debug('Got message: teardown-complete'); - gScript.removeMessageListener('teardown-complete', teardownCompleteHandler); - gScript.destroy(); - SimpleTest.finish(); - }); - - gScript.sendAsyncMessage('teardown'); -} - -function runTests() { - setup().then(testCreateRequest) - .then(testStartConnection) - .then(testSendMessage) - .then(testIncomingMessage) - .then(testSendBlobMessage) - .then(testCloseConnection) - .then(testReconnect) - .then(testSendArrayBuffer) - .then(testSendArrayBufferView) - .then(testCloseConnection) - .then(testTerminateAfterClose) - .then(teardown); -} - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout('Test for guarantee not firing async event'); -SpecialPowers.pushPermissions([ - {type: 'presentation-device-manage', allow: false, context: document}, - {type: "browser", allow: true, context: document}, -], () => { - SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true], - /* Mocked TCP session transport builder in the test */ - ["dom.presentation.session_transport.data_channel.enable", true], - ["dom.presentation.controller.enabled", true], - ["dom.presentation.receiver.enabled", true], - ["dom.presentation.test.enabled", true], - ["dom.presentation.test.stage", 0], - ["dom.mozBrowserFramesEnabled", true], - ["network.disable.ipc.security", true], - ["media.navigator.permission.disabled", true]]}, - runTests); -}); diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_inproc.html b/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_inproc.html deleted file mode 100644 index 520b1a98c..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_inproc.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Test for B2G Presentation API when sender and receiver at the same side - - - - - - Test for B2G Presentation API when sender and receiver at the same side - - - diff --git a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_oop.html b/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_oop.html deleted file mode 100644 index e744e6802..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_1ua_sender_and_receiver_oop.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Test for B2G Presentation API when sender and receiver at the same side (OOP ver.) - - - - - - Test for B2G Presentation API when sender and receiver at the same side (OOP ver.) - - - diff --git a/dom/presentation/tests/mochitest/test_presentation_availability.html b/dom/presentation/tests/mochitest/test_presentation_availability.html deleted file mode 100644 index 89f1ad1b7..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_availability.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - Test for PresentationAvailability - - - - -Test PresentationAvailability - - - diff --git a/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html b/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html deleted file mode 100644 index 89a51afb7..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - Test for data channel as session transport in Presentation API - - - - -Test for data channel as session transport in Presentation API - -
-
-
- - diff --git a/dom/presentation/tests/mochitest/test_presentation_dc_receiver.html b/dom/presentation/tests/mochitest/test_presentation_dc_receiver.html deleted file mode 100644 index a42489bdb..000000000 --- a/dom/presentation/tests/mochitest/test_presentation_dc_receiver.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - Test for B2G PresentationConnection API at receiver side - - - - -Test for B2G PresentationConnection API at receiver side -

- -

-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_dc_receiver_oop.html b/dom/presentation/tests/mochitest/test_presentation_dc_receiver_oop.html
deleted file mode 100644
index b289b0be6..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_dc_receiver_oop.html
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
-  
-  Test for B2G PresentationConnection API at receiver side (OOP)
-  
-  
-  
-
-
-Test B2G PresentationConnection API at receiver side (OOP)
-

- -

-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_dc_sender.html b/dom/presentation/tests/mochitest/test_presentation_dc_sender.html
deleted file mode 100644
index 97e252e84..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_dc_sender.html
+++ /dev/null
@@ -1,291 +0,0 @@
-
-
-
-
-  
-  Test for B2G Presentation API at sender side
-  
-  
-  
-
-
-Test for B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_device_info.html b/dom/presentation/tests/mochitest/test_presentation_device_info.html
deleted file mode 100644
index 77253e41d..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_device_info.html
+++ /dev/null
@@ -1,144 +0,0 @@
-
-
-
-
-  
-  Test for B2G Presentation Device Info API
-  
-  
-
-
-Test for B2G Presentation Device Info API
-
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_device_info_permission.html b/dom/presentation/tests/mochitest/test_presentation_device_info_permission.html
deleted file mode 100644
index c7f7ac96d..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_device_info_permission.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-  
-  Test for B2G Presentation Device Info API Permission
-  
-  
-
-
-Test for B2G Presentation Device Info API Permission
-
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html b/dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html
deleted file mode 100644
index 31918a2c4..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-  
-  Test default request for B2G Presentation API at sender side
-  
-  
-
-
-Test allow-presentation sandboxing flag
-
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation.js b/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation.js
deleted file mode 100644
index 0647bff3a..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation.js
+++ /dev/null
@@ -1,77 +0,0 @@
-"use strict";
-
-var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL("PresentationSessionChromeScript.js"));
-var receiverUrl = SimpleTest.getTestFileURL("file_presentation_receiver_auxiliary_navigation.html");
-
-var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
-          .getService(SpecialPowers.Ci.nsIObserverService);
-
-function setup() {
-  return new Promise(function(aResolve, aReject) {
-    gScript.sendAsyncMessage("trigger-device-add");
-
-    var iframe = document.createElement("iframe");
-    iframe.setAttribute("mozbrowser", "true");
-    iframe.setAttribute("mozpresentation", receiverUrl);
-    var oop = location.pathname.indexOf('_inproc') == -1;
-    iframe.setAttribute("remote", oop);
-    iframe.setAttribute("src", receiverUrl);
-
-    // This event is triggered when the iframe calls "postMessage".
-    iframe.addEventListener("mozbrowsershowmodalprompt", function listener(aEvent) {
-      var message = aEvent.detail.message;
-      if (/^OK /.exec(message)) {
-        ok(true, "Message from iframe: " + message);
-      } else if (/^KO /.exec(message)) {
-        ok(false, "Message from iframe: " + message);
-      } else if (/^INFO /.exec(message)) {
-        info("Message from iframe: " + message);
-      } else if (/^COMMAND /.exec(message)) {
-        var command = JSON.parse(message.replace(/^COMMAND /, ""));
-        gScript.sendAsyncMessage(command.name, command.data);
-      } else if (/^DONE$/.exec(message)) {
-        ok(true, "Messaging from iframe complete.");
-        iframe.removeEventListener("mozbrowsershowmodalprompt", listener);
-
-        teardown();
-      }
-    }, false);
-
-    var promise = new Promise(function(aResolve, aReject) {
-      document.body.appendChild(iframe);
-
-      aResolve(iframe);
-    });
-    obs.notifyObservers(promise, "setup-request-promise", null);
-
-    aResolve();
-  });
-}
-
-function teardown() {
-  gScript.addMessageListener("teardown-complete", function teardownCompleteHandler() {
-    gScript.removeMessageListener("teardown-complete", teardownCompleteHandler);
-    gScript.destroy();
-    SimpleTest.finish();
-  });
-
-  gScript.sendAsyncMessage("teardown");
-}
-
-function runTests() {
-  setup().then();
-}
-
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPermissions([
-  {type: "presentation-device-manage", allow: false, context: document},
-  {type: "browser", allow: true, context: document},
-], function() {
-  SpecialPowers.pushPrefEnv({ "set": [["dom.presentation.enabled", true],
-                                      ["dom.presentation.controller.enabled", true],
-                                      ["dom.presentation.receiver.enabled", true],
-                                      ["dom.mozBrowserFramesEnabled", true],
-                                      ["network.disable.ipc.security", true],
-                                      ["dom.presentation.session_transport.data_channel.enable", false]]},
-                            runTests);
-});
diff --git a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_inproc.html b/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_inproc.html
deleted file mode 100644
index f873fa3da..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_inproc.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for B2G Presentation API when sender and receiver at the same side
-    
-    
-  
-  
-    
-      Test for receiver page with sandboxed auxiliary navigation browsing context flag.
-    
-  
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_oop.html b/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_oop.html
deleted file mode 100644
index f873fa3da..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_receiver_auxiliary_navigation_oop.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for B2G Presentation API when sender and receiver at the same side
-    
-    
-  
-  
-    
-      Test for receiver page with sandboxed auxiliary navigation browsing context flag.
-    
-  
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_reconnect.html b/dom/presentation/tests/mochitest/test_presentation_reconnect.html
deleted file mode 100644
index 079b7f5c5..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_reconnect.html
+++ /dev/null
@@ -1,379 +0,0 @@
-
-
-
-
-  
-  Test for B2G Presentation API at sender side
-  
-  
-  
-
-
-Test for Presentation API at sender side
-
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_sandboxed_presentation.html b/dom/presentation/tests/mochitest/test_presentation_sandboxed_presentation.html
deleted file mode 100644
index dc17209c5..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_sandboxed_presentation.html
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-  
-  Test default request for B2G Presentation API at sender side
-  
-  
-
-
-Test allow-presentation sandboxing flag
-
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html b/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html
deleted file mode 100644
index d0c8af0ad..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-  
-  Test onTerminateRequest at sender side
-  
-  
-
-
-Test onTerminateRequest at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html b/dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html
deleted file mode 100644
index 27b17bb32..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_sender_startWithDevice.html
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
-
-  
-  Test startWithDevice for B2G Presentation API at sender side
-  
-  
-
-
-Test startWithDevice for B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver.html
deleted file mode 100644
index f26184f0b..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver.html
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
-  
-  Test for B2G PresentationConnection API at receiver side
-  
-  
-
-
-Test for B2G PresentationConnection API at receiver side
-

- -

-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_error.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_error.html
deleted file mode 100644
index 0935aaaf9..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_error.html
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-  
-  Test for connection establishing errors of B2G Presentation API at receiver side
-  
-  
-
-
-Test for connection establishing errors of B2G Presentation API at receiver side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_timeout.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_timeout.html
deleted file mode 100644
index 1dc002644..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_timeout.html
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-  
-  Test for connection establishing timeout of B2G Presentation API at receiver side
-  
-  
-
-
-Test for connection establishing timeout of B2G Presentation API at receiver side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type.js b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type.js
deleted file mode 100644
index d73f84cf8..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type.js
+++ /dev/null
@@ -1,88 +0,0 @@
-'use strict';
-
-var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript.js'));
-var receiverUrl = SimpleTest.getTestFileURL('file_presentation_unknown_content_type.test');
-
-var obs = SpecialPowers.Cc['@mozilla.org/observer-service;1']
-          .getService(SpecialPowers.Ci.nsIObserverService);
-
-var receiverIframe;
-
-function setup() {
-  return new Promise(function(aResolve, aReject) {
-    gScript.sendAsyncMessage('trigger-device-add');
-
-    receiverIframe = document.createElement('iframe');
-    receiverIframe.setAttribute('mozbrowser', 'true');
-    receiverIframe.setAttribute('mozpresentation', receiverUrl);
-    receiverIframe.setAttribute('src', receiverUrl);
-    var oop = location.pathname.indexOf('_inproc') == -1;
-    receiverIframe.setAttribute("remote", oop);
-
-    var promise = new Promise(function(aResolve, aReject) {
-      document.body.appendChild(receiverIframe);
-
-      aResolve(receiverIframe);
-    });
-    obs.notifyObservers(promise, 'setup-request-promise', null);
-
-    aResolve();
-  });
-}
-
-function testIncomingSessionRequestReceiverLaunchUnknownContentType() {
-  let promise = Promise.all([
-    new Promise(function(aResolve, aReject) {
-      gScript.addMessageListener('receiver-launching', function launchReceiverHandler(aSessionId) {
-        gScript.removeMessageListener('receiver-launching', launchReceiverHandler);
-        info('Trying to launch receiver page.');
-
-        receiverIframe.addEventListener('mozbrowserclose', function() {
-          ok(true, 'observe receiver window closed');
-          aResolve();
-        });
-      });
-    }),
-    new Promise(function(aResolve, aReject) {
-      gScript.addMessageListener('control-channel-closed', function controlChannelClosedHandler(aReason) {
-        gScript.removeMessageListener('control-channel-closed', controlChannelClosedHandler);
-        is(aReason, 0x80530020 /* NS_ERROR_DOM_OPERATION_ERR */, 'The control channel is closed due to load failure.');
-        aResolve();
-      });
-    })
-  ]);
-
-  gScript.sendAsyncMessage('trigger-incoming-session-request', receiverUrl);
-  return promise;
-}
-
-function teardown() {
-  gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() {
-    gScript.removeMessageListener('teardown-complete', teardownCompleteHandler);
-    gScript.destroy();
-    SimpleTest.finish();
-  });
-
-  gScript.sendAsyncMessage('teardown');
-}
-
-function runTests() {
-  setup().
-  then(testIncomingSessionRequestReceiverLaunchUnknownContentType).
-  then(teardown);
-}
-
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: false, context: document},
-  {type: 'browser', allow: true, context: document},
-], function() {
-  SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
-                                      ["dom.presentation.controller.enabled", true],
-                                      ["dom.presentation.receiver.enabled", true],
-                                      ['dom.presentation.session_transport.data_channel.enable', false],
-                                      ['dom.mozBrowserFramesEnabled', true],
-                                      ["network.disable.ipc.security", true],
-                                      ['dom.ipc.tabs.disabled', false]]},
-                            runTests);
-});
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_inproc.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_inproc.html
deleted file mode 100644
index 8ade1d72d..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_inproc.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-  
-  Test for unknown content type of B2G Presentation API at receiver side
-  
-  
-
-
-Test for unknown content type of B2G Presentation API at receiver side
-    
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_oop.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_oop.html
deleted file mode 100644
index b2d2d3c6e..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_establish_connection_unknown_content_type_oop.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-  
-  Test for unknown content type of B2G Presentation API at receiver side (OOP)
-  
-  
-
-
-Test for unknown content type of B2G Presentation API at receiver side (OOP)
-    
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_oop.html b/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_oop.html
deleted file mode 100644
index bfbc7947a..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_receiver_oop.html
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
-
-  
-  Test for B2G PresentationConnection API at receiver side (OOP)
-  
-  
-
-
-Test B2G PresentationConnection API at receiver side (OOP)
-

- -

-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_sender.html b/dom/presentation/tests/mochitest/test_presentation_tcp_sender.html
deleted file mode 100644
index 8df34c884..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender.html
+++ /dev/null
@@ -1,260 +0,0 @@
-
-
-
-
-  
-  Test for B2G Presentation API at sender side
-  
-  
-
-
-Test for B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html b/dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html
deleted file mode 100644
index 60247ec98..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_default_request.html
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-  
-  Test default request for B2G Presentation API at sender side
-  
-  
-
-
-Test default request for B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_disconnect.html b/dom/presentation/tests/mochitest/test_presentation_tcp_sender_disconnect.html
deleted file mode 100644
index a95da104f..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_disconnect.html
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
-  
-  Test for disconnection of B2G Presentation API at sender side
-  
-  
-
-
-Test for disconnection of B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_establish_connection_error.html b/dom/presentation/tests/mochitest/test_presentation_tcp_sender_establish_connection_error.html
deleted file mode 100644
index 557ae71a6..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_tcp_sender_establish_connection_error.html
+++ /dev/null
@@ -1,514 +0,0 @@
-
-
-
-
-  
-  Test for connection establishing errors of B2G Presentation API at sender side
-  
-  
-
-
-Test for connection establishing errors of B2G Presentation API at sender side
-
-
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate.js b/dom/presentation/tests/mochitest/test_presentation_terminate.js
deleted file mode 100644
index 8ebfd9d64..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate.js
+++ /dev/null
@@ -1,243 +0,0 @@
-'use strict';
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.requestFlakyTimeout('Test for guarantee not firing async event');
-
-function debug(str) {
-  // info(str);
-}
-
-var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript1UA.js'));
-var receiverUrl = SimpleTest.getTestFileURL('file_presentation_terminate.html');
-var request;
-var connection;
-var receiverIframe;
-
-function setup() {
-  gScript.addMessageListener('device-prompt', function devicePromptHandler() {
-    debug('Got message: device-prompt');
-    gScript.removeMessageListener('device-prompt', devicePromptHandler);
-    gScript.sendAsyncMessage('trigger-device-prompt-select');
-  });
-
-  gScript.addMessageListener('control-channel-established', function controlChannelEstablishedHandler() {
-    gScript.removeMessageListener('control-channel-established',
-                                  controlChannelEstablishedHandler);
-    gScript.sendAsyncMessage('trigger-control-channel-open');
-  });
-
-  gScript.addMessageListener('sender-launch', function senderLaunchHandler(url) {
-    debug('Got message: sender-launch');
-    gScript.removeMessageListener('sender-launch', senderLaunchHandler);
-    is(url, receiverUrl, 'Receiver: should receive the same url');
-    receiverIframe = document.createElement('iframe');
-    receiverIframe.setAttribute('mozbrowser', 'true');
-    receiverIframe.setAttribute('mozpresentation', receiverUrl);
-    var oop = location.pathname.indexOf('_inproc') == -1;
-    receiverIframe.setAttribute('remote', oop);
-
-    receiverIframe.setAttribute('src', receiverUrl);
-    receiverIframe.addEventListener('mozbrowserloadend', function mozbrowserloadendHander() {
-      receiverIframe.removeEventListener('mozbrowserloadend', mozbrowserloadendHander);
-      info('Receiver loaded.');
-    });
-
-    // This event is triggered when the iframe calls 'alert'.
-    receiverIframe.addEventListener('mozbrowsershowmodalprompt', function receiverListener(evt) {
-      var message = evt.detail.message;
-      if (/^OK /.exec(message)) {
-        ok(true, message.replace(/^OK /, ''));
-      } else if (/^KO /.exec(message)) {
-        ok(false, message.replace(/^KO /, ''));
-      } else if (/^INFO /.exec(message)) {
-        info(message.replace(/^INFO /, ''));
-      } else if (/^COMMAND /.exec(message)) {
-        var command = JSON.parse(message.replace(/^COMMAND /, ''));
-        gScript.sendAsyncMessage(command.name, command.data);
-      } else if (/^DONE$/.exec(message)) {
-        ok(true, 'Messaging from iframe complete.');
-        receiverIframe.removeEventListener('mozbrowsershowmodalprompt',
-                                            receiverListener);
-      }
-    }, false);
-
-    var promise = new Promise(function(aResolve, aReject) {
-      document.body.appendChild(receiverIframe);
-      aResolve(receiverIframe);
-    });
-
-    var obs = SpecialPowers.Cc['@mozilla.org/observer-service;1']
-                           .getService(SpecialPowers.Ci.nsIObserverService);
-    obs.notifyObservers(promise, 'setup-request-promise', null);
-  });
-
-  gScript.addMessageListener('promise-setup-ready', function promiseSetupReadyHandler() {
-    debug('Got message: promise-setup-ready');
-    gScript.removeMessageListener('promise-setup-ready',
-                                  promiseSetupReadyHandler);
-    gScript.sendAsyncMessage('trigger-on-session-request', receiverUrl);
-  });
-
-  return Promise.resolve();
-}
-
-function testCreateRequest() {
-  return new Promise(function(aResolve, aReject) {
-    info('Sender: --- testCreateRequest ---');
-    request = new PresentationRequest(receiverUrl);
-    request.getAvailability().then((aAvailability) => {
-      is(aAvailability.value, false, "Sender: should have no available device after setup");
-      aAvailability.onchange = function() {
-        aAvailability.onchange = null;
-        ok(aAvailability.value, 'Sender: Device should be available.');
-        aResolve();
-      }
-
-      gScript.sendAsyncMessage('trigger-device-add');
-    }).catch((aError) => {
-      ok(false, 'Sender: Error occurred when getting availability: ' + aError);
-      teardown();
-      aReject();
-    });
-  });
-}
-
-function testStartConnection() {
-  return new Promise(function(aResolve, aReject) {
-    request.start().then((aConnection) => {
-      connection = aConnection;
-      ok(connection, 'Sender: Connection should be available.');
-      ok(connection.id, 'Sender: Connection ID should be set.');
-      is(connection.state, 'connecting', 'Sender: The initial state should be connecting.');
-      connection.onconnect = function() {
-        connection.onconnect = null;
-        is(connection.state, 'connected', 'Connection should be connected.');
-        aResolve();
-      };
-
-      info('Sender: test terminate at connecting state');
-      connection.onterminate = function() {
-        connection.onterminate = null;
-        ok(false, 'Should not be able to terminate at connecting state');
-        aReject();
-      }
-      connection.terminate();
-    }).catch((aError) => {
-      ok(false, 'Sender: Error occurred when establishing a connection: ' + aError);
-      teardown();
-      aReject();
-    });
-  });
-}
-
-function testConnectionTerminate() {
-  return new Promise(function(aResolve, aReject) {
-    info('Sender: --- testConnectionTerminate---');
-    connection.onterminate = function() {
-      connection.onterminate = null;
-      is(connection.state, 'terminated', 'Sender: Connection should be terminated.');
-    };
-    gScript.addMessageListener('control-channel-established', function controlChannelEstablishedHandler() {
-      gScript.removeMessageListener('control-channel-established',
-                                    controlChannelEstablishedHandler);
-      gScript.sendAsyncMessage('trigger-control-channel-open');
-    });
-    gScript.addMessageListener('sender-terminate', function senderTerminateHandler() {
-      gScript.removeMessageListener('sender-terminate',
-                                    senderTerminateHandler);
-
-      Promise.all([
-        new Promise((resolve) => {
-          gScript.addMessageListener('device-disconnected', function deviceDisconnectedHandler() {
-            gScript.removeMessageListener('device-disconnected', deviceDisconnectedHandler);
-            ok(true, 'observe device disconnect');
-            resolve();
-          });
-        }),
-        new Promise((resolve) => {
-          receiverIframe.addEventListener('mozbrowserclose', function() {
-            ok(true, 'observe receiver page closing');
-            resolve();
-          });
-        }),
-      ]).then(aResolve);
-
-      gScript.sendAsyncMessage('trigger-on-terminate-request');
-    });
-    gScript.addMessageListener('ready-to-terminate', function onReadyToTerminate() {
-      gScript.removeMessageListener('ready-to-terminate', onReadyToTerminate);
-      connection.terminate();
-
-      // test unexpected close right after terminate
-      connection.onclose = function() {
-        ok(false, 'close after terminate should do nothing');
-      };
-      connection.close();
-    });
-  });
-}
-
-function testSendAfterTerminate() {
-  return new Promise(function(aResolve, aReject) {
-    try {
-      connection.send('something');
-      ok(false, 'PresentationConnection.send should be failed');
-    } catch (e) {
-      is(e.name, 'InvalidStateError', 'Must throw InvalidStateError');
-    }
-    aResolve();
-  });
-}
-
-function testCloseAfterTerminate() {
-  return Promise.race([
-      new Promise(function(aResolve, aReject) {
-        connection.onclose = function() {
-          connection.onclose = null;
-          ok(false, 'close at terminated state should do nothing');
-          aResolve();
-        };
-        connection.close();
-      }),
-      new Promise(function(aResolve, aReject) {
-        setTimeout(function() {
-          is(connection.state, 'terminated', 'Sender: Connection should be terminated.');
-          aResolve();
-        }, 3000);
-      }),
-  ]);
-}
-
-function teardown() {
-  gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() {
-    debug('Got message: teardown-complete');
-    gScript.removeMessageListener('teardown-complete', teardownCompleteHandler);
-    gScript.destroy();
-    SimpleTest.finish();
-  });
-  gScript.sendAsyncMessage('teardown');
-}
-
-function runTests() {
-  setup().then(testCreateRequest)
-         .then(testStartConnection)
-         .then(testConnectionTerminate)
-         .then(testSendAfterTerminate)
-         .then(testCloseAfterTerminate)
-         .then(teardown);
-}
-
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: false, context: document},
-  {type: 'browser', allow: true, context: document},
-], () => {
-  SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
-                                      ["dom.presentation.controller.enabled", true],
-                                      ["dom.presentation.receiver.enabled", true],
-                                      ['dom.presentation.test.enabled', true],
-                                      ['dom.mozBrowserFramesEnabled', true],
-                                      ["network.disable.ipc.security", true],
-                                      ['dom.ipc.tabs.disabled', false],
-                                      ['dom.presentation.test.stage', 0]]},
-                            runTests);
-});
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error.js b/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error.js
deleted file mode 100644
index a1d477aab..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error.js
+++ /dev/null
@@ -1,197 +0,0 @@
-'use strict';
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.requestFlakyTimeout('Test for guarantee not firing async event');
-
-function debug(str) {
-  // info(str);
-}
-
-var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('PresentationSessionChromeScript1UA.js'));
-var receiverUrl = SimpleTest.getTestFileURL('file_presentation_terminate_establish_connection_error.html');
-var request;
-var connection;
-var receiverIframe;
-
-function postMessageToIframe(aType) {
-  receiverIframe.src = receiverUrl + "#" +
-                       encodeURIComponent(JSON.stringify({ type: aType }));
-}
-
-function setup() {
-  gScript.addMessageListener('device-prompt', function devicePromptHandler() {
-    debug('Got message: device-prompt');
-    gScript.removeMessageListener('device-prompt', devicePromptHandler);
-    gScript.sendAsyncMessage('trigger-device-prompt-select');
-  });
-
-  gScript.addMessageListener('control-channel-established', function controlChannelEstablishedHandler() {
-    gScript.removeMessageListener('control-channel-established',
-                                  controlChannelEstablishedHandler);
-    gScript.sendAsyncMessage('trigger-control-channel-open');
-  });
-
-  gScript.addMessageListener('sender-launch', function senderLaunchHandler(url) {
-    debug('Got message: sender-launch');
-    gScript.removeMessageListener('sender-launch', senderLaunchHandler);
-    is(url, receiverUrl, 'Receiver: should receive the same url');
-    receiverIframe = document.createElement('iframe');
-    receiverIframe.setAttribute('mozbrowser', 'true');
-    receiverIframe.setAttribute('mozpresentation', receiverUrl);
-    var oop = location.pathname.indexOf('_inproc') == -1;
-    receiverIframe.setAttribute('remote', oop);
-
-    receiverIframe.setAttribute('src', receiverUrl);
-    receiverIframe.addEventListener('mozbrowserloadend', function mozbrowserloadendHander() {
-      receiverIframe.removeEventListener('mozbrowserloadend', mozbrowserloadendHander);
-      info('Receiver loaded.');
-    });
-
-    // This event is triggered when the iframe calls 'alert'.
-    receiverIframe.addEventListener('mozbrowsershowmodalprompt', function receiverListener(evt) {
-      var message = evt.detail.message;
-      if (/^OK /.exec(message)) {
-        ok(true, message.replace(/^OK /, ''));
-      } else if (/^KO /.exec(message)) {
-        ok(false, message.replace(/^KO /, ''));
-      } else if (/^INFO /.exec(message)) {
-        info(message.replace(/^INFO /, ''));
-      } else if (/^COMMAND /.exec(message)) {
-        var command = JSON.parse(message.replace(/^COMMAND /, ''));
-        gScript.sendAsyncMessage(command.name, command.data);
-      } else if (/^DONE$/.exec(message)) {
-        ok(true, 'Messaging from iframe complete.');
-        receiverIframe.removeEventListener('mozbrowsershowmodalprompt',
-                                            receiverListener);
-      }
-    }, false);
-
-    var promise = new Promise(function(aResolve, aReject) {
-      document.body.appendChild(receiverIframe);
-      aResolve(receiverIframe);
-    });
-
-    var obs = SpecialPowers.Cc['@mozilla.org/observer-service;1']
-                           .getService(SpecialPowers.Ci.nsIObserverService);
-    obs.notifyObservers(promise, 'setup-request-promise', null);
-  });
-
-  gScript.addMessageListener('promise-setup-ready', function promiseSetupReadyHandler() {
-    debug('Got message: promise-setup-ready');
-    gScript.removeMessageListener('promise-setup-ready',
-                                  promiseSetupReadyHandler);
-    gScript.sendAsyncMessage('trigger-on-session-request', receiverUrl);
-  });
-
-  return Promise.resolve();
-}
-
-function testCreateRequest() {
-  return new Promise(function(aResolve, aReject) {
-    info('Sender: --- testCreateRequest ---');
-    request = new PresentationRequest(receiverUrl);
-    request.getAvailability().then((aAvailability) => {
-      is(aAvailability.value, false, "Sender: should have no available device after setup");
-      aAvailability.onchange = function() {
-        aAvailability.onchange = null;
-        ok(aAvailability.value, 'Sender: Device should be available.');
-        aResolve();
-      }
-
-      gScript.sendAsyncMessage('trigger-device-add');
-    }).catch((aError) => {
-      ok(false, 'Sender: Error occurred when getting availability: ' + aError);
-      teardown();
-      aReject();
-    });
-  });
-}
-
-function testStartConnection() {
-  return new Promise(function(aResolve, aReject) {
-    request.start().then((aConnection) => {
-      connection = aConnection;
-      ok(connection, 'Sender: Connection should be available.');
-      ok(connection.id, 'Sender: Connection ID should be set.');
-      is(connection.state, 'connecting', 'Sender: The initial state should be connecting.');
-      connection.onconnect = function() {
-        connection.onconnect = null;
-        is(connection.state, 'connected', 'Connection should be connected.');
-        aResolve();
-      };
-    }).catch((aError) => {
-      ok(false, 'Sender: Error occurred when establishing a connection: ' + aError);
-      teardown();
-      aReject();
-    });
-  });
-}
-
-function testConnectionTerminate() {
-  info('Sender: --- testConnectionTerminate---');
-  let promise = Promise.all([
-    new Promise(function(aResolve, aReject) {
-      connection.onclose = function() {
-        connection.onclose = null;
-        is(connection.state, 'closed', 'Sender: Connection should be closed.');
-        aResolve();
-      };
-    }),
-    new Promise(function(aResolve, aReject) {
-      function deviceDisconnectedHandler() {
-        gScript.removeMessageListener('device-disconnected', deviceDisconnectedHandler);
-        ok(true, 'should not receive device disconnect');
-        aResolve();
-      }
-
-      gScript.addMessageListener('device-disconnected', deviceDisconnectedHandler);
-    }),
-    new Promise(function(aResolve, aReject) {
-      receiverIframe.addEventListener('mozbrowserclose', function() {
-        ok(true, 'observe receiver page closing');
-        aResolve();
-      });
-    })
-  ]);
-
-  gScript.addMessageListener('prepare-for-terminate', function prepareForTerminateHandler() {
-    debug('Got message: prepare-for-terminate');
-    gScript.removeMessageListener('prepare-for-terminate', prepareForTerminateHandler);
-    gScript.sendAsyncMessage('trigger-control-channel-error');
-    postMessageToIframe('ready-to-terminate');
-  });
-
-  return promise;
-}
-
-function teardown() {
-  gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() {
-    debug('Got message: teardown-complete');
-    gScript.removeMessageListener('teardown-complete', teardownCompleteHandler);
-    gScript.destroy();
-    SimpleTest.finish();
-  });
-  gScript.sendAsyncMessage('teardown');
-}
-
-function runTests() {
-  setup().then(testCreateRequest)
-         .then(testStartConnection)
-         .then(testConnectionTerminate)
-         .then(teardown);
-}
-
-SpecialPowers.pushPermissions([
-  {type: 'presentation-device-manage', allow: false, context: document},
-  {type: 'browser', allow: true, context: document},
-], () => {
-  SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
-                                      ["dom.presentation.controller.enabled", true],
-                                      ["dom.presentation.receiver.enabled", true],
-                                      ['dom.presentation.test.enabled', true],
-                                      ['dom.mozBrowserFramesEnabled', true],
-                                      ["network.disable.ipc.security", true],
-                                      ['dom.ipc.tabs.disabled', false],
-                                      ['dom.presentation.test.stage', 0]]},
-                            runTests);
-});
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_inproc.html b/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_inproc.html
deleted file mode 100644
index ccf0767f1..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_inproc.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for control channel establish error during PresentationConnection.terminate()
-    
-    
-  
-  
-    
-      Test for constrol channel establish error during PresentationConnection.terminate()
-    
-  
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_oop.html b/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_oop.html
deleted file mode 100644
index ccf0767f1..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate_establish_connection_error_oop.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for control channel establish error during PresentationConnection.terminate()
-    
-    
-  
-  
-    
-      Test for constrol channel establish error during PresentationConnection.terminate()
-    
-  
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate_inproc.html b/dom/presentation/tests/mochitest/test_presentation_terminate_inproc.html
deleted file mode 100644
index 33bbcda57..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate_inproc.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for PresentationConnection.terminate()
-    
-    
-  
-  
-    
-      Test for PresentationConnection.terminate()
-    
-  
-
diff --git a/dom/presentation/tests/mochitest/test_presentation_terminate_oop.html b/dom/presentation/tests/mochitest/test_presentation_terminate_oop.html
deleted file mode 100644
index 33bbcda57..000000000
--- a/dom/presentation/tests/mochitest/test_presentation_terminate_oop.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-  
-  
-    
-    Test for PresentationConnection.terminate()
-    
-    
-  
-  
-    
-      Test for PresentationConnection.terminate()
-    
-  
-
-- 
cgit v1.2.3