mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
This allows improving all tests exceptions without requiring any specific to be done in each tests. I'm also moving a few imports to head.js to share the most into head.js. Differential Revision: https://phabricator.services.mozilla.com/D29414 --HG-- extra : moz-landing-system : lando
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
// Test very basic CDP features.
|
|
|
|
const TEST_URI = "data:text/html;charset=utf-8,default-test-page";
|
|
|
|
add_task(async function() {
|
|
// Start the CDP server
|
|
await RemoteAgent.listen(Services.io.newURI("http://localhost:9222"));
|
|
|
|
const { mainProcessTarget } = RemoteAgent.targets;
|
|
ok(mainProcessTarget,
|
|
"The main process target is instantiated after the call to `listen`");
|
|
|
|
const targetURL = mainProcessTarget.wsDebuggerURL;
|
|
|
|
const CDP = await getCDP();
|
|
|
|
const client = await CDP({"target": targetURL});
|
|
ok(true, "CDP client has been instantiated");
|
|
|
|
const {Browser, Target} = client;
|
|
ok(Browser, "The main process target exposes Browser domain");
|
|
ok(Target, "The main process target exposes Target domain");
|
|
|
|
const version = await Browser.getVersion();
|
|
is(version.product, "Firefox", "Browser.getVersion works");
|
|
|
|
const {webSocketDebuggerUrl} = await CDP.Version();
|
|
is(webSocketDebuggerUrl, targetURL,
|
|
"Version endpoint refers to the same Main process target");
|
|
|
|
await RemoteAgent.close();
|
|
});
|