summaryrefslogtreecommitdiffstats
path: root/mobile/android/tests/browser/chrome/test_simple_discovery.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mobile/android/tests/browser/chrome/test_simple_discovery.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/tests/browser/chrome/test_simple_discovery.html')
-rw-r--r--mobile/android/tests/browser/chrome/test_simple_discovery.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/mobile/android/tests/browser/chrome/test_simple_discovery.html b/mobile/android/tests/browser/chrome/test_simple_discovery.html
new file mode 100644
index 000000000..a8d84cfe5
--- /dev/null
+++ b/mobile/android/tests/browser/chrome/test_simple_discovery.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=938571
+Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 938571</title>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+ <script type="application/javascript;version=1.7">
+
+ "use strict";
+
+ /*globals SimpleServiceDiscovery */
+
+ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
+ Cu.import("resource://gre/modules/Services.jsm");
+ Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
+
+ function discovery_observer(subject, topic, data) {
+ dump("Observer: " + data);
+
+ let service = SimpleServiceDiscovery.findServiceForID(data);
+ if (!service)
+ return;
+
+ is(service.friendlyName, "Pretend Device");
+ is(service.uuid, "uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1");
+ is(service.manufacturer, "Copy Cat Inc.");
+ is(service.modelName, "Eureka Dongle");
+
+ SimpleTest.finish();
+ };
+
+ var testDevice = {
+ id: "test:dummy",
+ target: "test:service",
+ factory: function(service) { /* dummy */ },
+ types: ["video/mp4"],
+ extensions: ["mp4"]
+ };
+
+ function test_default() {
+ SimpleTest.registerCleanupFunction(function cleanup() {
+ SimpleServiceDiscovery.unregisterDevice(testDevice);
+ Services.obs.removeObserver(discovery_observer, "ssdp-service-found");
+ });
+
+ Services.obs.addObserver(discovery_observer, "ssdp-service-found", false);
+
+ // We need to register a device or processService will ignore us
+ SimpleServiceDiscovery.registerDevice(testDevice);
+
+ // Create a pretend service
+ let service = {
+ location: "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/simpleservice.xml",
+ target: "test:service"
+ };
+
+ dump("Force a detailed ping from a pretend service");
+
+ // Poke the service directly to get the discovery to happen
+ SimpleServiceDiscovery._processService(service);
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ test_default();
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=938571">Mozilla Bug 938571</a>
+<br>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testSimpleDiscovery</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>