Bug 1505289 - Rename unknown (usb runtimes) to unavailable;r=Ola
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 15 Apr 2019 22:26:30 +0000
changeset 469624 630d6ce9c7b0
parent 469623 5b4e9571635e
child 469625 4c5502ff1c1c
push id35878
push userapavel@mozilla.com
push dateTue, 16 Apr 2019 15:43:40 +0000
treeherdermozilla-central@258af4e91151 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersOla
bugs1505289
milestone68.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 1505289 - Rename unknown (usb runtimes) to unavailable;r=Ola Depends on D25784 Differential Revision: https://phabricator.services.mozilla.com/D27043
devtools/client/aboutdebugging-new/src/actions/runtimes.js
devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js
devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js
devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js
devtools/client/aboutdebugging-new/src/types/runtime.js
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unknown_runtime.js
devtools/client/aboutdebugging-new/test/browser/helper-mocks.js
--- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js
+++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js
@@ -154,17 +154,17 @@ function connectRuntime(id) {
 
 function createThisFirefoxRuntime() {
   return (dispatch, getState) => {
     const thisFirefoxRuntime = {
       id: RUNTIMES.THIS_FIREFOX,
       isConnecting: false,
       isConnectionFailed: false,
       isConnectionNotResponding: false,
-      isUnknown: false,
+      isUnavailable: false,
       isUnplugged: false,
       name: l10n.getString("about-debugging-this-firefox-runtime-name"),
       type: RUNTIMES.THIS_FIREFOX,
     };
     dispatch({ type: THIS_FIREFOX_RUNTIME_CREATED, runtime: thisFirefoxRuntime });
   };
 }
 
@@ -316,17 +316,17 @@ function updateNetworkRuntimes(locations
     return {
       id: location,
       extra: {
         connectionParameters: { host, port: parseInt(port, 10) },
       },
       isConnecting: false,
       isConnectionFailed: false,
       isConnectionNotResponding: false,
-      isUnknown: false,
+      isUnavailable: false,
       isUnplugged: false,
       name: location,
       type: RUNTIMES.NETWORK,
     };
   });
   return updateRemoteRuntimes(runtimes, RUNTIMES.NETWORK);
 }
 
@@ -340,17 +340,17 @@ function updateUSBRuntimes(adbRuntimes) 
       id: adbRuntime.id,
       extra: {
         connectionParameters,
         deviceName: adbRuntime.deviceName,
       },
       isConnecting: false,
       isConnectionFailed: false,
       isConnectionNotResponding: false,
-      isUnknown: adbRuntime.isUnknown,
+      isUnavailable: adbRuntime.isUnavailable,
       isUnplugged: adbRuntime.isUnplugged,
       name: adbRuntime.shortName,
       type: RUNTIMES.USB,
     };
   });
   return updateRemoteRuntimes(runtimes, RUNTIMES.USB);
 }
 
