blob: e67cde31bb7c7c4cb3e9c726a07801331961d1a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const {
adbAddon,
} = require("resource://devtools/client/shared/remote-debugging/adb/adb-addon.js");
/**
* This test asserts that the sidebar shows a message describing the status of the USB
* devices scanning.
*/
add_task(async function () {
const mocks = new Mocks();
await pushPref(
"devtools.remote.adb.extensionURL",
CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi"
);
const { document, tab } = await openAboutDebugging();
const usbStatusElement = document.querySelector(".qa-sidebar-usb-status");
ok(usbStatusElement, "Sidebar shows the USB status element");
ok(
usbStatusElement.textContent.includes("USB disabled"),
"USB status element has 'disabled' content"
);
info("Install the adb extension and wait for the message to udpate");
// Use "internal" as the install source to avoid triggering telemetry.
adbAddon.install("internal");
// When using mocks, we manually control the .start() call
await mocks.adbProcessMock.adbProcess.start();
info("Wait till the USB status element has 'enabled' content");
await waitUntil(() => {
const el = document.querySelector(".qa-sidebar-usb-status");
return el.textContent.includes("USB enabled");
});
info("Uninstall the adb extension and wait for USB status element to update");
adbAddon.uninstall();
await waitUntil(() => {
const el = document.querySelector(".qa-sidebar-usb-status");
return el.textContent.includes("USB disabled");
});
await removeTab(tab);
});
|