Bug 835186: Add delay to run next test case. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Thu, 31 Jan 2013 11:15:43 +0800
changeset 130587 0c6f78d3f0a498ff2222139ca157f65a3db294c5
parent 130586 bf21c968fa892c155ba689619d214cdade85c0df
child 130588 f24b93663ea95a4252e38be6e4f0cdf7ebe5c211
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs835186
milestone21.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 835186: Add delay to run next test case. r=vicamo
dom/network/tests/marionette/test_mobile_iccinfo.js
--- a/dom/network/tests/marionette/test_mobile_iccinfo.js
+++ b/dom/network/tests/marionette/test_mobile_iccinfo.js
@@ -14,24 +14,21 @@ function sendEmulatorCommand(cmd, callba
   emulatorCmdPendingCount++;
   runEmulatorCmd(cmd, function (result) {
     emulatorCmdPendingCount--;
     is(result[result.length - 1], "OK");
     callback(result);
   });
 }
 
-function setEmulatorMccMnc(mcc, mnc, callback) {
+function setEmulatorMccMnc(mcc, mnc) {
   let cmd = "operator set 0 Android,Android," + mcc + mnc;
   sendEmulatorCommand(cmd, function (result) {
     let re = new RegExp("" + mcc + mnc + "$");
     ok(result[0].match(re), "MCC/MNC should be changed.");
-    if (callback) {
-      callback();
-    }
   });
 }
 
 function waitForIccInfoChange(callback) {
   connection.addEventListener("iccinfochange", function handler() {
     connection.removeEventListener("iccinfochange", handler);
     callback();
   });
@@ -66,21 +63,23 @@ function testDisplayConditionChange(func
 
 function testSPN(mcc, mnc, expectedIsDisplayNetworkNameRequired,
                   expectedIsDisplaySpnRequired, callback) {
   waitForIccInfoChange(function() {
     is(connection.iccInfo.isDisplayNetworkNameRequired,
        expectedIsDisplayNetworkNameRequired);
     is(connection.iccInfo.isDisplaySpnRequired,
        expectedIsDisplaySpnRequired);
-    window.setTimeout(callback, 0);
+    // operatorchange will be ignored if we send commands too soon.
+    window.setTimeout(callback, 100);
   });
   setEmulatorMccMnc(mcc, mnc);
 }
 
 testDisplayConditionChange(testSPN, [
+  // [MCC, MNC, isDisplayNetworkNameRequired, isDisplaySpnRequired]
   [123, 456, false, true], // Not in HPLMN.
   [234, 136,  true, true], // Not in HPLMN, but in PLMN specified in SPDI.
   [123, 456, false, true], // Not in HPLMN. Triggering iccinfochange
   [466,  92,  true, true], // Not in HPLMN, but in another PLMN specified in SPDI.
   [123, 456, false, true], // Not in HPLMN. Triggering iccinfochange
   [310, 260,  true, true], // inside HPLMN.
 ], finalize);