fune/devtools/client/aboutdebugging/test/browser/helper-adb.js
Julian Descottes 1ce70ac1b0 Bug 1515008 - Move adb from devtools/shared to devtools/client/shared/remote-debugging r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D68598

--HG--
rename : devtools/shared/adb/adb-addon.js => devtools/client/shared/remote-debugging/adb/adb-addon.js
rename : devtools/shared/adb/adb-binary.js => devtools/client/shared/remote-debugging/adb/adb-binary.js
rename : devtools/shared/adb/adb-client.js => devtools/client/shared/remote-debugging/adb/adb-client.js
rename : devtools/shared/adb/adb-device.js => devtools/client/shared/remote-debugging/adb/adb-device.js
rename : devtools/shared/adb/adb-process.js => devtools/client/shared/remote-debugging/adb/adb-process.js
rename : devtools/shared/adb/adb-running-checker.js => devtools/client/shared/remote-debugging/adb/adb-running-checker.js
rename : devtools/shared/adb/adb-runtime.js => devtools/client/shared/remote-debugging/adb/adb-runtime.js
rename : devtools/shared/adb/adb-socket.js => devtools/client/shared/remote-debugging/adb/adb-socket.js
rename : devtools/shared/adb/adb.js => devtools/client/shared/remote-debugging/adb/adb.js
rename : devtools/shared/adb/commands/index.js => devtools/client/shared/remote-debugging/adb/commands/index.js
rename : devtools/shared/adb/commands/list-devices.js => devtools/client/shared/remote-debugging/adb/commands/list-devices.js
rename : devtools/shared/adb/commands/moz.build => devtools/client/shared/remote-debugging/adb/commands/moz.build
rename : devtools/shared/adb/commands/prepare-tcp-connection.js => devtools/client/shared/remote-debugging/adb/commands/prepare-tcp-connection.js
rename : devtools/shared/adb/commands/run-command.js => devtools/client/shared/remote-debugging/adb/commands/run-command.js
rename : devtools/shared/adb/commands/shell.js => devtools/client/shared/remote-debugging/adb/commands/shell.js
rename : devtools/shared/adb/commands/track-devices.js => devtools/client/shared/remote-debugging/adb/commands/track-devices.js
rename : devtools/shared/adb/moz.build => devtools/client/shared/remote-debugging/adb/moz.build
rename : devtools/shared/adb/xpcshell/.eslintrc.js => devtools/client/shared/remote-debugging/adb/xpcshell/.eslintrc.js
rename : devtools/shared/adb/xpcshell/adb.py => devtools/client/shared/remote-debugging/adb/xpcshell/adb.py
rename : devtools/shared/adb/xpcshell/test_adb.js => devtools/client/shared/remote-debugging/adb/xpcshell/test_adb.js
rename : devtools/shared/adb/xpcshell/xpcshell-head.js => devtools/client/shared/remote-debugging/adb/xpcshell/xpcshell-head.js
rename : devtools/shared/adb/xpcshell/xpcshell.ini => devtools/client/shared/remote-debugging/adb/xpcshell/xpcshell.ini
extra : moz-landing-system : lando
2020-03-30 06:56:57 +00:00

59 lines
1.8 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* import-globals-from head.js */
async function checkAdbNotRunning() {
info("Check if ADB is already running before the test starts");
const {
check,
} = require("devtools/client/shared/remote-debugging/adb/adb-running-checker");
const isAdbAlreadyRunning = await check();
if (isAdbAlreadyRunning) {
throw new Error(
"The ADB process is already running on this machine, it should be " +
"stopped before running this test"
);
}
}
/* exported checkAdbNotRunning */
// Returns a promise that resolves when the adb process exists and is running.
async function waitForAdbStart() {
info("Wait for ADB to start");
const {
adbProcess,
} = require("devtools/client/shared/remote-debugging/adb/adb-process");
const {
check,
} = require("devtools/client/shared/remote-debugging/adb/adb-running-checker");
return asyncWaitUntil(async () => {
const isProcessReady = adbProcess.ready;
const isRunning = await check();
return isProcessReady && isRunning;
});
}
/* exported waitForAdbStart */
// Attempt to stop ADB. Will only work if ADB was started by the current Firefox instance.
// Returns a promise that resolves when the adb process is no longer running.
async function stopAdbProcess() {
info("Attempt to stop ADB");
const {
adbProcess,
} = require("devtools/client/shared/remote-debugging/adb/adb-process");
await adbProcess.stop();
info("Wait for ADB to stop");
const {
check,
} = require("devtools/client/shared/remote-debugging/adb/adb-running-checker");
return asyncWaitUntil(async () => {
const isProcessReady = adbProcess.ready;
const isRunning = await check();
return !isProcessReady && !isRunning;
});
}
/* exported stopAdbProcess */