From c29f63b00da4c29d0d0b35eb0438fe5cea69abee Mon Sep 17 00:00:00 2001 From: Wander Lairson Costa Date: Wed, 3 Jun 2015 17:55:04 -0300 Subject: [PATCH 01/14] Bug 1171026: Fix exit code for phone-builder image. r=garndt a=garndt If the task fails, validate_task still would return a successful exit code. --- testing/docker/phone-builder/VERSION | 2 +- testing/docker/phone-builder/bin/validate_task.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/testing/docker/phone-builder/VERSION b/testing/docker/phone-builder/VERSION index 9789c4ccb0c..ceddfb28f4f 100644 --- a/testing/docker/phone-builder/VERSION +++ b/testing/docker/phone-builder/VERSION @@ -1 +1 @@ -0.0.14 +0.0.15 diff --git a/testing/docker/phone-builder/bin/validate_task.py b/testing/docker/phone-builder/bin/validate_task.py index e99be39635f..13a3573c74b 100755 --- a/testing/docker/phone-builder/bin/validate_task.py +++ b/testing/docker/phone-builder/bin/validate_task.py @@ -53,13 +53,15 @@ def main(): task = get_task(taskid) ret = check_task(task) if ret != 0: - sys.exit(ret) + return ret if len(sys.argv) > 1: try: - subprocess.call(sys.argv[1:], shell=True) + return subprocess.call(sys.argv[1:], shell=True) except subprocess.CalledProcessError as e: - sys.exit(e.returncode) + return e.returncode + + return 0 if __name__ == '__main__': - main() + sys.exit(main()) From b5350627ceb690672447f705c11184e0275ad80b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 3 Jun 2015 14:45:27 -0700 Subject: [PATCH 02/14] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/7a131a4eb2e6 Author: Miller Medeiros Desc: Merge pull request #30377 from millermedeiros/1162548-edit-modify-event-store Bug 1162548 - [Calendar] edit and modify event views should not talk directly to stores r=gaye ======== https://hg.mozilla.org/integration/gaia-central/rev/206eb8bb0e10 Author: Miller Medeiros Desc: Bug 1162548 - [Calendar] edit and modify event views should not talk directly to stores --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 76a4b44b8aa..af9cc2cc59d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c", + "git_revision": "0b00f058eeee79a05345b793eb5efa19f166ab3f", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "f9a69757f448f43953d09442183e858c236ff328", + "revision": "7a131a4eb2e675cc0720b6b30f89bee1449a092e", "repo_path": "integration/gaia-central" } From 1e8df5b7bd0116d0b79d9c91a08af4736ba462ca Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 3 Jun 2015 14:47:22 -0700 Subject: [PATCH 03/14] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 209e4c448b4..12a943ba4c9 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index cac992dc4f8..0d1b9fecd65 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a6ba652fc91..c8f4a71b661 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 61ec8249ef7..04cf8a51889 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index e40e885fb68..543cb7de3e3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 4434be5924d..050627a8e97 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index a6ba652fc91..c8f4a71b661 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index cc0ca62210e..6a5df7f04a9 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 49c9e16ec1b..de262df254e 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index b426a7e0c62..a45417a5d14 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From ef69248e282439b84a48556f55ec82f978f5006f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 3 Jun 2015 21:16:31 -0700 Subject: [PATCH 04/14] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/1e71058f656d Author: Tzu-Lin Huang Desc: Merge pull request #30359 from dwi2/bug1170083 Bug 1170083 - [Stingray] Align naming in manifest.webpp of tv-epg ======== https://hg.mozilla.org/integration/gaia-central/rev/1f23beec5785 Author: Tzu-Lin Huang Desc: Bug 1170083 - [Stingray] fetch app entries after l10n is ready --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index af9cc2cc59d..5113c33a0a9 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "0b00f058eeee79a05345b793eb5efa19f166ab3f", + "git_revision": "a35628e3bb4bcdd6dcb95be990f08f12b5b2c16d", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "7a131a4eb2e675cc0720b6b30f89bee1449a092e", + "revision": "1e71058f656dec1cd196ff25155cf348536386fd", "repo_path": "integration/gaia-central" } From f0f63416d78597bc7b8e1274e103835bb1caabef Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 3 Jun 2015 21:18:27 -0700 Subject: [PATCH 05/14] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 12a943ba4c9..096ef00800c 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 0d1b9fecd65..e090a4e8cea 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c8f4a71b661..547e81d2b1d 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 04cf8a51889..adac332f5c2 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 543cb7de3e3..4c2d1b82cb5 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 050627a8e97..81071b93391 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index c8f4a71b661..547e81d2b1d 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 6a5df7f04a9..3f247f95272 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index de262df254e..b6e5c7fad4d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index a45417a5d14..ea42fed51e0 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From fdc240f705633f569a2141a2d52fd809ba2bbcf4 Mon Sep 17 00:00:00 2001 From: Jessica Jong Date: Thu, 4 Jun 2015 11:04:15 +0800 Subject: [PATCH 06/14] Bug 1168021 - Part 1: expand nsINetworkInterface parameter in nsINetworkService (idl). r=echen --- dom/system/gonk/nsINetworkService.idl | 67 ++++++++++++++++++++------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/dom/system/gonk/nsINetworkService.idl b/dom/system/gonk/nsINetworkService.idl index 2733c7da8f8..06451827f1a 100644 --- a/dom/system/gonk/nsINetworkService.idl +++ b/dom/system/gonk/nsINetworkService.idl @@ -4,8 +4,6 @@ #include "nsISupports.idl" -interface nsINetworkInterface; - [scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)] interface nsIWifiTetheringCallback : nsISupports { @@ -159,7 +157,7 @@ interface nsIDhcpRequestCallback : nsISupports /** * Provide network services. */ -[scriptable, uuid(214c0810-fd41-11e4-b939-0800200c9a66)] +[scriptable, uuid(5d6b1877-890a-4c7f-8403-94d57ceba6cf)] interface nsINetworkService : nsISupports { const long MODIFY_ROUTE_ADD = 0; @@ -268,45 +266,78 @@ interface nsINetworkService : nsISupports /** * Reset routing table. * - * @param networkInterface - * The network interface we want remove from the routing table. + * @param interfaceName + * The name of the network interface we want to remove from the routing + * table. + * + * @param callback + * Callback to notify the result of resetting routing table. */ - void resetRoutingTable(in nsINetworkInterface networkInterface, + void resetRoutingTable(in DOMString interfaceName, in nsINativeCommandCallback callback); /** * Set DNS. * - * @param networkInterface - * The network interface which contains the DNS we want to set. + * @param interfaceName + * The network interface name of the DNS we want to set. + * @param dnsesCount + * Number of elements in dnses. + * @param dnses + * Dnses to set. + * @param gatewaysCount + * Number of elements in gateways. + * @param gateways + * Gateways for the dnses, the most suitable, usually the one with the + * same address family, will be selected for each dns. * * @param callback * Callback to notify the result of setting DNS server. */ - void setDNS(in nsINetworkInterface networkInterface, + void setDNS(in DOMString interfaceName, + in unsigned long dnsesCount, + [array, size_is(dnsesCount)] in wstring dnses, + in unsigned long gatewaysCount, + [array, size_is(gatewaysCount)] in wstring gateways, in nsISetDnsCallback callback); /** * Set default route. * - * @param networkInterface - * The network interface we want to set to the default route. - * @param oldInterface - * The previous network interface. + * @param interfaceName + * The network interface name of the default route we want to set. + * @param count + * Number of elements in gateways. + * @param gateways + * Default gateways for setting default route. + * @param oldInterfaceName + * The previous network interface name. + * * @param callback * Callback to notify the result of setting default route. */ - void setDefaultRoute(in nsINetworkInterface networkInterface, - in nsINetworkInterface oldInterface, + void setDefaultRoute(in DOMString interfaceName, + in unsigned long count, + [array, size_is(count)] in wstring gateways, + in DOMString oldInterfaceName, in nsINativeCommandCallback callback); /** * Remove default route. * - * @param networkInterface - * The network interface we want remove from the default route. + * @param interfaceName + * The network interface name of the default route we want to remove. + * @param count + * Number of elements in gateways. + * @param gatways + * Default gateways for removing default route. + * + * @param callback + * Callback to notify the result of removing default route. */ - void removeDefaultRoute(in nsINetworkInterface networkInterface, + void removeDefaultRoute(in DOMString interfaceName, + in unsigned long count, + [array, size_is(count)] in wstring gateways, in nsINativeCommandCallback callback); /** From a3f7a740b889e4d89b7833cdc5152f46d1ab33a8 Mon Sep 17 00:00:00 2001 From: Jessica Jong Date: Thu, 4 Jun 2015 11:04:18 +0800 Subject: [PATCH 07/14] Bug 1168021 - Part 2: expand nsINetworkInterface parameter in nsINetworkService (impl). r=echen --- dom/system/gonk/NetworkManager.js | 20 +- dom/system/gonk/NetworkService.js | 448 +++++++++++++++--------------- 2 files changed, 238 insertions(+), 230 deletions(-) diff --git a/dom/system/gonk/NetworkManager.js b/dom/system/gonk/NetworkManager.js index 85f8f7978f5..fb6ada7ab85 100644 --- a/dom/system/gonk/NetworkManager.js +++ b/dom/system/gonk/NetworkManager.js @@ -412,7 +412,7 @@ NetworkManager.prototype = { .then(() => { if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) { // Remove routing table in /proc/net/route - return this._resetRoutingTable(networkInterface); + return this._resetRoutingTable(networkInterface.name); } if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) { return this._removeDefaultRoute(networkInterface) @@ -904,7 +904,10 @@ NetworkManager.prototype = { _setDNS: function(aNetwork) { return new Promise((aResolve, aReject) => { - gNetworkService.setDNS(aNetwork, (aError) => { + let dnses = aNetwork.getDnses(); + let gateways = aNetwork.getGateways(); + gNetworkService.setDNS(aNetwork.name, dnses.length, dnses, + gateways.length, gateways, (aError) => { if (aError) { aReject("setDNS failed"); return; @@ -938,9 +941,9 @@ NetworkManager.prototype = { }); }, - _resetRoutingTable: function(aNetwork) { + _resetRoutingTable: function(aInterfaceName) { return new Promise((aResolve, aReject) => { - gNetworkService.resetRoutingTable(aNetwork, (aSuccess) => { + gNetworkService.resetRoutingTable(aInterfaceName, (aSuccess) => { if (!aSuccess) { debug("resetRoutingTable failed"); } @@ -952,7 +955,9 @@ NetworkManager.prototype = { _removeDefaultRoute: function(aNetwork) { return new Promise((aResolve, aReject) => { - gNetworkService.removeDefaultRoute(aNetwork, (aSuccess) => { + let gateways = aNetwork.getGateways(); + gNetworkService.removeDefaultRoute(aNetwork.name, gateways.length, + gateways, (aSuccess) => { if (!aSuccess) { debug("removeDefaultRoute failed"); } @@ -964,7 +969,10 @@ NetworkManager.prototype = { _setDefaultRouteAndProxy: function(aNetwork, aOldInterface) { return new Promise((aResolve, aReject) => { - gNetworkService.setDefaultRoute(aNetwork, aOldInterface, (aSuccess) => { + let gateways = aNetwork.getGateways(); + let oldInterfaceName = (aOldInterface ? aOldInterface.name : ""); + gNetworkService.setDefaultRoute(aNetwork.name, gateways.length, gateways, + oldInterfaceName, (aSuccess) => { if (!aSuccess) { gNetworkService.destroyNetwork(aNetwork, function() { aReject("setDefaultRoute failed"); diff --git a/dom/system/gonk/NetworkService.js b/dom/system/gonk/NetworkService.js index 6224868dc53..ffc1ded8080 100644 --- a/dom/system/gonk/NetworkService.js +++ b/dom/system/gonk/NetworkService.js @@ -54,23 +54,23 @@ function updateDebug() { } updateDebug(); -function netdResponseType(code) { - return Math.floor(code / 100) * 100; +function netdResponseType(aCode) { + return Math.floor(aCode / 100) * 100; } -function isError(code) { - let type = netdResponseType(code); +function isError(aCode) { + let type = netdResponseType(aCode); return (type !== NETD_COMMAND_PROCEEDING && type !== NETD_COMMAND_OKAY); } -function Task(id, params, setupFunction) { - this.id = id; - this.params = params; - this.setupFunction = setupFunction; +function Task(aId, aParams, aSetupFunction) { + this.id = aId; + this.params = aParams; + this.setupFunction = aSetupFunction; } -function NetworkWorkerRequestQueue(networkService) { - this.networkService = networkService; +function NetworkWorkerRequestQueue(aNetworkService) { + this.networkService = aNetworkService; this.tasks = []; } NetworkWorkerRequestQueue.prototype = { @@ -95,20 +95,20 @@ NetworkWorkerRequestQueue.prototype = { gNetworkWorker.postMessage(task.params); }, - enqueue: function(id, params, setupFunction) { - debug("enqueue id: " + id); - this.tasks.push(new Task(id, params, setupFunction)); + enqueue: function(aId, aParams, aSetupFunction) { + debug("enqueue id: " + aId); + this.tasks.push(new Task(aId, aParams, aSetupFunction)); if (this.tasks.length === 1) { this.runQueue(); } }, - dequeue: function(id) { - debug("dequeue id: " + id); + dequeue: function(aId) { + debug("dequeue id: " + aId); - if (!this.tasks.length || this.tasks[0].id != id) { - debug("Id " + id + " is not on top of the queue"); + if (!this.tasks.length || this.tasks[0].id != aId) { + debug("Id " + aId + " is not on top of the queue"); return; } @@ -128,14 +128,14 @@ NetworkWorkerRequestQueue.prototype = { * adjusts routes etc. accordingly. */ function NetworkService() { - debug("Starting net_worker."); + debug("Starting NetworkService."); let self = this; if (gNetworkWorker) { let networkListener = { - onEvent: function(event) { - self.handleWorkerMessage(event); + onEvent: function(aEvent) { + self.handleWorkerMessage(aEvent); } }; gNetworkWorker.start(networkListener); @@ -166,10 +166,10 @@ NetworkService.prototype = { // nsIObserver - observe: function(subject, topic, data) { - switch (topic) { + observe: function(aSubject, aTopic, aData) { + switch (aTopic) { case TOPIC_PREF_CHANGED: - if (data === PREF_NETWORK_DEBUG_ENABLED) { + if (aData === PREF_NETWORK_DEBUG_ENABLED) { updateDebug(); } break; @@ -190,39 +190,39 @@ NetworkService.prototype = { // Helpers idgen: 0, - controlMessage: function(params, callback, setupFunction) { + controlMessage: function(aParams, aCallback, aSetupFunction) { if (this.shutdown) { return; } let id = this.idgen++; - params.id = id; - if (callback) { - this.controlCallbacks[id] = callback; + aParams.id = id; + if (aCallback) { + this.controlCallbacks[id] = aCallback; } - // For now, we use setupFunction to determine if this command needs to be + // For now, we use aSetupFunction to determine if this command needs to be // queued or not. - if (setupFunction) { - this.netWorkerRequestQueue.enqueue(id, params, setupFunction); + if (aSetupFunction) { + this.netWorkerRequestQueue.enqueue(id, aParams, aSetupFunction); return; } if (gNetworkWorker) { - gNetworkWorker.postMessage(params); + gNetworkWorker.postMessage(aParams); } }, - handleWorkerMessage: function(response) { - debug("NetworkManager received message from worker: " + JSON.stringify(response)); - let id = response.id; - if (response.broadcast === true) { - Services.obs.notifyObservers(null, response.topic, response.reason); + handleWorkerMessage: function(aResponse) { + debug("NetworkManager received message from worker: " + JSON.stringify(aResponse)); + let id = aResponse.id; + if (aResponse.broadcast === true) { + Services.obs.notifyObservers(null, aResponse.topic, aResponse.reason); return; } let callback = this.controlCallbacks[id]; if (callback) { - callback.call(this, response); + callback.call(this, aResponse); delete this.controlCallbacks[id]; } @@ -231,12 +231,12 @@ NetworkService.prototype = { // nsINetworkService - getNetworkInterfaceStats: function(networkName, callback) { - debug("getNetworkInterfaceStats for " + networkName); + getNetworkInterfaceStats: function(aInterfaceName, aCallback) { + debug("getNetworkInterfaceStats for " + aInterfaceName); let file = new FileUtils.File("/proc/net/dev"); if (!file) { - callback.networkStatsAvailable(false, 0, 0, Date.now()); + aCallback.networkStatsAvailable(false, 0, 0, Date.now()); return; } @@ -256,7 +256,7 @@ NetworkService.prototype = { .split("\n"); for (let i = 2; i < data.length; i++) { let parseResult = statExpr.exec(data[i]); - if (parseResult && parseResult[1] === networkName) { + if (parseResult && parseResult[1] === aInterfaceName) { rxBytes = parseInt(parseResult[2], 10); txBytes = parseInt(parseResult[3], 10); break; @@ -265,168 +265,168 @@ NetworkService.prototype = { } // netd always return success even interface doesn't exist. - callback.networkStatsAvailable(true, rxBytes, txBytes, now); + aCallback.networkStatsAvailable(true, rxBytes, txBytes, now); }); }, - setNetworkInterfaceAlarm: function(networkName, threshold, callback) { - if (!networkName) { - callback.networkUsageAlarmResult(-1); + setNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) { + if (!aInterfaceName) { + aCallback.networkUsageAlarmResult(-1); return; } let self = this; - this._disableNetworkInterfaceAlarm(networkName, function(result) { - if (threshold < 0) { - if (!isError(result.resultCode)) { - callback.networkUsageAlarmResult(null); + this._disableNetworkInterfaceAlarm(aInterfaceName, function(aResult) { + if (aThreshold < 0) { + if (!isError(aResult.resultCode)) { + aCallback.networkUsageAlarmResult(null); return; } - callback.networkUsageAlarmResult(result.reason); + aCallback.networkUsageAlarmResult(aResult.reason); return } - self._setNetworkInterfaceAlarm(networkName, threshold, callback); + self._setNetworkInterfaceAlarm(aInterfaceName, aThreshold, aCallback); }); }, - _setNetworkInterfaceAlarm: function(networkName, threshold, callback) { - debug("setNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes"); + _setNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) { + debug("setNetworkInterfaceAlarm for " + aInterfaceName + " at " + aThreshold + "bytes"); let params = { cmd: "setNetworkInterfaceAlarm", - ifname: networkName, - threshold: threshold + ifname: aInterfaceName, + threshold: aThreshold }; params.report = true; - this.controlMessage(params, function(result) { - if (!isError(result.resultCode)) { - callback.networkUsageAlarmResult(null); + this.controlMessage(params, function(aResult) { + if (!isError(aResult.resultCode)) { + aCallback.networkUsageAlarmResult(null); return; } - this._enableNetworkInterfaceAlarm(networkName, threshold, callback); + this._enableNetworkInterfaceAlarm(aInterfaceName, aThreshold, aCallback); }); }, - _enableNetworkInterfaceAlarm: function(networkName, threshold, callback) { - debug("enableNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes"); + _enableNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) { + debug("enableNetworkInterfaceAlarm for " + aInterfaceName + " at " + aThreshold + "bytes"); let params = { cmd: "enableNetworkInterfaceAlarm", - ifname: networkName, - threshold: threshold + ifname: aInterfaceName, + threshold: aThreshold }; params.report = true; - this.controlMessage(params, function(result) { - if (!isError(result.resultCode)) { - callback.networkUsageAlarmResult(null); + this.controlMessage(params, function(aResult) { + if (!isError(aResult.resultCode)) { + aCallback.networkUsageAlarmResult(null); return; } - callback.networkUsageAlarmResult(result.reason); + aCallback.networkUsageAlarmResult(aResult.reason); }); }, - _disableNetworkInterfaceAlarm: function(networkName, callback) { - debug("disableNetworkInterfaceAlarm for " + networkName); + _disableNetworkInterfaceAlarm: function(aInterfaceName, aCallback) { + debug("disableNetworkInterfaceAlarm for " + aInterfaceName); let params = { cmd: "disableNetworkInterfaceAlarm", - ifname: networkName, + ifname: aInterfaceName, }; params.report = true; - this.controlMessage(params, function(result) { - callback(result); + this.controlMessage(params, function(aResult) { + aCallback(aResult); }); }, - setWifiOperationMode: function(interfaceName, mode, callback) { - debug("setWifiOperationMode on " + interfaceName + " to " + mode); + setWifiOperationMode: function(aInterfaceName, aMode, aCallback) { + debug("setWifiOperationMode on " + aInterfaceName + " to " + aMode); let params = { cmd: "setWifiOperationMode", - ifname: interfaceName, - mode: mode + ifname: aInterfaceName, + mode: aMode }; params.report = true; - this.controlMessage(params, function(result) { - if (isError(result.resultCode)) { - callback.wifiOperationModeResult("netd command error"); + this.controlMessage(params, function(aResult) { + if (isError(aResult.resultCode)) { + aCallback.wifiOperationModeResult("netd command error"); } else { - callback.wifiOperationModeResult(null); + aCallback.wifiOperationModeResult(null); } }); }, - resetRoutingTable: function(network, callback) { + resetRoutingTable: function(aInterfaceName, aCallback) { let options = { cmd: "removeNetworkRoute", - ifname: network.name + ifname: aInterfaceName }; - this.controlMessage(options, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(options, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - setDNS: function(networkInterface, callback) { - debug("Going DNS to " + networkInterface.name); - let dnses = networkInterface.getDnses(); + setDNS: function(aInterfaceName, aDnsesCount, aDnses, aGatewaysCount, + aGateways, aCallback) { + debug("Going to set DNS to " + aInterfaceName); let options = { cmd: "setDNS", - ifname: networkInterface.name, - domain: "mozilla." + networkInterface.name + ".doman", - dnses: dnses, - gateways: networkInterface.getGateways() + ifname: aInterfaceName, + domain: "mozilla." + aInterfaceName + ".domain", + dnses: aDnses, + gateways: aGateways }; - this.controlMessage(options, function(result) { - callback.setDnsResult(result.success ? null : result.reason); + this.controlMessage(options, function(aResult) { + aCallback.setDnsResult(aResult.success ? null : aResult.reason); }); }, - setDefaultRoute: function(network, oldInterface, callback) { - debug("Going to change default route to " + network.name); - let gateways = network.getGateways(); + setDefaultRoute: function(aInterfaceName, aCount, aGateways, + aOldInterfaceName, aCallback) { + debug("Going to change default route to " + aInterfaceName); let options = { cmd: "setDefaultRoute", - ifname: network.name, - oldIfname: (oldInterface && oldInterface !== network) ? oldInterface.name : null, - gateways: gateways + ifname: aInterfaceName, + oldIfname: (aOldInterfaceName && aOldInterfaceName !== aInterfaceName) ? + aOldInterfaceName : null, + gateways: aGateways }; - this.controlMessage(options, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(options, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - removeDefaultRoute: function(network, callback) { - debug("Remove default route for " + network.name); - let gateways = network.getGateways(); + removeDefaultRoute: function(aInterfaceName, aCount, aGateways, aCallback) { + debug("Remove default route for " + aInterfaceName); let options = { cmd: "removeDefaultRoute", - ifname: network.name, - gateways: gateways + ifname: aInterfaceName, + gateways: aGateways }; - this.controlMessage(options, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(options, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - _routeToString: function(interfaceName, host, prefixLength, gateway) { - return host + "-" + prefixLength + "-" + gateway + "-" + interfaceName; + _routeToString: function(aInterfaceName, aHost, aPrefixLength, aGateway) { + return aHost + "-" + aPrefixLength + "-" + aGateway + "-" + aInterfaceName; }, - modifyRoute: function(action, interfaceName, host, prefixLength, gateway) { + modifyRoute: function(aAction, aInterfaceName, aHost, aPrefixLength, aGateway) { let command; - switch (action) { + switch (aAction) { case Ci.nsINetworkService.MODIFY_ROUTE_ADD: command = 'addHostRoute'; break; @@ -434,18 +434,18 @@ NetworkService.prototype = { command = 'removeHostRoute'; break; default: - debug('Unknown action: ' + action); + debug('Unknown action: ' + aAction); return Promise.reject(); } - let route = this._routeToString(interfaceName, host, prefixLength, gateway); + let route = this._routeToString(aInterfaceName, aHost, aPrefixLength, aGateway); let setupFunc = () => { let count = this.addedRoutes.get(route); debug(command + ": " + route + " -> " + count); // Return false if there is no need to send the command to network worker. - if ((action == Ci.nsINetworkService.MODIFY_ROUTE_ADD && count) || - (action == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE && + if ((aAction == Ci.nsINetworkService.MODIFY_ROUTE_ADD && count) || + (aAction == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE && (!count || count > 1))) { return false; } @@ -453,21 +453,21 @@ NetworkService.prototype = { return true; }; - debug(command + " " + host + " on " + interfaceName); + debug(command + " " + aHost + " on " + aInterfaceName); let options = { cmd: command, - ifname: interfaceName, - gateway: gateway, - prefixLength: prefixLength, - ip: host + ifname: aInterfaceName, + gateway: aGateway, + prefixLength: aPrefixLength, + ip: aHost }; return new Promise((aResolve, aReject) => { - this.controlMessage(options, (data) => { + this.controlMessage(options, (aData) => { let count = this.addedRoutes.get(route); // Remove route from addedRoutes on success or failure. - if (action == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE) { + if (aAction == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE) { if (count > 1) { this.addedRoutes.set(route, count - 1); } else { @@ -475,12 +475,12 @@ NetworkService.prototype = { } } - if (data.error) { - aReject(data.reason); + if (aData.error) { + aReject(aData.reason); return; } - if (action == Ci.nsINetworkService.MODIFY_ROUTE_ADD) { + if (aAction == Ci.nsINetworkService.MODIFY_ROUTE_ADD) { this.addedRoutes.set(route, count ? count + 1 : 1); } @@ -489,108 +489,108 @@ NetworkService.prototype = { }); }, - addSecondaryRoute: function(ifname, route, callback) { - debug("Going to add route to secondary table on " + ifname); + addSecondaryRoute: function(aInterfaceName, aRoute, aCallback) { + debug("Going to add route to secondary table on " + aInterfaceName); let options = { cmd: "addSecondaryRoute", - ifname: ifname, - ip: route.ip, - prefix: route.prefix, - gateway: route.gateway + ifname: aInterfaceName, + ip: aRoute.ip, + prefix: aRoute.prefix, + gateway: aRoute.gateway }; - this.controlMessage(options, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(options, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - removeSecondaryRoute: function(ifname, route, callback) { - debug("Going to remove route from secondary table on " + ifname); + removeSecondaryRoute: function(aInterfaceName, aRoute, aCallback) { + debug("Going to remove route from secondary table on " + aInterfaceName); let options = { cmd: "removeSecondaryRoute", - ifname: ifname, - ip: route.ip, - prefix: route.prefix, - gateway: route.gateway + ifname: aInterfaceName, + ip: aRoute.ip, + prefix: aRoute.prefix, + gateway: aRoute.gateway }; - this.controlMessage(options, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(options, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, // Enable/Disable DHCP server. - setDhcpServer: function(enabled, config, callback) { - if (null === config) { - config = {}; + setDhcpServer: function(aEnabled, aConfig, aCallback) { + if (null === aConfig) { + aConfig = {}; } - config.cmd = "setDhcpServer"; - config.enabled = enabled; + aConfig.cmd = "setDhcpServer"; + aConfig.enabled = aEnabled; - this.controlMessage(config, function setDhcpServerResult(response) { - if (!response.success) { - callback.dhcpServerResult('Set DHCP server error'); + this.controlMessage(aConfig, function(aResponse) { + if (!aResponse.success) { + aCallback.dhcpServerResult('Set DHCP server error'); return; } - callback.dhcpServerResult(null); + aCallback.dhcpServerResult(null); }); }, // Enable/disable WiFi tethering by sending commands to netd. - setWifiTethering: function(enable, config, callback) { + setWifiTethering: function(aEnable, aConfig, aCallback) { // config should've already contained: // .ifname // .internalIfname // .externalIfname - config.wifictrlinterfacename = WIFI_CTRL_INTERFACE; - config.cmd = "setWifiTethering"; + aConfig.wifictrlinterfacename = WIFI_CTRL_INTERFACE; + aConfig.cmd = "setWifiTethering"; // The callback function in controlMessage may not be fired immediately. - this.controlMessage(config, function setWifiTetheringResult(data) { - let code = data.resultCode; - let reason = data.resultReason; - let enable = data.enable; - let enableString = enable ? "Enable" : "Disable"; + this.controlMessage(aConfig, function(aData) { + let code = aData.resultCode; + let reason = aData.resultReason; + let enable = aData.enable; + let enableString = aEnable ? "Enable" : "Disable"; debug(enableString + " Wifi tethering result: Code " + code + " reason " + reason); if (isError(code)) { - callback.wifiTetheringEnabledChange("netd command error"); + aCallback.wifiTetheringEnabledChange("netd command error"); } else { - callback.wifiTetheringEnabledChange(null); + aCallback.wifiTetheringEnabledChange(null); } }); }, // Enable/disable USB tethering by sending commands to netd. - setUSBTethering: function(enable, config, callback) { - config.cmd = "setUSBTethering"; + setUSBTethering: function(aEnable, aConfig, aCallback) { + aConfig.cmd = "setUSBTethering"; // The callback function in controlMessage may not be fired immediately. - this.controlMessage(config, function setUsbTetheringResult(data) { - let code = data.resultCode; - let reason = data.resultReason; - let enable = data.enable; - let enableString = enable ? "Enable" : "Disable"; + this.controlMessage(aConfig, function(aData) { + let code = aData.resultCode; + let reason = aData.resultReason; + let enable = aData.enable; + let enableString = aEnable ? "Enable" : "Disable"; debug(enableString + " USB tethering result: Code " + code + " reason " + reason); if (isError(code)) { - callback.usbTetheringEnabledChange("netd command error"); + aCallback.usbTetheringEnabledChange("netd command error"); } else { - callback.usbTetheringEnabledChange(null); + aCallback.usbTetheringEnabledChange(null); } }); }, // Switch usb function by modifying property of persist.sys.usb.config. - enableUsbRndis: function(enable, callback) { - debug("enableUsbRndis: " + enable); + enableUsbRndis: function(aEnable, aCallback) { + debug("enableUsbRndis: " + aEnable); let params = { cmd: "enableUsbRndis", - enable: enable + enable: aEnable }; // Ask net work to report the result when this value is set to true. - if (callback) { + if (aCallback) { params.report = true; } else { params.report = false; @@ -598,125 +598,125 @@ NetworkService.prototype = { // The callback function in controlMessage may not be fired immediately. //this._usbTetheringAction = TETHERING_STATE_ONGOING; - this.controlMessage(params, function(data) { - callback.enableUsbRndisResult(data.result, data.enable); + this.controlMessage(params, function(aData) { + aCallback.enableUsbRndisResult(aData.result, aData.enable); }); }, - updateUpStream: function(previous, current, callback) { + updateUpStream: function(aPrevious, aCurrent, aCallback) { let params = { cmd: "updateUpStream", - preInternalIfname: previous.internalIfname, - preExternalIfname: previous.externalIfname, - curInternalIfname: current.internalIfname, - curExternalIfname: current.externalIfname + preInternalIfname: aPrevious.internalIfname, + preExternalIfname: aPrevious.externalIfname, + curInternalIfname: aCurrent.internalIfname, + curExternalIfname: aCurrent.externalIfname }; - this.controlMessage(params, function(data) { - let code = data.resultCode; - let reason = data.resultReason; + this.controlMessage(params, function(aData) { + let code = aData.resultCode; + let reason = aData.resultReason; debug("updateUpStream result: Code " + code + " reason " + reason); - callback.updateUpStreamResult(!isError(code), data.curExternalIfname); + aCallback.updateUpStreamResult(!isError(code), aData.curExternalIfname); }); }, - configureInterface: function(config, callback) { + configureInterface: function(aConfig, aCallback) { let params = { cmd: "configureInterface", - ifname: config.ifname, - ipaddr: config.ipaddr, - mask: config.mask, - gateway_long: config.gateway, - dns1_long: config.dns1, - dns2_long: config.dns2, + ifname: aConfig.ifname, + ipaddr: aConfig.ipaddr, + mask: aConfig.mask, + gateway_long: aConfig.gateway, + dns1_long: aConfig.dns1, + dns2_long: aConfig.dns2, }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - dhcpRequest: function(interfaceName, callback) { + dhcpRequest: function(aInterfaceName, aCallback) { let params = { cmd: "dhcpRequest", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.dhcpRequestResult(!result.error, result.error ? null : result); + this.controlMessage(params, function(aResult) { + aCallback.dhcpRequestResult(!aResult.error, aResult.error ? null : aResult); }); }, - stopDhcp: function(interfaceName, callback) { + stopDhcp: function(aInterfaceName, aCallback) { let params = { cmd: "stopDhcp", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - enableInterface: function(interfaceName, callback) { + enableInterface: function(aInterfaceName, aCallback) { let params = { cmd: "enableInterface", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - disableInterface: function(interfaceName, callback) { + disableInterface: function(aInterfaceName, aCallback) { let params = { cmd: "disableInterface", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - resetConnections: function(interfaceName, callback) { + resetConnections: function(aInterfaceName, aCallback) { let params = { cmd: "resetConnections", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - createNetwork: function(interfaceName, callback) { + createNetwork: function(aInterfaceName, aCallback) { let params = { cmd: "createNetwork", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - destroyNetwork: function(interfaceName, callback) { + destroyNetwork: function(aInterfaceName, aCallback) { let params = { cmd: "destroyNetwork", - ifname: interfaceName + ifname: aInterfaceName }; - this.controlMessage(params, function(result) { - callback.nativeCommandResult(!result.error); + this.controlMessage(params, function(aResult) { + aCallback.nativeCommandResult(!aResult.error); }); }, - getNetId: function(interfaceName) { + getNetId: function(aInterfaceName) { let params = { cmd: "getNetId", - ifname: interfaceName + ifname: aInterfaceName }; return new Promise((aResolve, aReject) => { From 9c97770f5f77358b537bfecbae50f722d2cccfb5 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Thu, 28 May 2015 15:41:55 +0800 Subject: [PATCH 08/14] Bug 1169160 - [MobileConnection] Support more call barring program: all service, outgoing service and incoming service. r=hsinyi,aknow --- dom/mobileconnection/MobileConnection.cpp | 2 +- .../interfaces/nsIMobileConnectionService.idl | 5 ++- .../tests/marionette/manifest.ini | 2 +- .../test_call_barring_basic_operations.js | 35 +++++++++++++++---- ...tion.js => test_call_barring_get_error.js} | 4 +-- .../marionette/test_call_barring_set_error.js | 4 +-- dom/system/gonk/ril_consts.js | 6 ++++ dom/webidl/MozMobileConnection.webidl | 3 ++ 8 files changed, 48 insertions(+), 13 deletions(-) rename dom/mobileconnection/tests/marionette/{test_call_barring_get_option.js => test_call_barring_get_error.js} (93%) diff --git a/dom/mobileconnection/MobileConnection.cpp b/dom/mobileconnection/MobileConnection.cpp index c69fa2940e0..a88d1e05699 100644 --- a/dom/mobileconnection/MobileConnection.cpp +++ b/dom/mobileconnection/MobileConnection.cpp @@ -300,7 +300,7 @@ bool MobileConnection::IsValidCallBarringProgram(int32_t aProgram) { return aProgram >= nsIMobileConnection::CALL_BARRING_PROGRAM_ALL_OUTGOING && - aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_ROAMING; + aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_SERVICE; } bool diff --git a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl index c92e9ec0575..da8647d7597 100644 --- a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl +++ b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl @@ -163,7 +163,7 @@ already_AddRefed NS_CreateMobileConnectionService(); %} -[scriptable, uuid(b9845f09-7cbb-46d0-b713-773d80844e0d)] +[scriptable, uuid(59a6d450-144b-47f9-8f4a-2132331e9e05)] interface nsIMobileConnection : nsISupports { /* @@ -214,6 +214,9 @@ interface nsIMobileConnection : nsISupports const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3; const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; + const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5; + const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; + const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; /** * Calling line identification restriction constants. diff --git a/dom/mobileconnection/tests/marionette/manifest.ini b/dom/mobileconnection/tests/marionette/manifest.ini index 6b21b095be8..0b54151df21 100644 --- a/dom/mobileconnection/tests/marionette/manifest.ini +++ b/dom/mobileconnection/tests/marionette/manifest.ini @@ -16,7 +16,7 @@ qemu = true [test_mobile_data_state.js] [test_mobile_roaming_preference.js] [test_call_barring_basic_operations.js] -[test_call_barring_get_option.js] +[test_call_barring_get_error.js] [test_call_barring_set_error.js] [test_call_barring_change_password.js] [test_mobile_set_radio.js] diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js b/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js index c103d04d7b0..4457cfa8f5e 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js @@ -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/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -90,18 +90,41 @@ function testAllPrograms(aPrograms) { }, Promise.resolve()); } +function testUnsupportedPrograms() { + // Emulator now doesn't support these three programs. + let unsupportedPrograms = + [MozMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE, + MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE, + MozMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE]; + + return unsupportedPrograms.reduce((previousPromise, program) => { + return previousPromise + .then(() => log("Test " + program)) + .then(() => setProgram(program, false)) + .then(() => { + ok(false, "Should be rejected"); + }, error => { + is(error.name, "RequestNotSupported", + "Failed to setProgram: "+ error.name); + }); + }, Promise.resolve()); +} + // Start tests startTestCommon(function() { return Promise.resolve() - .then(() => setProgram(null, outgoingPrograms)) - .then(() => setProgram(null, incomingPrograms)) + .then(() => setAndCheckProgram(null, outgoingPrograms)) + .then(() => setAndCheckProgram(null, incomingPrograms)) .then(() => log("=== Test outgoing call barring programs ===")) .then(() => testAllPrograms(outgoingPrograms)) .then(() => log("=== Test incoming call barring programs ===")) .then(() => testAllPrograms(incomingPrograms)) + .then(() => log("=== Test unsupported call barring programs ===")) + .then(() => testUnsupportedPrograms()) + .catch(aError => ok(false, "promise rejects during test: " + aError)) - .then(() => setProgram(null, outgoingPrograms)) - .then(() => setProgram(null, incomingPrograms)); -}); \ No newline at end of file + .then(() => setAndCheckProgram(null, outgoingPrograms)) + .then(() => setAndCheckProgram(null, incomingPrograms)); +}); diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js b/dom/mobileconnection/tests/marionette/test_call_barring_get_error.js similarity index 93% rename from dom/mobileconnection/tests/marionette/test_call_barring_get_option.js rename to dom/mobileconnection/tests/marionette/test_call_barring_get_error.js index 28fda1d8f41..a561484503f 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_get_error.js @@ -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/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -21,7 +21,7 @@ startTestCommon(function() { // Test program .then(() => testGetCallBarringOption("InvalidParameter", { - program: 5, /* Invalid program */ + program: 8, /* Invalid program */ serviceClass: 0 })) diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js b/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js index d8d72f63faa..0dbd4e521da 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js @@ -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/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -21,7 +21,7 @@ startTestCommon(function() { // Test program .then(() => testSetCallBarringOption("InvalidParameter", { - "program": 5, /* Invalid program */ + "program": 8, /* Invalid program */ "enabled": true, "password": "0000", "serviceClass": 0 diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js index ee297682d4b..d9a1ed65260 100644 --- a/dom/system/gonk/ril_consts.js +++ b/dom/system/gonk/ril_consts.js @@ -2972,6 +2972,9 @@ this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL = 1; this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; this.CALL_BARRING_PROGRAM_ALL_INCOMING = 3; this.CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; +this.CALL_BARRING_PROGRAM_ALL_SERVICE = 5; +this.CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; +this.CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; this.CALL_BARRING_PROGRAM_TO_FACILITY = {}; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_OUTGOING] = ICC_CB_FACILITY_BAOC; @@ -2979,6 +2982,9 @@ CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL] = CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME] = ICC_CB_FACILITY_BAOICxH; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_INCOMING] = ICC_CB_FACILITY_BAIC; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_ROAMING] = ICC_CB_FACILITY_BAICr; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_SERVICE] = ICC_CB_FACILITY_BA_ALL; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_SERVICE] = ICC_CB_FACILITY_BA_MO; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_SERVICE] = ICC_CB_FACILITY_BA_MT; // CLIR constants. Must be in sync with nsIMobileConnectionService interface this.CLIR_DEFAULT = 0; diff --git a/dom/webidl/MozMobileConnection.webidl b/dom/webidl/MozMobileConnection.webidl index 2c63d99319f..d398c9b296c 100644 --- a/dom/webidl/MozMobileConnection.webidl +++ b/dom/webidl/MozMobileConnection.webidl @@ -56,6 +56,9 @@ interface MozMobileConnection : EventTarget const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3; const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; + const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5; + const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; + const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; /** * Calling line identification restriction constants. From 333fe5fca5303b7d08fb00f3faa2fc90e2b9b231 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 4 Jun 2015 00:20:13 -0700 Subject: [PATCH 09/14] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9cc14e2ff54c Author: Rudy Lu Desc: Merge pull request #30274 from RudyLu/ltedone-Bug_1137968-Create_Ukrainian_keyboard Bug 1137968 - [B2G] Create Ukrainian keyboard. r=rudylu ======== https://hg.mozilla.org/integration/gaia-central/rev/704d6bda8fc9 Author: Rudy Lu Desc: Bug 1137968 - Add Ukrainian keyboard layout. - Fix the keyboard integration test for this change. - Also remove the execute access from some of the layout files. ======== https://hg.mozilla.org/integration/gaia-central/rev/f47c079670aa Author: Luigi Tedone Desc: Bug 1137968 - Create Ukrainian keyboard r=ltedone --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 5113c33a0a9..0df14b4e414 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "a35628e3bb4bcdd6dcb95be990f08f12b5b2c16d", + "git_revision": "45afe9b99481d768d90a74a5322389f5873d844f", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "1e71058f656dec1cd196ff25155cf348536386fd", + "revision": "9cc14e2ff54ca2fa29de33b570d36c15499051f1", "repo_path": "integration/gaia-central" } From 6359491d1fc2bb36d4a6cdf50a44ab1177abd5a2 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 4 Jun 2015 00:22:08 -0700 Subject: [PATCH 10/14] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 096ef00800c..645c77ae1d4 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index e090a4e8cea..24112bcbd1a 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 547e81d2b1d..e9f4aa997a4 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index adac332f5c2..b1bdfab3a04 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 4c2d1b82cb5..2c3171c59a6 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 81071b93391..15711de8947 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 547e81d2b1d..e9f4aa997a4 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 3f247f95272..3ce0769bfe3 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b6e5c7fad4d..838d43ce173 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index ea42fed51e0..4603b7fb0e9 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 63ca39f6212cd26cafba9717f45461fda0113aa8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 4 Jun 2015 01:20:20 -0700 Subject: [PATCH 11/14] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/aa2355f8f650 Author: Dominic Kuo Desc: Merge pull request #30294 from dominickuo/bug-1168549 Bug 1168549 - [Music] use to replace background-image, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/35da1a06a7a1 Author: Dominic Kuo Desc: Bug 1168549 - [Music] use to replace background-image ======== https://hg.mozilla.org/integration/gaia-central/rev/4668325991b8 Author: George Desc: Merge pull request #30379 from cctuan/1168828 Bug 1168828 - GAIA_DISTRIBUTION_DIR=distros/spark make reset gaia fails on first load ======== https://hg.mozilla.org/integration/gaia-central/rev/1ed1779843d6 Author: cctuan Desc: Bug 1168828 - GAIA_DISTRIBUTION_DIR=distros/spark make reset gaia fails on first load --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 0df14b4e414..55bf8339537 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "45afe9b99481d768d90a74a5322389f5873d844f", + "git_revision": "e0fbadeb78a96137f071d9be7a47ef9fe882d17f", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "9cc14e2ff54ca2fa29de33b570d36c15499051f1", + "revision": "aa2355f8f650e320a73584dfd2c5a4932577f6ea", "repo_path": "integration/gaia-central" } From 3a7c8c1bd147041ef586376dfc8edd6ac0dc25c4 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 4 Jun 2015 01:22:14 -0700 Subject: [PATCH 12/14] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 645c77ae1d4..a387caa5be8 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 24112bcbd1a..40b7dd037b3 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index e9f4aa997a4..7f7a62407bf 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b1bdfab3a04..2814ecf1a16 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 2c3171c59a6..7e317133423 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 15711de8947..bad6bc40352 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index e9f4aa997a4..7f7a62407bf 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 3ce0769bfe3..52cf3d9ce95 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 838d43ce173..c9e9c23e036 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 4603b7fb0e9..79c78007977 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 0c47d216b659f4eb507744e3beb4b40e783f9676 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Wed, 6 May 2015 19:25:31 +0800 Subject: [PATCH 13/14] Bug 1159134 - Part 1: Fix improper CTLV encoding in STK Event Download. r=echen --- dom/system/gonk/ril_worker.js | 24 +++++++++++++++----- dom/system/gonk/tests/test_ril_worker_stk.js | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 681992c3d6c..fa6776e6942 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -2788,8 +2788,10 @@ RilObject.prototype = { if (options.address) { GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_ADDRESS | COMPREHENSIONTLV_FLAG_CR); + let addressLength = options.address[0] == '+' ? options.address.length - 1 + : options.address.length; ComprehensionTlvHelper.writeLength( - Math.ceil(options.address.length/2) + 1 // address BCD + TON + Math.ceil(addressLength / 2) + 1 // address BCD + TON ); this.context.ICCPDUHelper.writeDiallingNumber(options.address); } @@ -11379,19 +11381,29 @@ ComprehensionTlvHelperObject.prototype = { let GsmPDUHelper = this.context.GsmPDUHelper; let cause = -1; - for (let errorNo in RIL_ERROR_TO_GECKO_ERROR) { - if (geckoError == RIL_ERROR_TO_GECKO_ERROR[errorNo]) { + for (let errorNo in RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR) { + if (geckoError == RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[errorNo]) { cause = errorNo; break; } } + + // Causes specified in 10.5.4.11 of TS 04.08 are less than 128. + // we can ignore causes > 127 since Cause TLV is optional in + // STK_EVENT_TYPE_CALL_DISCONNECTED. + if (cause > 127) { + return; + } + cause = (cause == -1) ? ERROR_SUCCESS : cause; GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_CAUSE | COMPREHENSIONTLV_FLAG_CR); GsmPDUHelper.writeHexOctet(2); // For single cause value. - // TS 04.08, clause 10.5.4.11: National standard code + user location. + // TS 04.08, clause 10.5.4.11: + // Code Standard : Standard defined for GSM PLMNS + // Location: User GsmPDUHelper.writeHexOctet(0x60); // TS 04.08, clause 10.5.4.11: ext bit = 1 + 7 bits for cause. @@ -11438,11 +11450,11 @@ ComprehensionTlvHelperObject.prototype = { // TS 102.223, clause 8.38 // +----------------+------------------+-------------------+ - // | hours (1 byte) | minutes (1 btye) | secounds (1 byte) | + // | hours (1 byte) | minutes (1 btye) | seconds (1 byte) | // +----------------+------------------+-------------------+ GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds / 60 / 60)); GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds / 60) % 60); - GsmPDUHelper.writeSwappedNibbleBCDNum(seconds % 60); + GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds) % 60); }, writeTextStringTlv: function(text, coding) { diff --git a/dom/system/gonk/tests/test_ril_worker_stk.js b/dom/system/gonk/tests/test_ril_worker_stk.js index cf9925afcb1..71711607846 100644 --- a/dom/system/gonk/tests/test_ril_worker_stk.js +++ b/dom/system/gonk/tests/test_ril_worker_stk.js @@ -625,7 +625,7 @@ add_test(function test_write_disconnecting_cause() { let pduHelper = context.GsmPDUHelper; let tlvHelper = context.ComprehensionTlvHelper; - tlvHelper.writeCauseTlv(RIL_ERROR_TO_GECKO_ERROR[ERROR_GENERIC_FAILURE]); + tlvHelper.writeCauseTlv(RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[CALL_FAIL_BUSY]); let tag = pduHelper.readHexOctet(); equal(tag, COMPREHENSIONTLV_TAG_CAUSE | COMPREHENSIONTLV_FLAG_CR); let len = pduHelper.readHexOctet(); @@ -633,7 +633,7 @@ add_test(function test_write_disconnecting_cause() { let standard = pduHelper.readHexOctet(); equal(standard, 0x60); let cause = pduHelper.readHexOctet(); - equal(cause, 0x80 | ERROR_GENERIC_FAILURE); + equal(cause, 0x80 | CALL_FAIL_BUSY); run_next_test(); }); From 4bf30d9c9b003d74ef8a23b6a06665666a10e977 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Tue, 5 May 2015 19:10:58 +0800 Subject: [PATCH 14/14] Bug 1159134 - Part 2: Add Test Cases for STK related Requests. r=echen --- dom/icc/tests/marionette/head.js | 84 ++++- dom/icc/tests/marionette/manifest.ini | 4 + .../marionette/test_stk_event_download.js | 204 +++++++++++++ .../marionette/test_stk_menu_selection.js | 35 +++ dom/icc/tests/marionette/test_stk_response.js | 288 ++++++++++++++++++ .../marionette/test_stk_timer_expiration.js | 27 ++ 6 files changed, 640 insertions(+), 2 deletions(-) create mode 100644 dom/icc/tests/marionette/test_stk_event_download.js create mode 100644 dom/icc/tests/marionette/test_stk_menu_selection.js create mode 100644 dom/icc/tests/marionette/test_stk_response.js create mode 100644 dom/icc/tests/marionette/test_stk_timer_expiration.js diff --git a/dom/icc/tests/marionette/head.js b/dom/icc/tests/marionette/head.js index a28127f6746..d5c7765a7ae 100644 --- a/dom/icc/tests/marionette/head.js +++ b/dom/icc/tests/marionette/head.js @@ -131,8 +131,10 @@ function runEmulatorCmdSafe(aCommand) { /** * Send stk proactive pdu. * - * Fulfill params: (none) - * Reject params: (none) + * Fulfill params: + * result -- an array of emulator response lines. + * Reject params: + * result -- an array of emulator response lines. * * @param aPdu * @@ -143,6 +145,84 @@ function sendEmulatorStkPdu(aPdu) { return runEmulatorCmdSafe(cmd); } +/** + * Peek the last STK terminal response sent to modem. + * + * Fulfill params: + * result -- last terminal response in HEX String. + * Reject params: + * result -- an array of emulator response lines. + * + * @return A deferred promise. + */ +function peekLastStkResponse() { + return runEmulatorCmdSafe("stk lastresponse") + .then(aResult => aResult[0]); +} + +/** + * Peek the last STK envelope sent to modem. + * + * Fulfill params: + * result -- last envelope in HEX String. + * Reject params: + * result -- an array of emulator response lines. + * + * @return A deferred promise. + */ +function peekLastStkEnvelope() { + return runEmulatorCmdSafe("stk lastenvelope") + .then(aResult => aResult[0]); +} + +/** + * Verify with the peeked STK response. + * + * Fulfill params: + * result -- (none) + * Reject params: + * result -- an array of emulator response lines. + * + * @param aExpectResponse + * The expected Response PDU in HEX String. + * + * @return A deferred promise. + */ +function verifyWithPeekedStkResponse(aExpectResponse) { + return new Promise(function(aResolve, aReject) { + window.setTimeout(function() { + peekLastStkResponse().then(aResult => { + is(aResult, aExpectResponse, "Verify sent APDU"); + aResolve(); + }); + }, 3000); + }); +} + +/** + * Verify with the peeked STK response. + * + * Fulfill params: + * result -- (none) + * Reject params: + * result -- an array of emulator response lines. + * + * @param aExpectEnvelope + * The expected Envelope PDU in HEX String. + * + * @return A deferred promise. + */ +function verifyWithPeekedStkEnvelope(aExpectEnvelope) { + return new Promise(function(aResolve, aReject) { + window.setTimeout(function() { + peekLastStkEnvelope().then(aResult => { + is(aResult, aExpectEnvelope, "Verify sent APDU"); + aResolve(); + }); + }, 3000); + }); +} + let workingFrame; let iccManager; diff --git a/dom/icc/tests/marionette/manifest.ini b/dom/icc/tests/marionette/manifest.ini index 572fbd3f9cb..523720a6ded 100644 --- a/dom/icc/tests/marionette/manifest.ini +++ b/dom/icc/tests/marionette/manifest.ini @@ -36,3 +36,7 @@ qemu = true [test_icc_detected_undetected_event.js] [test_icc_match_mvno.js] [test_icc_service_state.js] +[test_stk_menu_selection.js] +[test_stk_timer_expiration.js] +[test_stk_event_download.js] +[test_stk_response.js] diff --git a/dom/icc/tests/marionette/test_stk_event_download.js b/dom/icc/tests/marionette/test_stk_event_download.js new file mode 100644 index 00000000000..84959b3437d --- /dev/null +++ b/dom/icc/tests/marionette/test_stk_event_download.js @@ -0,0 +1,204 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 90000; +MARIONETTE_HEAD_JS = "head.js"; + + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + + // APDU format of ENVELOPE: + // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le) + + // Since |sendStkEventDownload| is an API without call back to identify the + // result, the tests of |sendStkMenuSelection| must be executed one by one with + // |verifyWithPeekedStkEnvelope| introduced here. + return Promise.resolve() + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_USER_ACTIVITY + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "07" + // Length + "990104" + // TAG_EVENT_LIST (STK_EVENT_TYPE_USER_ACTIVITY) + "82028281" // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "07" + // Length + "990105" + // TAG_EVENT_LIST (STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE) + "82020281" // TAG_DEVICE_ID (STK_DEVICE_ID_DISPLAY, STK_DEVICE_ID_SIM) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS, + locationStatus: MozIccManager.STK_SERVICE_STATE_NORMAL, + locationInfo: { + mcc: "466", + mnc: "92", + gsmLocationAreaCode: 10291, + gsmCellId: 19072823 + } + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "15" + // Length + "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "9B0100" + // TAG_LOCATION_STATUS (STK_SERVICE_STATE_NORMAL) + "930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS, + locationStatus: MozIccManager.STK_SERVICE_STATE_LIMITED, + // locationInfo shall be ignored if locationStatus != STK_SERVICE_STATE_NORMAL + locationInfo: { + mcc: "466", + mnc: "92", + gsmLocationAreaCode: 10291, + gsmCellId: 19072823 + } + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "9B0101" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_LIMITED) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS, + locationStatus: MozIccManager.STK_SERVICE_STATE_UNAVAILABLE, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "9B0102" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_UNAVAILABLE) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL, + number: "+9876543210", // International number + isIssuedByRemote: true, + error: null + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "12" + // Length + "990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL) + "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM) + "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0) + "8606918967452301" // TAG_ADDRESS (+9876543210) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL, + number: "987654321", // National number + isIssuedByRemote: true, + error: null + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "12" + // Length + "990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL) + "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM) + "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0) + "86068189674523F1" // TAG_ADDRESS (987654321) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED, + isIssuedByRemote: true, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED) + "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM) + "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED, + isIssuedByRemote: false, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED, + isIssuedByRemote: false, + error: "BusyError" + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0E" + // Length + "990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0) + "9A026091" // TAG_CAUSE (Busy) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED, + isIssuedByRemote: true, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED) + "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM) + "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION, + language: "zh", + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0B" + // Length + "990107" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LANGUAGE_SELECTION) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "2D027A68" // TAG_LANGUAGE ("zh") + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION, + terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "B40100" // TAG_BROWSER_TERMINATION_CAUSE (USER) + )) + + .then(() => icc.sendStkEventDownload({ + eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION, + terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR, + })) + .then(() => verifyWithPeekedStkEnvelope( + "D6" + // BER_EVENT_DOWNLOAD_TAG + "0A" + // Length + "990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION) + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "B40101" // TAG_BROWSER_TERMINATION_CAUSE (ERROR) + )); +}); \ No newline at end of file diff --git a/dom/icc/tests/marionette/test_stk_menu_selection.js b/dom/icc/tests/marionette/test_stk_menu_selection.js new file mode 100644 index 00000000000..7a27289e303 --- /dev/null +++ b/dom/icc/tests/marionette/test_stk_menu_selection.js @@ -0,0 +1,35 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 30000; +MARIONETTE_HEAD_JS = "head.js"; + + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + + // APDU format of ENVELOPE: + // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le) + + // Since |sendStkMenuSelection| is an API without call back to identify the + // result, the tests of |sendStkMenuSelection| must be executed one by one with + // |verifyWithPeekedStkEnvelope| introduced here. + return Promise.resolve() + .then(() => icc.sendStkMenuSelection(1, true)) + .then(() => verifyWithPeekedStkEnvelope( + "D3" + // BER_MENU_SELECTION_TAG + "09" + // Length + "82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM) + "900101" + // TAG_ITEM_ID (Item (1)) + "9500" // TAG_HELP_REQUEST + )) + + .then(() => icc.sendStkMenuSelection(0, false)) + .then(() => verifyWithPeekedStkEnvelope( + "D3" + // BER_MENU_SELECTION_TAG + "07" + // Length + "82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM) + "900100" // TAG_ITEM_ID (Item (0)) + )); +}); \ No newline at end of file diff --git a/dom/icc/tests/marionette/test_stk_response.js b/dom/icc/tests/marionette/test_stk_response.js new file mode 100644 index 00000000000..32eb8ec379b --- /dev/null +++ b/dom/icc/tests/marionette/test_stk_response.js @@ -0,0 +1,288 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 120000; +MARIONETTE_HEAD_JS = "head.js"; + + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + + // APDU format of TERMINAL RESPONSE: + // Class = 'A0', INS = '14', P1 = '00', P2 = '00', XXXX, (No Le) + + // Since |sendStkResponse| is an API without call back to identify the + // result, the tests of |sendStkResponse| must be executed one by one with + // |verifyWithPeekedStkResponse| introduced here. + return Promise.resolve() + .then(() => icc.sendStkResponse({ + commandNumber: 0x01, + typeOfCommand: MozIccManager.STK_CMD_LAUNCH_BROWSER, + commandQualifier: 0x00, + options: { + url: "", + mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED + } + }, { + resultCode: MozIccManager.STK_RESULT_OK + })) + .then(() => verifyWithPeekedStkResponse( + "8103011500" + // TAG_COMMAND_DETAILS (STK_CMD_LAUNCH_BROWSER) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" // TAG_RESULT (STK_RESULT_OK) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x02, + typeOfCommand: MozIccManager.STK_CMD_DISPLAY_TEXT, + commandQualifier: 0x01, + options: { + text: "Toolkit Test 1", + responseNeeded: false + } + }, { + resultCode: + MozIccManager.STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS, + additionalInformation: + MozIccManager.STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY + })) + .then(() => verifyWithPeekedStkResponse( + "8103022101" + // TAG_COMMAND_DETAILS (STK_CMD_DISPLAY_TEXT) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "83022001" // TAG_RESULT (STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x03, + typeOfCommand: MozIccManager.STK_CMD_SELECT_ITEM, + commandQualifier: 0x00, + options: { + title: "Toolkit Select", + items: [{identifier: 1, text: "Item 1"}, + {identifier: 2, text: "Item 2"}, + {identifier: 3, text: "Item 3"}, + {identifier: 4, text: "Item 4"}] + } + }, { + resultCode: MozIccManager.STK_RESULT_HELP_INFO_REQUIRED, + itemIdentifier: 5 + })) + .then(() => verifyWithPeekedStkResponse( + "8103032400" + // TAG_COMMAND_DETAILS (STK_CMD_SELECT_ITEM) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830113" + // TAG_RESULT (STK_RESULT_HELP_INFO_REQUIRED) + "900105" // TAG_ITEM_ID (5) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x04, + typeOfCommand: MozIccManager.STK_CMD_GET_INKEY, + commandQualifier: 0x04, + options: { + text: "Enter Y/N" + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + isYesNo: true + })) + .then(() => verifyWithPeekedStkResponse( + "8103042204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "8D020401" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, YES) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x05, + typeOfCommand: MozIccManager.STK_CMD_GET_INKEY, + commandQualifier: 0x04, + options: { + text: "Enter Y/N", + duration: { + timeUnit: MozIccManager.STK_TIME_UNIT_SECOND, + timeInterval: 10 + } + } + }, { + resultCode: MozIccManager.STK_RESULT_NO_RESPONSE_FROM_USER, + })) + .then(() => verifyWithPeekedStkResponse( + "8103052204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830112" + // TAG_RESULT (STK_RESULT_NO_RESPONSE_FROM_USER) + "0402010A" // TAG_DURATION (10 seconds) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x06, + typeOfCommand: MozIccManager.STK_CMD_GET_INPUT, + commandQualifier: 0x01, + options: { + text: "Enter Yes" + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + input: "Yes" + })) + .then(() => verifyWithPeekedStkResponse( + "8103062301" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INPUT) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "8D0404596573" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, "Yes") + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x07, + typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT, + commandQualifier: MozIccManager.STK_TIMER_START, + options: { + timerAction: MozIccManager.STK_TIMER_START, + timerId: 0x01, + timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03 + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + timer: { + timerAction: MozIccManager.STK_TIMER_START, + timerId: 0x01, + timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03 + }, + })) + .then(() => verifyWithPeekedStkResponse( + "8103072700" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "240101" + // TIMER_IDENTIFIER (TIMER ID = 1) + "2503102030" // TAG_TIMER_VALUE + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x08, + typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT, + commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE, + options: { + timerAction: MozIccManager.STK_TIMER_DEACTIVATE, + timerId: 0x02, + timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03 + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + timer: { + timerId: 0x02 + }, + })) + .then(() => verifyWithPeekedStkResponse( + "8103082701" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "240102" // TIMER_IDENTIFIER (TIMER ID = 2) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x09, + typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT, + commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE, + options: { + timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE, + timerId: 0x03, + } + }, { + resultCode: MozIccManager.STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE, + timer: { + timerId: 0x03 + }, + })) + .then(() => verifyWithPeekedStkResponse( + "8103092702" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830124" + // TAG_RESULT (STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE) + "240103" // TIMER_IDENTIFIER (TIMER ID = 3) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x0A, + typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, + commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO, + options: { + localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + localInfo: { + locationInfo: { + mcc: "466", + mnc: "92", + gsmLocationAreaCode: 10291, + gsmCellId: 19072823 + } + }, + })) + .then(() => verifyWithPeekedStkResponse( + "81030A2600" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x0B, + typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, + commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI, + options: { + localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + localInfo: { + imei: "123456789012345" + }, + })) + .then(() => verifyWithPeekedStkResponse( + "81030B2601" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "14081234567890123450" // TAG_IMEI ("123456789012345") + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x0C, + typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, + commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE, + options: { + localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + localInfo: { + // 2012, 3/4, 5:06:07 (Month is zero-based) + date: new Date(Date.UTC(2012, 2, 4, 5, 6, 7)) + }, + })) + .then(() => verifyWithPeekedStkResponse( + "81030C2603" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "260721304050607000" // TAG_DATE_TIME_ZONE ("2012, 3/4, 5:06:07" in UTC) + )) + + .then(() => icc.sendStkResponse({ + commandNumber: 0x0D, + typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, + commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE, + options: { + localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE + } + }, { + resultCode: MozIccManager.STK_RESULT_OK, + localInfo: { + language: "zh" + }, + })) + .then(() => verifyWithPeekedStkResponse( + "81030D2604" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO) + "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "830100" + // TAG_RESULT (STK_RESULT_OK) + "2D027A68" // TAG_LANGUAGE ("zh") + )); +}); \ No newline at end of file diff --git a/dom/icc/tests/marionette/test_stk_timer_expiration.js b/dom/icc/tests/marionette/test_stk_timer_expiration.js new file mode 100644 index 00000000000..f15d93bca56 --- /dev/null +++ b/dom/icc/tests/marionette/test_stk_timer_expiration.js @@ -0,0 +1,27 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 20000; +MARIONETTE_HEAD_JS = "head.js"; + + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + + // APDU format of ENVELOPE: + // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le) + + // Since |sendStkTimerExpiration| is an API without call back to identify the + // result, the tests of |sendStkMenuSelection| must be executed one by one with + // |verifyWithPeekedStkEnvelope| introduced here. + return Promise.resolve() + .then(() => icc.sendStkTimerExpiration({ timerId: 5, timerValue: 1234567 / 1000 })) + .then(() => verifyWithPeekedStkEnvelope( + "D7" + // BER_TIMER_EXPIRATION_TAG + "0C" + // Length + "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM) + "A40105" + // TAG_TIMER_IDENTIFIER (5) + "A503000243" // TIMER_VALUE (00:20:34) = 1234 seconds + )); +}); \ No newline at end of file