From e514da1eedb2e11d25940d4ecbd1dfb1ed687379 Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Wed, 16 Jan 2013 17:34:37 +0800 Subject: [PATCH] Bug 821584 - Part 2: xpcshell tests for parsePbrTlv. r=hsinyi --- dom/system/gonk/tests/test_ril_worker_icc.js | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dom/system/gonk/tests/test_ril_worker_icc.js b/dom/system/gonk/tests/test_ril_worker_icc.js index f5109a328af..e3fa2bcc755 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc.js +++ b/dom/system/gonk/tests/test_ril_worker_icc.js @@ -1288,3 +1288,52 @@ add_test(function test_path_id_for_spid_and_spn() { EF_PATH_MF_SIM + EF_PATH_ADF_USIM); run_next_test(); }); + +/** + * Verify ICCUtilsHelper.parsePbrTlvs + */ +add_test(function test_parse_pbr_tlvs() { + let worker = newUint8Worker(); + let buf = worker.Buf; + let pduHelper = worker.GsmPDUHelper; + + let pbrTlvs = [ + {tag: ICC_USIM_TYPE1_TAG, + length: 0x0F, + value: [{tag: ICC_USIM_EFADN_TAG, + length: 0x03, + value: [0x4F, 0x3A, 0x02]}, + {tag: ICC_USIM_EFIAP_TAG, + length: 0x03, + value: [0x4F, 0x25, 0x01]}, + {tag: ICC_USIM_EFPBC_TAG, + length: 0x03, + value: [0x4F, 0x09, 0x04]}] + }, + {tag: ICC_USIM_TYPE2_TAG, + length: 0x05, + value: [{tag: ICC_USIM_EFEMAIL_TAG, + length: 0x03, + value: [0x4F, 0x50, 0x0B]}] + }, + {tag: ICC_USIM_TYPE3_TAG, + length: 0x0A, + value: [{tag: ICC_USIM_EFCCP1_TAG, + length: 0x03, + value: [0x4F, 0x3D, 0x0A]}, + {tag: ICC_USIM_EFEXT1_TAG, + length: 0x03, + value: [0x4F, 0x4A, 0x03]}] + }, + ]; + + let pbr = worker.ICCUtilsHelper.parsePbrTlvs(pbrTlvs); + do_check_eq(pbr.adn.fileId, 0x4F3a); + do_check_eq(pbr.iap.fileId, 0x4F25); + do_check_eq(pbr.pbc.fileId, 0x4F09); + do_check_eq(pbr.email.fileId, 0x4F50); + do_check_eq(pbr.ccp1.fileId, 0x4F3D); + do_check_eq(pbr.ext1.fileId, 0x4F4A); + + run_next_test(); +});