Bug 1494549 - Wait until ADB started in USB status sidebar test;r=daisuke
☠☠ backed out by 1c6fa266a661 ☠ ☠
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 15 Oct 2018 07:30:44 +0000
changeset 489782 e9abf60db23b75c1807bc6afa5b3fa9d8d483af6
parent 489781 3e89e661031ccb8f6f1889c5b6c1687db03e3eaa
child 489783 1c6fa266a661d9cb37816e46537fb5664b9702c3
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersdaisuke
bugs1494549
milestone64.0a1
Bug 1494549 - Wait until ADB started in USB status sidebar test;r=daisuke Depends on D8335 Differential Revision: https://phabricator.services.mozilla.com/D8513
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const { adbAddon } = require("devtools/shared/adb/adb-addon");
+const { ADB } = require("devtools/shared/adb/adb");
 
 /**
  * This test asserts that the sidebar shows a message describing the status of the USB
  * devices scanning.
  */
 add_task(async function() {
   // Make sure the ADB addon is removed when the test ends.
   registerCleanupFunction(async function() {
@@ -28,14 +29,21 @@ add_task(async function() {
   ok(usbStatusElement, "Sidebar shows the USB status element");
   ok(usbStatusElement.textContent.includes("USB devices disabled"),
     "USB status element has the expected content");
 
   info("Install the adb extension and wait for the message to udpate");
   adbAddon.install();
   await waitUntil(() => usbStatusElement.textContent.includes("USB devices enabled"));
 
+  // Right now we are resuming as soon as "USB devices enabled" is displayed, but ADB
+  // might still be starting up. If we move to uninstall directly, the ADB startup will
+  // fail and we will have an unhandled promise rejection.
+  // See Bug 1498469.
+  info("Wait until ADB has started.");
+  await waitUntil(() => ADB.ready);
+
   info("Uninstall the adb extension and wait for the message to udpate");
   adbAddon.uninstall();
   await waitUntil(() => usbStatusElement.textContent.includes("USB devices disabled"));
 
   await removeTab(tab);
 });