diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-06 16:03:39 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:31:16 +0200 |
commit | 8c41fcd24048154e3526e506157d337a2ab434e8 (patch) | |
tree | cadcee4433f470969e8e14591f6d7d89c1c9f39b /dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js | |
parent | 27f4e60be80610b4be361f51257a5501852ed795 (diff) | |
download | UXP-8c41fcd24048154e3526e506157d337a2ab434e8.tar UXP-8c41fcd24048154e3526e506157d337a2ab434e8.tar.gz UXP-8c41fcd24048154e3526e506157d337a2ab434e8.tar.lz UXP-8c41fcd24048154e3526e506157d337a2ab434e8.tar.xz UXP-8c41fcd24048154e3526e506157d337a2ab434e8.zip |
Issue #1390 - Get rid of the Presentation API
Diffstat (limited to 'dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js')
-rw-r--r-- | dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js | 150 |
1 files changed, 0 insertions, 150 deletions
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); -}); |