Bug 979169 - A new testcase. r=aknow

This commit is contained in:
Ben Hsu 2015-05-31 22:42:00 -04:00
parent 270417de44
commit 524c0612fb
2 changed files with 67 additions and 0 deletions

View File

@ -276,6 +276,18 @@ let emulator = (function() {
});
}
/**
* @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
*/
@ -1152,6 +1164,7 @@ let emulator = (function() {
this.gWaitForNamedStateEvent = waitForNamedStateEvent;
this.gWaitForStateChangeEvent = waitForStateChangeEvent;
this.gCheckInitialState = checkInitialState;
this.gChangeModemTech = changeModemTech;
this.gClearCalls = clearCalls;
this.gOutCallStrPool = outCallStrPool;
this.gInCallStrPool = inCallStrPool;

View File

@ -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);
});