summaryrefslogtreecommitdiffstats
path: root/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/system/gonk/tests/test_ril_worker_voiceprivacy.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/system/gonk/tests/test_ril_worker_voiceprivacy.js')
-rw-r--r--dom/system/gonk/tests/test_ril_worker_voiceprivacy.js94
1 files changed, 94 insertions, 0 deletions
diff --git a/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js b/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js
new file mode 100644
index 000000000..21829da22
--- /dev/null
+++ b/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js
@@ -0,0 +1,94 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
+
+function run_test() {
+ run_next_test();
+}
+
+add_test(function test_setVoicePrivacyMode_success() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
+ context.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {});
+ };
+
+ context.RIL.setVoicePrivacyMode({
+ enabled: true
+ });
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, undefined);
+
+ run_next_test();
+});
+
+add_test(function test_setVoicePrivacyMode_generic_failure() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.RIL.setVoicePrivacyMode = function fakeSetVoicePrivacyMode(options) {
+ context.RIL[REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE](0, {
+ errorMsg: GECKO_ERROR_GENERIC_FAILURE
+ });
+ };
+
+ context.RIL.setVoicePrivacyMode({
+ enabled: true
+ });
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
+
+ run_next_test();
+});
+
+add_test(function test_queryVoicePrivacyMode_success_enabled_true() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.Buf.readInt32List = function fakeReadUint32List() {
+ return [1];
+ };
+
+ context.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
+ context.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {});
+ };
+
+ context.RIL.queryVoicePrivacyMode();
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, undefined);
+ ok(postedMessage.enabled);
+ run_next_test();
+});
+
+add_test(function test_queryVoicePrivacyMode_success_enabled_false() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.Buf.readInt32List = function fakeReadUint32List() {
+ return [0];
+ };
+
+ context.RIL.queryVoicePrivacyMode = function fakeQueryVoicePrivacyMode(options) {
+ context.RIL[REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE](1, {});
+ };
+
+ context.RIL.queryVoicePrivacyMode();
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, undefined);
+ ok(!postedMessage.enabled);
+ run_next_test();
+});