--- a/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js
+++ b/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js
@@ -112,17 +112,17 @@ class Sidebar extends PureComponent {
         dispatch,
         icon,
         key: keyId,
         isConnected: runtimeHasDetails,
         isConnecting: runtime.isConnecting,
         isConnectionFailed: runtime.isConnectionFailed,
         isConnectionNotResponding: runtime.isConnectionNotResponding,
         isSelected,
-        isUnknown: runtime.isUnknown,
+        isUnavailable: runtime.isUnavailable,
         isUnplugged: runtime.isUnplugged,
         name,
         runtimeId: runtime.id,
       });
     });
   }
 
   renderFooter() {
--- a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js
+++ b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js
@@ -27,17 +27,17 @@ class SidebarRuntimeItem extends PureCom
       // Provided by wrapping the component with FluentReact.withLocalization.
       getString: PropTypes.func.isRequired,
       icon: PropTypes.string.isRequired,
       isConnected: PropTypes.bool.isRequired,
       isConnecting: PropTypes.bool.isRequired,
       isConnectionFailed: PropTypes.bool.isRequired,
       isConnectionNotResponding: PropTypes.bool.isRequired,
       isSelected: PropTypes.bool.isRequired,
-      isUnknown: PropTypes.bool.isRequired,
+      isUnavailable: PropTypes.bool.isRequired,
       isUnplugged: PropTypes.bool.isRequired,
       name: PropTypes.string.isRequired,
       runtimeId: PropTypes.string.isRequired,
     };
   }
 
   renderConnectButton() {
     const { isConnecting } = this.props;
@@ -108,23 +108,23 @@ class SidebarRuntimeItem extends PureCom
           id: localizationId,
         },
         dom.p({ className: "word-wrap-anywhere" }, localizationId)
       )
     );
   }
 
   renderName() {
-    const { deviceName, getString, isUnknown, isUnplugged, name } = this.props;
+    const { deviceName, getString, isUnavailable, isUnplugged, name } = this.props;
 
     let displayName, qaClassName;
     if (isUnplugged) {
       displayName = getString("about-debugging-sidebar-runtime-item-unplugged");
       qaClassName = "qa-runtime-item-unplugged";
-    } else if (isUnknown) {
+    } else if (isUnavailable) {
       displayName = getString("about-debugging-sidebar-runtime-item-waiting-for-browser");
       qaClassName = "qa-runtime-item-waiting-for-browser";
     } else {
       displayName = name;
       qaClassName = "qa-runtime-item-standard";
     }
 
     const localizationId = deviceName
@@ -172,17 +172,17 @@ class SidebarRuntimeItem extends PureCom
   }
 
   render() {
     const {
       getString,
       icon,
       isConnected,
       isSelected,
-      isUnknown,
+      isUnavailable,
       runtimeId,
     } = this.props;
 
     const connectionStatus = isConnected ?
       getString("aboutdebugging-sidebar-runtime-connection-status-connected") :
       getString("aboutdebugging-sidebar-runtime-connection-status-disconnected");
 
     return [
@@ -201,17 +201,17 @@ class SidebarRuntimeItem extends PureCom
             {
               className: "sidebar-runtime-item__icon ",
               src: icon,
               alt: connectionStatus,
               title: connectionStatus,
             }
           ),
           this.renderName(),
-          !isUnknown && !isConnected ? this.renderConnectButton() : null
+          !isUnavailable && !isConnected ? this.renderConnectButton() : null
         ),
       ),
       this.renderConnectionError(),
       this.renderConnectionNotResponding(),
     ];
   }
 }
 
