Bug 979169 - A new testcase. r=aknow

--HG--
extra : histedit_source : 5705a5bb4e6397adfee32d10dfc86170ee9a4894
This commit is contained in:
Ben Hsu 2015-05-31 22:42:00 -04:00
Родитель 7512b2ad2e
Коммит ed1d624ec3
2 изменённых файлов: 67 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

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