summaryrefslogtreecommitdiffstats
path: root/dom/system/gonk/tests/test_ril_worker_clip.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_clip.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_clip.js')
-rw-r--r--dom/system/gonk/tests/test_ril_worker_clip.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/system/gonk/tests/test_ril_worker_clip.js b/dom/system/gonk/tests/test_ril_worker_clip.js
new file mode 100644
index 000000000..d1ce5f617
--- /dev/null
+++ b/dom/system/gonk/tests/test_ril_worker_clip.js
@@ -0,0 +1,59 @@
+/* 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_queryCLIP_provisioned() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.Buf.readInt32 = function fakeReadUint32() {
+ return context.Buf.int32Array.pop();
+ };
+
+ context.RIL.queryCLIP = function fakeQueryCLIP(options) {
+ context.Buf.int32Array = [
+ 1, // CLIP provisioned.
+ 1 // Length.
+ ];
+ context.RIL[REQUEST_QUERY_CLIP](1, {});
+ };
+
+ context.RIL.queryCLIP({});
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, undefined);
+ equal(postedMessage.provisioned, 1);
+ run_next_test();
+});
+
+add_test(function test_getCLIP_error_generic_failure_invalid_length() {
+ let workerHelper = newInterceptWorker();
+ let worker = workerHelper.worker;
+ let context = worker.ContextPool._contexts[0];
+
+ context.Buf.readInt32 = function fakeReadUint32() {
+ return context.Buf.int32Array.pop();
+ };
+
+ context.RIL.queryCLIP = function fakeQueryCLIP(options) {
+ context.Buf.int32Array = [
+ 1, // CLIP provisioned.
+ 0 // Length.
+ ];
+ context.RIL[REQUEST_QUERY_CLIP](1, {});
+ };
+
+ context.RIL.queryCLIP({});
+
+ let postedMessage = workerHelper.postedMessage;
+
+ equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
+ run_next_test();
+});