Bug 1140259 - Part 2: [RIL] Handle options.errorMsg in processParcel() and map unknown error code to "UnspecifiedError". r=hsinyi

This commit is contained in:
Edgar Chen 2014-05-12 16:17:13 +08:00
Родитель 1b8133d8c6
Коммит 6504c4b984
9 изменённых файлов: 33 добавлений и 116 удалений

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

@ -232,7 +232,6 @@ this.ERROR_ILLEGAL_SIM_OR_ME = 15;
this.ERROR_MISSING_RESOURCE = 16;
this.ERROR_NO_SUCH_ELEMENT = 17;
this.GECKO_ERROR_SUCCESS = null;
this.GECKO_ERROR_RADIO_NOT_AVAILABLE = "RadioNotAvailable";
this.GECKO_ERROR_GENERIC_FAILURE = "GenericFailure";
this.GECKO_ERROR_PASSWORD_INCORRECT = "IncorrectPassword";
@ -251,9 +250,9 @@ this.GECKO_ERROR_ILLEGAL_SIM_OR_ME = "IllegalSIMorME";
this.GECKO_ERROR_MISSING_RESOURCE = "MissingResource";
this.GECKO_ERROR_NO_SUCH_ELEMENT = "NoSuchElement";
this.GECKO_ERROR_INVALID_PARAMETER = "InvalidParameter";
this.GECKO_ERROR_UNSPECIFIED_ERROR = "UnspecifiedError";
this.RIL_ERROR_TO_GECKO_ERROR = {};
RIL_ERROR_TO_GECKO_ERROR[ERROR_SUCCESS] = GECKO_ERROR_SUCCESS;
RIL_ERROR_TO_GECKO_ERROR[ERROR_RADIO_NOT_AVAILABLE] = GECKO_ERROR_RADIO_NOT_AVAILABLE;
RIL_ERROR_TO_GECKO_ERROR[ERROR_GENERIC_FAILURE] = GECKO_ERROR_GENERIC_FAILURE;
RIL_ERROR_TO_GECKO_ERROR[ERROR_PASSWORD_INCORRECT] = GECKO_ERROR_PASSWORD_INCORRECT;

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

