Bug 1313580 - Part 1: Remove unused B2G tests for Battery API. r=baku
authorChris Peterson <cpeterson@mozilla.com>
Fri, 28 Oct 2016 18:41:43 -0700
changeset 320109 8f8f02af9d17a6c04462cedaab803b89acd681d7
parent 320101 ee15183d057288ccd8b6b22b13b85c540229f736
child 320110 585f52662d697ca95cb679246cc59ce28fefe60b
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1313580
milestone52.0a1
Bug 1313580 - Part 1: Remove unused B2G tests for Battery API. r=baku
dom/battery/test/marionette/manifest.ini
dom/battery/test/marionette/test_battery_level.js
dom/battery/test/marionette/test_battery_status_charging.js
dom/battery/test/marionette/test_battery_status_discharging.js
dom/battery/test/marionette/test_battery_status_full.js
dom/battery/test/marionette/test_battery_status_not_charging.js
dom/battery/test/marionette/test_battery_status_unknown.js
dom/battery/test/mochitest.ini
testing/marionette/harness/marionette/tests/webapi-tests.ini
deleted file mode 100644
--- a/dom/battery/test/marionette/manifest.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[DEFAULT]
-run-if = buildapp == 'b2g'
-
-[test_battery_level.js]
-[test_battery_status_charging.js]
-[test_battery_status_discharging.js]
-[test_battery_status_full.js]
-[test_battery_status_not_charging.js]
-[test_battery_status_unknown.js]
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_level.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = null;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    is(battery.level, 0.5, "battery.level");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("capacity: 50") !== -1, "power capacity");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  levelUp();
-}
-
-function changeCapacity(capacity, changeExpected, nextFunction) {
-  log("Changing power capacity to " + capacity);
-  if (changeExpected) {
-    battery.onlevelchange = function (event) {
-      battery.onlevelchange = unexpectedEvent;
-      is(event.type, "levelchange", "event.type");
-      is(battery.level, capacity / 100, "battery.level");
-      nextFunction();
-    };
-    runEmulatorCmd("power capacity " + capacity);
-  }
-  else {
-    runEmulatorCmd("power capacity " + capacity, function () {
-      is(battery.level, capacity / 100, "battery.level");
-      nextFunction();
-    });
-  }
-}
-
-function levelUp() {
-  changeCapacity("90", true, levelDown);
-}
-
-function levelDown() {
-  changeCapacity("10", true, levelSame);
-}
-
-function levelSame() {
-  changeCapacity("10", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = function () {
-    battery.onlevelchange = null;
-    finish();
-  };
-  runEmulatorCmd("power capacity 50");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_status_charging.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = null;
-var fromStatus = "charging";
-var fromCharging = true;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    ok(battery.charging, "battery.charging");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("status: Charging") !== -1, "power status charging");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  toDischarging();
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = null;
-  finish();
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_status_discharging.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery = null;
-var fromStatus = "discharging";
-var fromCharging = false;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    ok(battery.charging, "battery.charging");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("status: Charging") !== -1, "power status charging");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_status_full.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery;
-var fromStatus = "full";
-var fromCharging = true;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    ok(battery.charging, "battery.charging");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("status: Charging") !== -1, "power status charging");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = unexpectedEvent;
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus, toCharging);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = null;
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging", finish);
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_status_not_charging.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery;
-var fromStatus = "not-charging";
-var fromCharging = false;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    ok(battery.charging, "battery.charging");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("status: Charging") !== -1, "power status charging");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toUnknown);
-}
-
-function toUnknown() {
-  changeStatus("unknown", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
deleted file mode 100644
--- a/dom/battery/test/marionette/test_battery_status_unknown.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-MARIONETTE_TIMEOUT = 10000;
-
-var battery;
-var fromStatus = "unknown";
-var fromCharging = false;
-
-function verifyInitialState() {
-  window.navigator.getBattery().then(function (b) {
-    battery = b;
-    ok(battery, "battery");
-    ok(battery.charging, "battery.charging");
-    runEmulatorCmd("power display", function (result) {
-      is(result.pop(), "OK", "power display successful");
-      ok(result.indexOf("status: Charging") !== -1, "power status charging");
-      setUp();
-    });
-  });
-}
-
-function unexpectedEvent(event) {
-  ok(false, "Unexpected " + event.type + " event");
-}
-
-function setUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = unexpectedEvent;
-    toCharging();
-  };
-  battery.onlevelchange = unexpectedEvent;
-  log("Changing power status to " + fromStatus);
-  runEmulatorCmd("power status " + fromStatus);
-}
-
-function resetStatus(charging, nextFunction) {
-  log("Resetting power status to " + fromStatus);
-  if (charging !== fromCharging) {
-    battery.onchargingchange = function () {
-      battery.onchargingchange = unexpectedEvent;
-      nextFunction();
-    };
-    runEmulatorCmd("power status " + fromStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + fromStatus, nextFunction);
-  }
-}
-
-function changeStatus(toStatus, toCharging, nextFunction) {
-  log("Changing power status to " + toStatus);
-  if (fromCharging !== toCharging) {
-    battery.onchargingchange = function (event) {
-      battery.onchargingchange = unexpectedEvent;
-      is(event.type, "chargingchange", "event type");
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    };
-    runEmulatorCmd("power status " + toStatus);
-  }
-  else {
-    runEmulatorCmd("power status " + toStatus, function () {
-      is(battery.charging, toCharging, "battery.charging");
-      resetStatus(toCharging, nextFunction);
-    });
-  }
-}
-
-function toCharging() {
-  changeStatus("charging", true, toDischarging);
-}
-
-function toDischarging() {
-  changeStatus("discharging", false, toFull);
-}
-
-function toFull() {
-  changeStatus("full", true, toNotCharging);
-}
-
-function toNotCharging() {
-  changeStatus("not-charging", false, cleanUp);
-}
-
-function cleanUp() {
-  battery.onchargingchange = function () {
-    battery.onchargingchange = null;
-    finish();
-  };
-  battery.onlevelchange = null;
-  log("Resetting power status to charging");
-  runEmulatorCmd("power status charging");
-}
-
-verifyInitialState();
--- a/dom/battery/test/mochitest.ini
+++ b/dom/battery/test/mochitest.ini
@@ -1,6 +1,3 @@
 [test_battery_basics.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_battery_charging.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_battery_discharging.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
--- a/testing/marionette/harness/marionette/tests/webapi-tests.ini
+++ b/testing/marionette/harness/marionette/tests/webapi-tests.ini
@@ -1,10 +1,9 @@
 [include:../../../../../dom/bluetooth/tests/marionette/manifest.ini]
-[include:../../../../../dom/battery/test/marionette/manifest.ini]
 [include:../../../../../dom/mobileconnection/tests/marionette/manifest.ini]
 [include:../../../../../dom/system/gonk/tests/marionette/manifest.ini]
 [include:../../../../../dom/icc/tests/marionette/manifest.ini]
 [include:../../../../../dom/system/tests/marionette/manifest.ini]
 skip-if = android_version > '15' # Bug 1203072
 [include:../../../../../dom/events/test/marionette/manifest.ini]
 [include:../../../../../dom/wifi/test/marionette/manifest.ini]
 [include:../../../../../dom/tethering/tests/marionette/manifest.ini]