author | Samael Wang <freesamael@gmail.com> |
Tue, 04 Aug 2015 13:58:42 +0800 | |
changeset 257104 | a29e9b59c7f5343d815907f0ba72f740396facb2 |
parent 257103 | 93db1a349ab9e8a84750e9a92bf21f2fea861c18 |
child 257105 | 77123d898d4cfbfe891eec605fb0a8a0394b02b2 |
push id | 63526 |
push user | kwierso@gmail.com |
push date | Mon, 10 Aug 2015 22:02:03 +0000 |
treeherder | mozilla-inbound@c4ab17503c09 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | btseng |
bugs | 1187832 |
milestone | 42.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
|
--- a/dom/icc/tests/marionette/test_stk_send_dtmf.js +++ b/dom/icc/tests/marionette/test_stk_send_dtmf.js @@ -12,23 +12,21 @@ const TEST_DATA = [ "AC052143658709", // DTMF string expect: {commandQualifier: 0x00, text: "Send DTMF"}}, {command: "D010" + // Length "8103011400" + // Command details "82028183" + // Device identities "AC052143658709", // DTMF string expect: {commandQualifier: 0x00}}, - {command: "D013" + // Length + {command: "D011" + // Length "8103011400" + // Command details "82028183" + // Device identities - "8500" + // Alpha identifier "AC06C1CCCCCCCC2C", // DTMF string - expect: {commandQualifier: 0x00, - text: ""}}, + expect: {commandQualifier: 0x00}}, {command: "D01D" + // Length "8103011400" + // Command details "82028183" + // Device identities "850A42617369632049636F6E" + // Alpha identifier "AC02C1F2" + // DTMF string "9E020001", // Icon identifier expect: {commandQualifier: 0x00, text: "Basic Icon", @@ -61,17 +59,24 @@ const TEST_DATA = [ "8103011400" + // Command details "82028183" + // Device identities "8505804F60597D" + // Alpha identifier "AC02C1F2", // DTMF string expect: {commandQualifier: 0x00, text: "你好"}}, ]; -function testSendDTMF(aCommand, aExpect) { +const TEST_CMD_NULL_ALPHA_ID = + "D013" + // Length + "8103011400" + // Command details + "82028183" + // Device identities + "8500" + // Alpha identifier + "AC06C1CCCCCCCC2C"; + +function verifySendDTMF(aCommand, aExpect) { is(aCommand.commandNumber, 0x01, "commandNumber"); is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand"); is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier"); // text is optional. if ("text" in aExpect) { is(aCommand.options.text, aExpect.text, "options.text"); } @@ -79,35 +84,62 @@ function testSendDTMF(aCommand, aExpect) // icons is optional. if ("icons" in aExpect) { isIcons(aCommand.options.icons, aExpect.icons); is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory, "options.iconSelfExplanatory"); } } -// Start tests -startTestCommon(function() { +function testSendDTMF() { let icc = getMozIcc(); let promise = Promise.resolve(); for (let i = 0; i < TEST_DATA.length; i++) { let data = TEST_DATA[i]; promise = promise.then(() => { log("send_dtmf_cmd: " + data.command); let promises = []; // Wait onstkcommand event. promises.push(waitForTargetEvent(icc, "stkcommand") - .then((aEvent) => testSendDTMF(aEvent.command, data.expect))); + .then((aEvent) => verifySendDTMF(aEvent.command, data.expect))); // Wait icc-stkcommand system message. promises.push(waitForSystemMessage("icc-stkcommand") .then((aMessage) => { is(aMessage.iccId, icc.iccInfo.iccid, "iccId"); - testSendDTMF(aMessage.command, data.expect); + verifySendDTMF(aMessage.command, data.expect); })); // Send emulator command to generate stk unsolicited event. promises.push(sendEmulatorStkPdu(data.command)); return Promise.all(promises); }); } return promise; +} + +function testSendDTMFNullAlphaId() { + let icc = getMozIcc(); + + // No "stkcommand" event should occur. + icc.addEventListener("stkcommand", + (event) => ok(false, event + " should not occur.")); + + // No "icc-stkcommand" system message should be sent. + workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand", + (msg) => ok(false, msg + " should not be sent.")); + + // If nothing happens within 3 seconds after the emulator command sent, + // treat as success. + log("send_dtmf_cmd: " + TEST_CMD_NULL_ALPHA_ID); + return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID) + .then(() => new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 3000); + })); +} + + +// Start tests +startTestCommon(function() { + return Promise.resolve() + .then(() => testSendDTMF()) + .then(() => testSendDTMFNullAlphaId()); });
--- a/dom/icc/tests/marionette/test_stk_send_sms.js +++ b/dom/icc/tests/marionette/test_stk_send_sms.js @@ -66,24 +66,22 @@ const TEST_DATA = [ "5420" + "8B09010002911040F00120", // 3GPP-SMS TPDU expect: {commandQualifier: 0x00, text: "Two types are defined: - A short message to be sent to " + "the network in an SMS-SUBMIT message, or an SMS-COMMAND " + "message, where the user data can be passed transparently; " + "- A short message to be sent to the network in an " + "SMS-SUBMIT "}}, - {command: "D030" + // Length + {command: "D02E" + // Length "8103011300" + // Command details "82028183" + // Device identities - "8500" + // Alpha identifier "86099111223344556677F8" + // Address "8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU - expect: {commandQualifier: 0x00, - text: ""}}, + expect: {commandQualifier: 0x00}}, {command: "D055" + // Length "8103011300" + // Command details "82028183" + // Device identities "851980041704140420041004120421042204120423041904220415" + // Alpha identifier "86099111223344556677F8" + // Address "8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU expect: {commandQualifier: 0x00, text: "ЗДРАВСТВУЙТЕ"}}, @@ -155,17 +153,25 @@ const TEST_DATA = [ "82028183" + // Device identities "8508820430A03832CB32" + // Alpha identifier "86099111223344556677F8" + // Address "8B140100099110325476F84008080038003030EB0033", expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU text: "82ル2"}}, ]; -function testSendSMS(aCommand, aExpect) { +const TEST_CMD_NULL_ALPHA_ID = + "D030" + // Length + "8103011300" + // Command details + "82028183" + // Device identities + "8500" + // Alpha identifier + "86099111223344556677F8" + // Address + "8B180100099110325476F840F40C54657374204D657373616765"; // 3GPP-SMS TPDU + +function verifySendSMS(aCommand, aExpect) { is(aCommand.commandNumber, 0x01, "commandNumber"); is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SMS, "typeOfCommand"); is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier"); // text is optional. if ("text" in aExpect) { is(aCommand.options.text, aExpect.text, "options.text"); } @@ -173,35 +179,62 @@ function testSendSMS(aCommand, aExpect) // icons is optional. if ("icons" in aExpect) { isIcons(aCommand.options.icons, aExpect.icons); is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory, "options.iconSelfExplanatory"); } } -// Start tests -startTestCommon(function() { +// Test normal cases of send SMS proactive command +function testSendSMS() { let icc = getMozIcc(); let promise = Promise.resolve(); for (let i = 0; i < TEST_DATA.length; i++) { let data = TEST_DATA[i]; promise = promise.then(() => { log("send_sms_cmd: " + data.command); let promises = []; // Wait onstkcommand event. promises.push(waitForTargetEvent(icc, "stkcommand") - .then((aEvent) => testSendSMS(aEvent.command, data.expect))); + .then((aEvent) => verifySendSMS(aEvent.command, data.expect))); // Wait icc-stkcommand system message. promises.push(waitForSystemMessage("icc-stkcommand") .then((aMessage) => { is(aMessage.iccId, icc.iccInfo.iccid, "iccId"); - testSendSMS(aMessage.command, data.expect); + verifySendSMS(aMessage.command, data.expect); })); // Send emulator command to generate stk unsolicited event. promises.push(sendEmulatorStkPdu(data.command)); return Promise.all(promises); }); } return promise; +} + +function testSendSMSNullAlphaId() { + let icc = getMozIcc(); + + // No "stkcommand" event should occur. + icc.addEventListener("stkcommand", + (event) => ok(false, event + " should not occur.")); + + // No "icc-stkcommand" system message should be sent. + workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand", + (msg) => ok(false, msg + " should not be sent.")); + + // If nothing happens within 3 seconds after the emulator command sent, + // treat as success. + log("send_sms_cmd: " + TEST_CMD_NULL_ALPHA_ID); + return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID) + .then(() => new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 3000); + })); +} + +// Start tests +startTestCommon(function() { + return Promise.resolve() + .then(() => testSendSMS()) + .then(() => testSendSMSNullAlphaId()); });
--- a/dom/icc/tests/marionette/test_stk_send_ss.js +++ b/dom/icc/tests/marionette/test_stk_send_ss.js @@ -34,23 +34,21 @@ const TEST_DATA = [ "6C6C2064656369" + "8904FFBA13FB", // SS string expect: {commandQualifier: 0x00, text: "Even if the Fixed Dialling Number service is enabled, " + "the supplementary service control string included in the " + "SEND SS proactive command shall not be checked against " + "those of the FDN list. Upon receiving this command, the " + "ME shall deci"}}, - {command: "D01D" + // Length + {command: "D01B" + // Length "8103011100" + // Command details "82028183" + // Device identities - "8500" + // Alpha identifier "891091AA120A214365870921436587A901FB", // SS string - expect: {commandQualifier: 0x00, - text: ""}}, + expect: {commandQualifier: 0x00}}, {command: "D02B" + // Length "8103011100" + // Command details "82028183" + // Device identities "850A42617369632049636F6E" + // Alpha identifier "891091AA120A214365870921436587A901FB" + // SS string "9E020001", // Icon identifier expect: {commandQualifier: 0x00, text: "Basic Icon", @@ -83,17 +81,24 @@ const TEST_DATA = [ "8103011100" + // Command details "82028183" + // Device identities "8505804F60597D" + // Alpha identifier "891091AA120A214365870921436587A901FB", // SS string expect: {commandQualifier: 0x00, text: "你好"}}, ]; -function testSendSS(aCommand, aExpect) { +const TEST_CMD_NULL_ALPHA_ID = + "D01D" + // Length + "8103011100" + // Command details + "82028183" + // Device identities + "8500" + // Alpha identifier + "891091AA120A214365870921436587A901FB"; // SS string + +function verifySendSS(aCommand, aExpect) { is(aCommand.commandNumber, 0x01, "commandNumber"); is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SS, "typeOfCommand"); is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier"); // text is optional. if ("text" in aExpect) { is(aCommand.options.text, aExpect.text, "options.text"); } @@ -101,35 +106,61 @@ function testSendSS(aCommand, aExpect) { // icons is optional. if ("icons" in aExpect) { isIcons(aCommand.options.icons, aExpect.icons); is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory, "options.iconSelfExplanatory"); } } -// Start tests -startTestCommon(function() { +function testSendSS() { let icc = getMozIcc(); let promise = Promise.resolve(); for (let i = 0; i < TEST_DATA.length; i++) { let data = TEST_DATA[i]; promise = promise.then(() => { log("send_ss_cmd: " + data.command); let promises = []; // Wait onstkcommand event. promises.push(waitForTargetEvent(icc, "stkcommand") - .then((aEvent) => testSendSS(aEvent.command, data.expect))); + .then((aEvent) => verifySendSS(aEvent.command, data.expect))); // Wait icc-stkcommand system message. promises.push(waitForSystemMessage("icc-stkcommand") .then((aMessage) => { is(aMessage.iccId, icc.iccInfo.iccid, "iccId"); - testSendSS(aMessage.command, data.expect); + verifySendSS(aMessage.command, data.expect); })); // Send emulator command to generate stk unsolicited event. promises.push(sendEmulatorStkPdu(data.command)); return Promise.all(promises); }); } return promise; +} + +function testSendSSNullAlphaId() { + let icc = getMozIcc(); + + // No "stkcommand" event should occur. + icc.addEventListener("stkcommand", + (event) => ok(false, event + " should not occur.")); + + // No "icc-stkcommand" system message should be sent. + workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand", + (msg) => ok(false, msg + " should not be sent.")); + + // If nothing happens within 3 seconds after the emulator command sent, + // treat as success. + log("send_ss_cmd: " + TEST_CMD_NULL_ALPHA_ID); + return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID) + .then(() => new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 3000); + })); +} + +// Start tests +startTestCommon(function() { + return Promise.resolve() + .then(() => testSendSS()) + .then(() => testSendSSNullAlphaId()); });
--- a/dom/icc/tests/marionette/test_stk_send_ussd.js +++ b/dom/icc/tests/marionette/test_stk_send_ussd.js @@ -52,25 +52,23 @@ const TEST_DATA = [ "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" + "3B3EAF6FC564335ACD76C3E560", expect: {commandQualifier: 0x00, text: "once a RELEASE COMPLETE message containing the USSD " + "Return Result message not containing an error has been " + "received from the network, the ME shall inform the SIM " + "that the command has"}}, - {command: "D046" + // Length + {command: "D044" + // Length "8103011200" + // Command details "82028183" + // Device identities - "8500" + // Alpha identifier "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" + "3B3EAF6FC564335ACD76C3E560", - expect: {commandQualifier: 0x00, - text: ""}}, + expect: {commandQualifier: 0x00}}, {command: "D054" + // Length "8103011200" + // Command details "82028183" + // Device identities "850A42617369632049636F6E" + // Alpha identifier "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" + "3B3EAF6FC564335ACD76C3E560" + "9E020001", // Icon identifier @@ -121,17 +119,26 @@ const TEST_DATA = [ "8505804F60597D" + // Alpha identifier "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" + "3B3EAF6FC564335ACD76C3E560", expect: {commandQualifier: 0x00, text: "你好"}}, ]; -function testSendUSSD(aCommand, aExpect) { +const TEST_CMD_NULL_ALPHA_ID = + "D046" + // Length + "8103011200" + // Command details + "82028183" + // Device identities + "8500" + // Alpha identifier + "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string + "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" + + "3B3EAF6FC564335ACD76C3E560"; + +function verifySendUSSD(aCommand, aExpect) { is(aCommand.commandNumber, 0x01, "commandNumber"); is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_USSD, "typeOfCommand"); is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier"); // text is optional. if ("text" in aExpect) { is(aCommand.options.text, aExpect.text, "options.text"); } @@ -139,35 +146,61 @@ function testSendUSSD(aCommand, aExpect) // icons is optional. if ("icons" in aExpect) { isIcons(aCommand.options.icons, aExpect.icons); is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory, "options.iconSelfExplanatory"); } } -// Start tests -startTestCommon(function() { +function testSendUSSD() { let icc = getMozIcc(); let promise = Promise.resolve(); for (let i = 0; i < TEST_DATA.length; i++) { let data = TEST_DATA[i]; promise = promise.then(() => { log("send_ussd_cmd: " + data.command); let promises = []; // Wait onstkcommand event. promises.push(waitForTargetEvent(icc, "stkcommand") - .then((aEvent) => testSendUSSD(aEvent.command, data.expect))); + .then((aEvent) => verifySendUSSD(aEvent.command, data.expect))); // Wait icc-stkcommand system message. promises.push(waitForSystemMessage("icc-stkcommand") .then((aMessage) => { is(aMessage.iccId, icc.iccInfo.iccid, "iccId"); - testSendUSSD(aMessage.command, data.expect); + verifySendUSSD(aMessage.command, data.expect); })); // Send emulator command to generate stk unsolicited event. promises.push(sendEmulatorStkPdu(data.command)); return Promise.all(promises); }); } return promise; +} + +function testSendUSSDNullAlphaId() { + let icc = getMozIcc(); + + // No "stkcommand" event should occur. + icc.addEventListener("stkcommand", + (event) => ok(false, event + " should not occur.")); + + // No "icc-stkcommand" system message should be sent. + workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand", + (msg) => ok(false, msg + " should not be sent.")); + + // If nothing happens within 3 seconds after the emulator command sent, + // treat as success. + log("send_ussd_cmd: " + TEST_CMD_NULL_ALPHA_ID); + return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID) + .then(() => new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 3000); + })); +} + +// Start tests +startTestCommon(function() { + return Promise.resolve() + .then(() => testSendUSSD()) + .then(() => testSendUSSDNullAlphaId()); });
--- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -9672,20 +9672,34 @@ StkCommandParamsFactoryObject.prototype ]); // Alpha identifier is optional. let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); if (ctlv) { textMsg.text = ctlv.value.identifier; } - // Icon identifier is optional. - this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null, - textMsg, - onComplete); + // According to section 6.4.10 of |ETSI TS 102 223|: + // + // - if the alpha identifier is provided by the UICC and is a null data + // object (i.e. length = '00' and no value part), this is an indication + // that the terminal should not give any information to the user on the + // fact that the terminal is sending a short message; + // + // - if the alpha identifier is not provided by the UICC, the terminal may + // give information to the user concerning what is happening. + // + // ICCPDUHelper reads alpha id as an empty string if the length is zero, + // hence we'll notify the caller when it's not an empty string. + if (textMsg.text !== "") { + // Icon identifier is optional. + this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null, + textMsg, + onComplete); + } }, /** * Construct a param for Setup Call. * * @param cmdDetails * The value object of CommandDetails TLV. * @param ctlvs
--- a/dom/system/gonk/tests/test_ril_worker_stk.js +++ b/dom/system/gonk/tests/test_ril_worker_stk.js @@ -746,22 +746,23 @@ add_test(function test_stk_proactive_com let worker = newUint8Worker(); let context = worker.ContextPool._contexts[0]; let pduHelper = context.GsmPDUHelper; let berHelper = context.BerTlvHelper; let stkHelper = context.StkProactiveCmdHelper; let tag_test = [ 0xD0, - 0x3C, + 0x3E, 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x31, 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x32, 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x33, 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x34, - 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x35]; + 0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x35, + 0x85, 0x00]; for (let i = 0; i < tag_test.length; i++) { pduHelper.writeHexOctet(tag_test[i]); } let berTlv = berHelper.decode(tag_test.length); let selectedCtlvs = stkHelper.searchForSelectedTags(berTlv.value, [COMPREHENSIONTLV_TAG_ALPHA_ID]); @@ -775,16 +776,25 @@ add_test(function test_stk_proactive_com equal(tlv.value.identifier, "alpha id 3"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); equal(tlv.value.identifier, "alpha id 4"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); equal(tlv.value.identifier, "alpha id 5"); + // emulate that the alpha identifier is provided and is a null data object, + // which is converted to an empty string in ICCPDUHelper. + tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); + strictEqual(tlv.value.identifier, ""); + + // emulate that the alpha identifier is not provided + tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); + strictEqual(tlv, undefined); + run_next_test(); }); /** * Verify Proactive Command : Refresh */ add_test(function test_stk_proactive_command_refresh() { test_stk_proactive_command({