@ -2029,7 +2029,6 @@ RilObject.prototype = {
}
options.smscAddress = this.SMSC;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
},
@ -3204,9 +3203,6 @@ RilObject.prototype = {
*/
_processEnterAndChangeICCResponses: function(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1;
if (options.rilMessageType != "sendMMI") {
this.sendChromeMessage(options);
@ -3923,9 +3919,7 @@ RilObject.prototype = {
// Should not include token for unsolicited response.
delete message.rilMessageToken;
message.rilMessageType = "datacallerror";
if (errorCode == ERROR_GENERIC_FAILURE) {
message.errorMsg = RIL_ERROR_TO_GECKO_ERROR[errorCode];
} else {
if (errorCode !== ERROR_GENERIC_FAILURE) {
message.errorMsg = RIL_DATACALL_FAILCAUSE_TO_GECKO_DATACALL_ERROR[errorCode];
}
this.sendChromeMessage(message);
@ -5131,7 +5125,6 @@ RilObject.prototype = {
}
options.success = (options.rilRequestError === 0);
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
},
@ -5437,7 +5430,6 @@ RilObject.prototype[REQUEST_RADIO_POWER] = function REQUEST_RADIO_POWER(length,
return;
}
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_DTMF] = null;
@ -5487,8 +5479,7 @@ RilObject.prototype[REQUEST_SETUP_DATA_CALL] = function REQUEST_SETUP_DATA_CALL(
RilObject.prototype[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) {
if (options.rilRequestError) {
if (options.onerror) {
options.onerror(RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError] ||
GECKO_ERROR_GENERIC_FAILURE);
options.onerror(options.errorMsg);
}
return;
}
@ -5523,7 +5514,6 @@ RilObject.prototype[REQUEST_SEND_USSD] = function REQUEST_SEND_USSD(length, opti
this.context.debug("REQUEST_SEND_USSD " + JSON.stringify(options));
}
options.success = (this._ussdSession = options.rilRequestError === 0);
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length, options) {
@ -5533,7 +5523,6 @@ RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length,
options.success = (options.rilRequestError === 0);
this._ussdSession = !options.success;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
// The cancelUSSD is triggered by ril_worker itself.
if (this.cachedUSSDRequest) {
@ -5548,7 +5537,6 @@ RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length,
RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -5636,9 +5624,7 @@ RilObject.prototype[REQUEST_SET_CLIR] = function REQUEST_SET_CLIR(length, option
return;
}
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else if (options.rilMessageType === "sendMMI") {
if (options.success && options.rilMessageType === "sendMMI") {
switch (options.procedure) {
case MMI_PROCEDURE_ACTIVATION:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@ -5655,7 +5641,6 @@ RilObject.prototype[REQUEST_QUERY_CALL_FORWARD_STATUS] =
function REQUEST_QUERY_CALL_FORWARD_STATUS(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -5695,9 +5680,7 @@ RilObject.prototype[REQUEST_QUERY_CALL_FORWARD_STATUS] =
RilObject.prototype[REQUEST_SET_CALL_FORWARD] =
function REQUEST_SET_CALL_FORWARD(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else if (options.rilMessageType === "sendMMI") {
if (options.success && options.rilMessageType === "sendMMI") {
switch (options.action) {
case CALL_FORWARD_ACTION_ENABLE:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@ -5719,8 +5702,6 @@ RilObject.prototype[REQUEST_QUERY_CALL_WAITING] =
function REQUEST_QUERY_CALL_WAITING(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
if (options.callback) {
// Prevent DataCloneError when sending chrome messages.
delete options.callback;
@ -5745,8 +5726,6 @@ RilObject.prototype[REQUEST_QUERY_CALL_WAITING] =
RilObject.prototype[REQUEST_SET_CALL_WAITING] = function REQUEST_SET_CALL_WAITING(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
if (options.callback) {
// Prevent DataCloneError when sending chrome messages.
delete options.callback;
@ -5773,8 +5752,7 @@ RilObject.prototype[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, option
}
options.success = (options.rilRequestError === 0);
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
if ((!options.success || this.IMEI == null) && !options.errorMsg) {
if (options.success && this.IMEI == null) {
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
}
options.statusMessage = this.IMEI;
@ -5804,7 +5782,6 @@ RilObject.prototype[REQUEST_DEACTIVATE_DATA_CALL] = function REQUEST_DEACTIVATE_
RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILITY_LOCK(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -5846,10 +5823,6 @@ RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILI
};
RilObject.prototype[REQUEST_SET_FACILITY_LOCK] = function REQUEST_SET_FACILITY_LOCK(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1;
if (options.success && (options.rilMessageType === "sendMMI")) {
@ -5866,10 +5839,6 @@ RilObject.prototype[REQUEST_SET_FACILITY_LOCK] = function REQUEST_SET_FACILITY_L
};
RilObject.prototype[REQUEST_CHANGE_BARRING_PASSWORD] =
function REQUEST_CHANGE_BARRING_PASSWORD(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
if (options.rilMessageType != "sendMMI") {
this.sendChromeMessage(options);
return;
@ -5903,36 +5872,25 @@ RilObject.prototype[REQUEST_QUERY_NETWORK_SELECTION_MODE] = function REQUEST_QUE
this._updateNetworkSelectionMode(selectionMode);
};
RilObject.prototype[REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = function REQUEST_SET_NETWORK_SELECTION_AUTOMATIC(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else {
if (!options.rilRequestError) {
this._updateNetworkSelectionMode(GECKO_NETWORK_SELECTION_AUTOMATIC);
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_SET_NETWORK_SELECTION_MANUAL] = function REQUEST_SET_NETWORK_SELECTION_MANUAL(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else {
if (!options.rilRequestError) {
this._updateNetworkSelectionMode(GECKO_NETWORK_SELECTION_MANUAL);
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_QUERY_AVAILABLE_NETWORKS] = function REQUEST_QUERY_AVAILABLE_NETWORKS(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else {
if (!options.rilRequestError) {
options.networks = this._processNetworks();
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_DTMF_START] = function REQUEST_DTMF_START(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_DTMF_STOP] = null;
@ -5952,7 +5910,6 @@ RilObject.prototype[REQUEST_GET_MUTE] = null;
RilObject.prototype[REQUEST_QUERY_CLIP] = function REQUEST_QUERY_CLIP(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6103,14 +6060,10 @@ RilObject.prototype[REQUEST_STK_SEND_TERMINAL_RESPONSE] = null;
RilObject.prototype[REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM] = null;
RilObject.prototype[REQUEST_EXPLICIT_CALL_TRANSFER] = null;
RilObject.prototype[REQUEST_SET_PREFERRED_NETWORK_TYPE] = function REQUEST_SET_PREFERRED_NETWORK_TYPE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_GET_PREFERRED_NETWORK_TYPE] = function REQUEST_GET_PREFERRED_NETWORK_TYPE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6120,7 +6073,6 @@ RilObject.prototype[REQUEST_GET_PREFERRED_NETWORK_TYPE] = function REQUEST_GET_P
};
RilObject.prototype[REQUEST_GET_NEIGHBORING_CELL_IDS] = function REQUEST_GET_NEIGHBORING_CELL_IDS(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6184,7 +6136,6 @@ RilObject.prototype[REQUEST_GET_NEIGHBORING_CELL_IDS] = function REQUEST_GET_NEI
};
RilObject.prototype[REQUEST_GET_CELL_INFO_LIST] = function REQUEST_GET_CELL_INFO_LIST(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6245,15 +6196,10 @@ RilObject.prototype[REQUEST_GET_CELL_INFO_LIST] = function REQUEST_GET_CELL_INFO
RilObject.prototype[REQUEST_SET_LOCATION_UPDATES] = null;
RilObject.prototype[REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE] = null;
RilObject.prototype[REQUEST_CDMA_SET_ROAMING_PREFERENCE] = function REQUEST_CDMA_SET_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_CDMA_QUERY_ROAMING_PREFERENCE] = function REQUEST_CDMA_QUERY_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
} else {
if (!options.rilRequestError) {
options.mode = this.context.Buf.readInt32List()[0];
}
this.sendChromeMessage(options);
@ -6261,17 +6207,10 @@ RilObject.prototype[REQUEST_CDMA_QUERY_ROAMING_PREFERENCE] = function REQUEST_CD
RilObject.prototype[REQUEST_SET_TTY_MODE] = null;
RilObject.prototype[REQUEST_QUERY_TTY_MODE] = null;
RilObject.prototype[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE] = function REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE] = function REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6339,9 +6278,6 @@ RilObject.prototype[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = function REQUEST_EXI
}
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, options) {
@ -6352,7 +6288,6 @@ RilObject.prototype[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRES
}
options.smscAddress = this.SMSC;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_SET_SMSC_ADDRESS] = null;
@ -6409,7 +6344,6 @@ RilObject.prototype[REQUEST_IMS_SEND_SMS] = null;
RilObject.prototype[REQUEST_SIM_TRANSMIT_APDU_BASIC] = null;
RilObject.prototype[REQUEST_SIM_OPEN_CHANNEL] = function REQUEST_SIM_OPEN_CHANNEL(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6424,7 +6358,6 @@ RilObject.prototype[REQUEST_SIM_CLOSE_CHANNEL] = function REQUEST_SIM_CLOSE_CHAN
};
RilObject.prototype[REQUEST_SIM_TRANSMIT_APDU_CHANNEL] = function REQUEST_SIM_TRANSMIT_APDU_CHANNEL(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
@ -6464,16 +6397,10 @@ RilObject.prototype[REQUEST_SET_DATA_SUBSCRIPTION] = function REQUEST_SET_DATA_S
return;
}
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_GET_UNLOCK_RETRY_COUNT] = function REQUEST_GET_UNLOCK_RETRY_COUNT(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1;
this.sendChromeMessage(options);
};
@ -6483,16 +6410,10 @@ RilObject.prototype[RIL_REQUEST_GPRS_ATTACH] = function RIL_REQUEST_GPRS_ATTACH(
return;
}
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[RIL_REQUEST_GPRS_DETACH] = function RIL_REQUEST_GPRS_DETACH(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED() {

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

@ -80,6 +80,10 @@
requestType = options.rilRequestType;
options.rilRequestError = error;
if (error !== ERROR_SUCCESS) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[error] ||
GECKO_ERROR_UNSPECIFIED_ERROR;
}
if (DEBUG) {
this.context.debug("Solicited response for request type " + requestType +
", token " + token + ", error " + error);

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -45,7 +45,6 @@ add_test(function test_check_change_call_barring_password_result() {
postMessage: function(message) {
equal(barringPasswordOptions.pin, PIN);
equal(barringPasswordOptions.newPin, NEW_PIN);
equal(message.errorMsg, GECKO_ERROR_SUCCESS);
}
});

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -73,7 +73,6 @@ add_test(function test_setCallForward_unconditional() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -122,7 +121,6 @@ add_test(function test_queryCallForwardStatus_unconditional() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(Array.isArray(postedMessage.rules));
do_print(postedMessage.rules.length);

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -48,7 +48,8 @@ add_test(function test_setCLIR_generic_failure() {
context.RIL.setCLIR = function fakeSetCLIR(options) {
context.RIL[REQUEST_SET_CLIR](0, {
rilMessageType: "setCLIR",
rilRequestError: ERROR_GENERIC_FAILURE
rilRequestError: ERROR_GENERIC_FAILURE,
errorMsg: GECKO_ERROR_GENERIC_FAILURE
});
};
@ -58,7 +59,7 @@ add_test(function test_setCLIR_generic_failure() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.errorMsg, "GenericFailure");
equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
ok(!postedMessage.success);
run_next_test();

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -37,7 +37,8 @@ add_test(function test_setCallWaiting_generic_failure() {
context.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
context.RIL[REQUEST_SET_CALL_WAITING](0, {
rilRequestError: ERROR_GENERIC_FAILURE
rilRequestError: ERROR_GENERIC_FAILURE,
errorMsg: GECKO_ERROR_GENERIC_FAILURE
});
};
@ -47,7 +48,7 @@ add_test(function test_setCallWaiting_generic_failure() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.errorMsg, "GenericFailure");
equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
ok(!postedMessage.success);
run_next_test();

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -66,7 +66,6 @@ add_test(function test_sendMMI_short_code() {
let postedMessage = workerhelper.postedMessage;
equal(ussdOptions.ussd, "**");
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(context.RIL._ussdSession);
@ -90,7 +89,6 @@ add_test(function test_sendMMI_change_PIN() {
let postedMessage = workerhelper.postedMessage;
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -141,7 +139,6 @@ add_test(function test_sendMMI_change_PIN2() {
let postedMessage = workerhelper.postedMessage;
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -192,7 +189,6 @@ add_test(function test_sendMMI_unblock_PIN() {
let postedMessage = workerhelper.postedMessage;
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -243,7 +239,6 @@ add_test(function test_sendMMI_unblock_PIN2() {
let postedMessage = workerhelper.postedMessage;
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -295,7 +290,6 @@ add_test(function test_sendMMI_get_IMEI() {
let postedMessage = workerhelper.postedMessage;
notEqual(mmiOptions.mmi, null);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
@ -311,6 +305,7 @@ add_test(function test_sendMMI_get_IMEI_error() {
mmiOptions = options;
context.RIL[REQUEST_SEND_USSD](0, {
rilRequestError: ERROR_RADIO_NOT_AVAILABLE,
errorMsg: GECKO_ERROR_RADIO_NOT_AVAILABLE
});
};
@ -437,7 +432,6 @@ add_test(function test_sendMMI_USSD() {
let postedMessage = workerhelper.postedMessage;
equal(ussdOptions.ussd, "**123#");
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(context.RIL._ussdSession);
@ -453,7 +447,8 @@ add_test(function test_sendMMI_USSD_error() {
context.RIL.sendUSSD = function fakeSendUSSD(options){
ussdOptions = options;
context.RIL[REQUEST_SEND_USSD](0, {
rilRequestError: ERROR_GENERIC_FAILURE
rilRequestError: ERROR_GENERIC_FAILURE,
errorMsg: GECKO_ERROR_GENERIC_FAILURE
});
};
@ -463,7 +458,7 @@ add_test(function test_sendMMI_USSD_error() {
let postedMessage = workerhelper.postedMessage;
equal(ussdOptions.ussd, "**123#");
equal (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
ok(!postedMessage.success);
ok(!context.RIL._ussdSession);
@ -486,7 +481,6 @@ function setCallWaitingSuccess(mmi) {
let postedMessage = workerhelper.postedMessage;
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
}
@ -539,7 +533,6 @@ add_test(function test_sendMMI_call_waiting_interrogation() {
let postedMessage = workerhelper.postedMessage;
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
equal(postedMessage.length, 2);
ok(postedMessage.enabled);

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

@ -1,5 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
@ -36,7 +36,8 @@ add_test(function test_setVoicePrivacyMode_generic_failure() {
context.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
context.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
rilRequestError: ERROR_GENERIC_FAILURE
rilRequestError: ERROR_GENERIC_FAILURE,
errorMsg: GECKO_ERROR_GENERIC_FAILURE
});
};
@ -46,7 +47,7 @@ add_test(function test_setVoicePrivacyMode_generic_failure() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.errorMsg, "GenericFailure");
equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
run_next_test();
});