diff --git a/mobile/android/base/tests/testVideoDiscovery.js b/mobile/android/base/tests/testVideoDiscovery.js index b43f0d09c339..ece80c5fc1ef 100644 --- a/mobile/android/base/tests/testVideoDiscovery.js +++ b/mobile/android/base/tests/testVideoDiscovery.js @@ -8,6 +8,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm"); function ok(passed, text) { do_report_result(passed, text, Components.stack.caller, false); @@ -26,14 +27,38 @@ function middle(element) { return [x, y]; } +// We must register a target and make a "mock" service for the target +var testTarget = { + target: "test:service", + factory: function(service) { /* dummy */ }, + types: ["video/mp4", "video/webm"], + extensions: ["mp4", "webm"] +}; + add_test(function setup_browser() { chromeWin = Services.wm.getMostRecentWindow("navigator:browser"); let BrowserApp = chromeWin.BrowserApp; do_register_cleanup(function cleanup() { BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser)); + SimpleServiceDiscovery.unregisterTarget(testTarget); }); + // We need to register a target or processService will ignore us + SimpleServiceDiscovery.registerTarget(testTarget); + + // 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._processService(service); + + // Load our test web page with