Bug 979169 - A new testcase. r=aknow
authorBen Hsu <bhsu@mozilla.com>
Sun, 31 May 2015 22:42:00 -0400
changeset 247801 f5226b854bf4571d0116fc0f22314fcd120d6b22
parent 247800 ace5ecc29a7ca6e42144b447d4e4286c6409d67d
child 247802 56cb10f6dc1380dc395fd2bbe3558ff19d0c6a46
push id60814
push userkwierso@gmail.com
push dateWed, 10 Jun 2015 02:29:27 +0000
treeherdermozilla-inbound@bc32a90612e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaknow
bugs979169
milestone41.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 979169 - A new testcase. r=aknow
dom/telephony/test/marionette/head.js
dom/telephony/test/marionette/test_modem_switch_tech.js
--- a/dom/telephony/test/marionette/head.js
+++ b/dom/telephony/test/marionette/head.js
@@ -274,16 +274,28 @@ let emulator = (function() {
         return telephony.calls.length === 0;
       });
     });
   }
 
   /**
    * @return Promise
    */
+  function changeModemTech(aTech, aPreferredMask) {
+    return Promise.resolve()
+      .then(() => emulator.runCmd("modem tech " + aTech + " " + aPreferredMask))
+      .then(() => emulator.runCmd("modem tech"))
+      .then(result => is(result[0],
+                         aTech + " " + aPreferredMask,
+                         "Check modem 'tech/preferred mask'"));
+  }
+
+  /**
+   * @return Promise
+   */
   function clearCalls() {
     log("Clear existing calls.");
 
     // Hang up all calls.
     let hangUpPromises = [];
 
     for (let call of telephony.calls) {
       log(".. hangUp " + call.id.number);
@@ -1147,16 +1159,17 @@ let emulator = (function() {
 
   this.gDelay = delay;
   this.gWaitForSystemMessage = waitForSystemMessage;
   this.gWaitForEvent = waitForEvent;
   this.gWaitForCallsChangedEvent = waitForCallsChangedEvent;
   this.gWaitForNamedStateEvent = waitForNamedStateEvent;
   this.gWaitForStateChangeEvent = waitForStateChangeEvent;
   this.gCheckInitialState = checkInitialState;
+  this.gChangeModemTech = changeModemTech;
   this.gClearCalls = clearCalls;
   this.gOutCallStrPool = outCallStrPool;
   this.gInCallStrPool = inCallStrPool;
   this.gCheckState = checkState;
   this.gCheckAll = checkAll;
   this.gSendMMI = sendMMI;
   this.gDial = dial;
   this.gDialEmergency = dialEmergency;
new file mode 100644
--- /dev/null
+++ b/dom/telephony/test/marionette/test_modem_switch_tech.js
@@ -0,0 +1,54 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+MARIONETTE_HEAD_JS = "head.js";
+
+let settings = [
+  // "gsm/wcdma"
+  {tech: "gsm",   mask: "gsm/wcdma"},
+  {tech: "wcdma", mask: "gsm/wcdma"},
+
+  // "gsm"
+  {tech: "gsm",   mask: "gsm"},
+
+  // "wcdma"
+  {tech: "wcdma", mask: "wcdma"},
+
+  // "gsm/wcdma-auto"
+  {tech: "gsm",   mask: "gsm/wcdma-auto"},
+  {tech: "wcdma", mask: "gsm/wcdma-auto"},
+
+  // "cdma/evdo"
+  {tech: "cdma",  mask: "cdma/evdo"},
+  {tech: "evdo",  mask: "cdma/evdo"},
+
+  // "cdma"
+  {tech: "cdma",  mask: "cdma"},
+
+  // "evdo"
+  {tech: "evdo",  mask: "evdo"},
+
+  // "gsm/wcdma/cdma/evdo"
+  {tech: "gsm",   mask: "gsm/wcdma/cdma/evdo"},
+  {tech: "wcdma", mask: "gsm/wcdma/cdma/evdo"},
+  {tech: "cdma",  mask: "gsm/wcdma/cdma/evdo"},
+  {tech: "evdo",  mask: "gsm/wcdma/cdma/evdo"}
+];
+
+startTest(function() {
+
+  let promise = settings.reduce((aPromise, aSetting) => {
+    return aPromise.then(() => gChangeModemTech(aSetting.tech, aSetting.mask));
+  }, Promise.resolve());
+
+  return promise
+    // Exception Catching
+    .catch(error => ok(false, "Promise reject: " + error))
+
+    // Switch to the default modem tech
+    .then(() => gChangeModemTech("wcdma", "gsm/wcdma"))
+    .catch(error => ok(false, "Fetal Error: Promise reject: " + error))
+
+    .then(finish);
+});