mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
66 lines
1.7 KiB
JavaScript
66 lines
1.7 KiB
JavaScript
/* 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, {
|
|
rilRequestError: ERROR_SUCCESS
|
|
});
|
|
};
|
|
|
|
context.RIL.queryCLIP({});
|
|
|
|
let postedMessage = workerHelper.postedMessage;
|
|
|
|
do_check_eq(postedMessage.errorMsg, undefined);
|
|
do_check_true(postedMessage.success);
|
|
do_check_eq(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, {
|
|
rilRequestError: ERROR_SUCCESS
|
|
});
|
|
};
|
|
|
|
context.RIL.queryCLIP({});
|
|
|
|
let postedMessage = workerHelper.postedMessage;
|
|
|
|
do_check_eq(postedMessage.errorMsg, "GenericFailure");
|
|
do_check_false(postedMessage.success);
|
|
run_next_test();
|
|
});
|