--- a/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js
+++ b/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js
@@ -11,49 +11,49 @@ loader.lazyRequireGetter(this, "adb", "d
  */
 class UsbRuntime {
   constructor(adbRuntime) {
     this.id = adbRuntime.id;
     this.deviceId = adbRuntime.deviceId;
     this.deviceName = adbRuntime.deviceName;
     this.shortName = adbRuntime.shortName;
     this.socketPath = adbRuntime.socketPath;
-    this.isUnknown = false;
+    this.isUnavailable = false;
     this.isUnplugged = false;
   }
 }
 
 /**
  * Used when a device was detected, meaning USB debugging is enabled on the device, but no
  * runtime/browser is available for connection.
  */
-class UnknownUsbRuntime {
+class UnavailableUsbRuntime {
   constructor(adbDevice) {
-    this.id = adbDevice.id + "|unknown";
+    this.id = adbDevice.id + "|unavailable";
     this.deviceId = adbDevice.id;
     this.deviceName = adbDevice.name;
-    this.shortName = "Unknown runtime";
+    this.shortName = "Unavailable runtime";
     this.socketPath = null;
-    this.isUnknown = true;
+    this.isUnavailable = true;
     this.isUnplugged = false;
   }
 }
 
 /**
  * Used to represent USB devices that were previously connected but are now missing
  * (presumably after being unplugged/disconnected from the computer).
  */
 class UnpluggedUsbRuntime {
   constructor(deviceId, deviceName) {
     this.id = deviceId + "|unplugged";
     this.deviceId = deviceId;
     this.deviceName = deviceName;
     this.shortName = "Unplugged runtime";
     this.socketPath = null;
-    this.isUnknown = true;
+    this.isUnavailable = true;
     this.isUnplugged = true;
   }
 }
 
 /**
  * Map used to keep track of discovered usb devices. Will be used to create the unplugged
  * usb runtimes.
  */
@@ -69,30 +69,30 @@ function addUSBRuntimesObserver(listener
 exports.addUSBRuntimesObserver = addUSBRuntimesObserver;
 
 async function getUSBRuntimes() {
   // Get the available runtimes
   const runtimes = adb.getRuntimes().map(r => new UsbRuntime(r));
 
   // Get devices found by ADB, but without any available runtime.
   const runtimeDevices = runtimes.map(r => r.deviceId);
-  const unknownRuntimes = adb.getDevices()
+  const unavailableRuntimes = adb.getDevices()
     .filter(d => !runtimeDevices.includes(d.id))
-    .map(d => new UnknownUsbRuntime(d));
+    .map(d => new UnavailableUsbRuntime(d));
 
-  // Add all devices to the map of known devices.
-  const allRuntimes = runtimes.concat(unknownRuntimes);
+  // Add all devices to the map detected devices.
+  const allRuntimes = runtimes.concat(unavailableRuntimes);
   for (const runtime of allRuntimes) {
     devices.set(runtime.deviceId, runtime.deviceName);
   }
 
   // Get devices previously found by ADB but no longer available.
   const currentDevices = allRuntimes.map(r => r.deviceId);
-  const knownDevices = [...devices.keys()];
-  const unpluggedDevices = knownDevices.filter(id => !currentDevices.includes(id));
+  const detectedDevices = [...devices.keys()];
+  const unpluggedDevices = detectedDevices.filter(id => !currentDevices.includes(id));
   const unpluggedRuntimes = unpluggedDevices.map(deviceId => {
     const deviceName = devices.get(deviceId);
     return new UnpluggedUsbRuntime(deviceId, deviceName);
   });
 
   return allRuntimes.concat(unpluggedRuntimes);
 }
 exports.getUSBRuntimes = getUSBRuntimes;
--- a/devtools/client/aboutdebugging-new/src/types/runtime.js
+++ b/devtools/client/aboutdebugging-new/src/types/runtime.js
@@ -91,17 +91,17 @@ const usbRuntimeConnectionParameter = {
   // device id
   deviceId: PropTypes.string.isRequired,
   // socket path to connect debugger server
   socketPath: PropTypes.string.isRequired,
 };
 
 const runtimeExtra = {
   // parameter to connect to debugger server
-  // unavailable on unknown runtimes
+  // unavailable on unavailable/unplugged runtimes
   connectionParameters: PropTypes.oneOfType([
     PropTypes.shape(networkRuntimeConnectionParameter),
     PropTypes.shape(usbRuntimeConnectionParameter),
   ]),
 
   // device name
   // unavailable on this-firefox and network-location runtimes
   deviceName: PropTypes.string,
@@ -121,19 +121,20 @@ const runtime = {
 
   // this flag will be true when the connection failed.
   isConnectionFailed: PropTypes.bool.isRequired,
 
   // will be true if connecting to runtime is taking time, will be false after connecting
   // or failing.
   isConnectionNotResponding: PropTypes.bool.isRequired,
 
-  // unknown runtimes are placeholders for devices where the runtime has not been started
-  // yet. For instance an ADB device connected without a compatible runtime running.
-  isUnknown: PropTypes.bool.isRequired,
+  // unavailable runtimes are placeholders for devices where the runtime has not been
+  // started yet. For instance an ADB device connected without a compatible runtime
+  // running.
+  isUnavailable: PropTypes.bool.isRequired,
 
   // unplugged runtimes are placeholders for devices that are no longer available. For
   // instance a USB device that was unplugged from the computer.
   isUnplugged: PropTypes.bool.isRequired,
 
   // display name of the runtime
   name: PropTypes.string.isRequired,
 
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -95,17 +95,17 @@ skip-if = debug || asan # Frequent inter
 [browser_aboutdebugging_sidebar_connection_state.js]
 [browser_aboutdebugging_sidebar_network_runtimes.js]
 [browser_aboutdebugging_sidebar_usb_runtime.js]
 [browser_aboutdebugging_sidebar_usb_runtime_connect.js]
 [browser_aboutdebugging_sidebar_usb_runtime_refresh.js]
 [browser_aboutdebugging_sidebar_usb_runtime_select.js]
 [browser_aboutdebugging_sidebar_usb_status.js]
 skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
-[browser_aboutdebugging_sidebar_usb_unknown_runtime.js]
+[browser_aboutdebugging_sidebar_usb_unavailable_runtime.js]
 [browser_aboutdebugging_sidebar_usb_unplugged_device.js]
 [browser_aboutdebugging_system_addons.js]
 [browser_aboutdebugging_tab_favicons.js]
 [browser_aboutdebugging_telemetry_basic.js]
 [browser_aboutdebugging_telemetry_inspect.js]
 [browser_aboutdebugging_telemetry_navigate.js]
 [browser_aboutdebugging_telemetry_runtime_actions.js]
 [browser_aboutdebugging_telemetry_runtime_connected_details.js]
rename from devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unknown_runtime.js
rename to devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unknown_runtime.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js
@@ -3,17 +3,17 @@
 
 "use strict";
 
 const RUNTIME_NAME = "Firefox 123";
 const DEVICE_NAME = "DEVICE_NAME";
 const DEVICE_ID = "DEVICE_ID";
 const RUNTIME_ID = "RUNTIME_ID";
 
-// Test that unknown runtimes:
+// Test that unavailable runtimes:
 // - are displayed without a connect button.
 // - cannot be selected
 // - display a specific text ("Waiting for runtime") instead of the runtime name
 add_task(async function() {
   const mocks = new Mocks();
   const { document, tab } = await openAboutDebugging();
 
   info("Create a device without a corresponding runtime");
@@ -27,17 +27,17 @@ add_task(async function() {
 
   ok(usbRuntimeSidebarItem.querySelector(".qa-runtime-item-waiting-for-browser"),
     "Sidebar item shows as `Waiting for browser`");
 
   const hasConnectButton = usbRuntimeSidebarItem.querySelector(".js-connect-button");
   ok(!hasConnectButton, "Connect button is not displayed");
 
   const hasLink = usbRuntimeSidebarItem.querySelector(".js-sidebar-link");
-  ok(!hasLink, "Unknown runtime is not selectable");
+  ok(!hasLink, "Unavailable runtime is not selectable");
 
   info("Add a valid runtime for the same device id and emit update event");
   mocks.createUSBRuntime(RUNTIME_ID, {
     deviceId: DEVICE_ID,
     deviceName: DEVICE_NAME,
     shortName: RUNTIME_NAME,
   });
   mocks.removeDevice(DEVICE_ID);
--- a/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js
+++ b/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js
@@ -118,17 +118,16 @@ class Mocks {
   /**
    * Creates a USB runtime for which a client conenction can be established.
    * @param {String} id
    *        The id of the runtime.
    * @param {Object} optional object used to create the fake runtime & device
    *        - channel: {String} Release channel, for instance "release", "nightly"
    *        - deviceId: {String} Device id
    *        - deviceName: {String} Device name
-   *        - isUnknown: {Function} should return a boolean, true for unknown runtimes
    *        - name: {String} Application name, for instance "Firefox"
    *        - shortName: {String} Short name for the device
    *        - socketPath: {String} (should only be used for connecting, so not here)
    *        - version: {String} Version, for instance "63.0a"
    * @return {Object} Returns the mock client created for this runtime so that methods
    * can be overridden on it.
    */
   createUSBRuntime(id, runtimeInfo = {}) {