Bug 1492700 - Fix ADB stop() in case ADB start() was called several times;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 27 Nov 2018 12:48:48 +0000
changeset 504689 f5f900b18101005db07d9b201dc15205c596c451
parent 504688 1255d7d52439c8fbd3b3edaeddcb201036a575fa
child 504690 5199632a4ada777750accd0e0e2a0faa96b12d7e
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1492700
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492700 - Fix ADB stop() in case ADB start() was called several times;r=daisuke Differential Revision: https://phabricator.services.mozilla.com/D12758
devtools/shared/adb/adb.js
devtools/shared/adb/test/test_adb.js
--- a/devtools/shared/adb/adb.js
+++ b/devtools/shared/adb/adb.js
@@ -84,17 +84,16 @@ const ADB = {
       const onSuccessfulStart = () => {
         Services.obs.notifyObservers(null, "adb-ready");
         this.ready = true;
         resolve();
       };
 
       const isAdbRunning = await check();
       if (isAdbRunning) {
-        this.didRunInitially = false;
         dumpn("Found ADB process running, not restarting");
         onSuccessfulStart();
         return;
       }
       dumpn("Didn't find ADB process running, restarting");
 
       this.didRunInitially = true;
       const process = Cc["@mozilla.org/process/util;1"]
--- a/devtools/shared/adb/test/test_adb.js
+++ b/devtools/shared/adb/test/test_adb.js
@@ -170,23 +170,34 @@ add_task({
       "win32/adb.exe": adbMock,
       "win32/AdbWinApi.dll": "dummy",
       "win32/AdbWinUsbApi.dll": "dummy",
     },
   });
 
   await extension.startup();
 
+  // Call start() once and call stop() afterwards.
   await ADB.start();
   ok(ADB.ready);
-
   ok(await check(), "adb is now running");
 
   await ADB.stop();
   ok(!ADB.ready);
+  ok(!(await check()), "adb is no longer running");
+
+  // Call start() twice and call stop() afterwards.
+  await ADB.start();
+  await ADB.start();
+  ok(ADB.ready);
+  ok(await check(), "adb is now running");
+
+  await ADB.stop();
+  ok(!ADB.ready);
+  ok(!(await check()), "adb is no longer running");
 
   await extension.unload();
 });
 
 add_task({
   skip_if: () => mozinfo.os == "win", // bug 1482008
 }, async function testTrackDevices() {
   const extension = ExtensionTestUtils.loadExtension({