mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938571 - Add discovery support for second-screen devices (test) r=rnewman
This commit is contained in:
parent
9f53edc8dc
commit
05f13e7e4d
@ -72,6 +72,7 @@ skip-if = processor == "x86"
|
||||
# [testMozPay] # see bug 945675
|
||||
[testOrderedBroadcast]
|
||||
[testSharedPreferences]
|
||||
[testSimpleDiscovery]
|
||||
[testUITelemetry]
|
||||
|
||||
# Used for Talos, please don't use in mochitest
|
||||
|
15
mobile/android/base/tests/simpleservice.xml
Normal file
15
mobile/android/base/tests/simpleservice.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<root xmlns="urn:schemas-upnp-org:device-1-0">
|
||||
<specVersion>
|
||||
<major>1</major>
|
||||
<minor>0</minor>
|
||||
</specVersion>
|
||||
<URLBase>http://example.com</URLBase>
|
||||
<device>
|
||||
<deviceType>urn:dial-multiscreen-org:device:dial:1</deviceType>
|
||||
<friendlyName>Pretend Device</friendlyName>
|
||||
<manufacturer>Copy Cat Inc.</manufacturer>
|
||||
<modelName>Eureka Dongle</modelName>
|
||||
<UDN>uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1</UDN>
|
||||
</device>
|
||||
</root>
|
10
mobile/android/base/tests/testSimpleDiscovery.java
Normal file
10
mobile/android/base/tests/testSimpleDiscovery.java
Normal file
@ -0,0 +1,10 @@
|
||||
package org.mozilla.gecko.tests;
|
||||
|
||||
import org.mozilla.gecko.*;
|
||||
|
||||
|
||||
public class testSimpleDiscovery extends JavascriptTest {
|
||||
public testSimpleDiscovery() {
|
||||
super("testSimpleDiscovery.js");
|
||||
}
|
||||
}
|
46
mobile/android/base/tests/testSimpleDiscovery.js
Normal file
46
mobile/android/base/tests/testSimpleDiscovery.js
Normal file
@ -0,0 +1,46 @@
|
||||
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
|
||||
/* 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, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
|
||||
|
||||
function discovery_observer(subject, topic, data) {
|
||||
do_print("Observer: " + data);
|
||||
|
||||
let service = SimpleServiceDiscovery.findServiceForLocation(data);
|
||||
if (!service)
|
||||
return;
|
||||
|
||||
do_check_eq(service.friendlyName, "Pretend Device");
|
||||
do_check_eq(service.uuid, "uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1");
|
||||
do_check_eq(service.manufacturer, "Copy Cat Inc.");
|
||||
do_check_eq(service.modelName, "Eureka Dongle");
|
||||
|
||||
run_next_test();
|
||||
};
|
||||
|
||||
add_test(function test_default() {
|
||||
do_register_cleanup(function cleanup() {
|
||||
Services.obs.removeObserver(discovery_observer, "ssdp-service-found");
|
||||
});
|
||||
|
||||
Services.obs.addObserver(discovery_observer, "ssdp-service-found", false);
|
||||
|
||||
// Create a pretend service
|
||||
let service = {
|
||||
location: "http://mochi.test:8888/tests/robocop/simpleservice.xml",
|
||||
target: "test:service"
|
||||
};
|
||||
|
||||
do_print("Force a detailed ping from a pretend service");
|
||||
|
||||
// Poke the service directly to get the discovery to happen
|
||||
SimpleServiceDiscovery._found(service);
|
||||
});
|
||||
|
||||
run_next_test();
|
Loading…
Reference in New Issue
Block a user