зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team. a=merge
This commit is contained in:
Коммит
12063de3c6
|
@ -525,11 +525,8 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
{
|
||||
// If we can't find the point in a child, we will return the fallback answer:
|
||||
// we return |this| if the point is within it, otherwise nullptr.
|
||||
nsIntRect rect = Bounds();
|
||||
if (rect.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
Accessible* fallbackAnswer = nullptr;
|
||||
nsIntRect rect = Bounds();
|
||||
if (aX >= rect.x && aX < rect.x + rect.width &&
|
||||
aY >= rect.y && aY < rect.y + rect.height)
|
||||
fallbackAnswer = this;
|
||||
|
|
|
@ -68,6 +68,8 @@ if (!MAC) {
|
|||
hitTest("imgmap", theLetterA, theLetterA);
|
||||
hitTest("container", "imgmap", theLetterA);
|
||||
|
||||
// hit testing for element contained by zero-width element
|
||||
hitTest("container2", "container2_input", "container2_input");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -106,5 +108,8 @@ if (!MAC) {
|
|||
<img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/>
|
||||
</div>
|
||||
|
||||
<div id="container2" style="width: 0px">
|
||||
<input id="container2_input">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1092,3 +1092,7 @@ pref("dom.mozSettings.allowForceReadOnly", false);
|
|||
|
||||
// RequestSync API is enabled by default on B2G.
|
||||
pref("dom.requestSync.enabled", true);
|
||||
|
||||
// Enable hardware vsync compositor
|
||||
pref("gfx.vsync.hw-vsync.enabled", true);
|
||||
pref("gfx.vsync.compositor", true);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -135,7 +135,7 @@
|
|||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c5f8d282efe4a4e8b1e31a37300944e338e60e4f"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="0c557e136bb615923aad0f5c69da4e869523efc5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="13374490fc0c989347448f0b2d6b220adff5e630"/>
|
||||
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
|
||||
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
|
||||
</manifest>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -146,7 +146,7 @@
|
|||
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
|
||||
<project name="platform/system/core" path="system/core" revision="350eac5403124dacb2a5fd9e28ac290a59fc3b8e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="0c557e136bb615923aad0f5c69da4e869523efc5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="13374490fc0c989347448f0b2d6b220adff5e630"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4c187c1f3a0dffd8e51a961735474ea703535b99"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -145,7 +145,7 @@
|
|||
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
|
||||
<project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="0c557e136bb615923aad0f5c69da4e869523efc5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="13374490fc0c989347448f0b2d6b220adff5e630"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "793773bb2944b42a85dd160049e605cbd880c4da",
|
||||
"git_revision": "b02ec9713e6de8d96c6954d2c0dfd0442b0656ac",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "23aac85cce8d5d0435b7d5639e4ff6410c2dd121",
|
||||
"revision": "bdc67bb5e9be1469a96158d657a1829373c4152a",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform_bionic" path="bionic" remote="b2g" revision="1a2a32eda22ef2cd18f57f423a5e7b22a105a6f8"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -130,7 +130,7 @@
|
|||
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
|
||||
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="0c557e136bb615923aad0f5c69da4e869523efc5"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="13374490fc0c989347448f0b2d6b220adff5e630"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="793773bb2944b42a85dd160049e605cbd880c4da"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b02ec9713e6de8d96c6954d2c0dfd0442b0656ac"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="05baa465f008e92cdf4db74d62f1e3885e3ee73d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d6a27295acb0a25926bf6290dd2532a7f9027864"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
|
|
@ -1186,7 +1186,7 @@ pref("security.sandbox.windows.log", false);
|
|||
// To get a different setting for a particular plugin replace "default", with
|
||||
// the plugin's nice file name, see: nsPluginTag::GetNiceFileName.
|
||||
pref("dom.ipc.plugins.sandbox.default", false);
|
||||
pref("dom.ipc.plugins.sandbox.flash", false);
|
||||
pref("dom.ipc.plugins.sandbox.flash", true);
|
||||
|
||||
#if defined(MOZ_CONTENT_SANDBOX)
|
||||
// This controls whether the Windows content process sandbox is using a more
|
||||
|
|
|
@ -34,6 +34,8 @@ SEARCH_PATHS = [
|
|||
'python/jsmin',
|
||||
'python/psutil',
|
||||
'python/which',
|
||||
'python/pystache',
|
||||
'python/pyyaml/lib',
|
||||
'build/pymake',
|
||||
'config',
|
||||
'dom/bindings',
|
||||
|
@ -42,6 +44,7 @@ SEARCH_PATHS = [
|
|||
'other-licenses/ply',
|
||||
'xpcom/idl-parser',
|
||||
'testing',
|
||||
'testing/taskcluster',
|
||||
'testing/xpcshell',
|
||||
'testing/web-platform',
|
||||
'testing/web-platform/harness',
|
||||
|
@ -79,6 +82,7 @@ MACH_MODULES = [
|
|||
'python/mozbuild/mozbuild/frontend/mach_commands.py',
|
||||
'services/common/tests/mach_commands.py',
|
||||
'testing/mach_commands.py',
|
||||
'testing/taskcluster/mach_commands.py',
|
||||
'testing/marionette/mach_commands.py',
|
||||
'testing/mochitest/mach_commands.py',
|
||||
'testing/xpcshell/mach_commands.py',
|
||||
|
@ -108,6 +112,11 @@ CATEGORIES = {
|
|||
'long': 'Run tests.',
|
||||
'priority': 60,
|
||||
},
|
||||
'ci': {
|
||||
'short': 'CI',
|
||||
'long': 'Taskcluster commands',
|
||||
'priority': 59
|
||||
},
|
||||
'devenv': {
|
||||
'short': 'Development Environment',
|
||||
'long': 'Set up and configure your development environment.',
|
||||
|
|
|
@ -3383,10 +3383,8 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
|
|||
{
|
||||
SetIsActive(value);
|
||||
}
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsPrerendered(&value))) {
|
||||
if (value) {
|
||||
SetIsPrerendered(true);
|
||||
}
|
||||
if (parentAsDocShell->GetIsPrerendered()) {
|
||||
SetIsPrerendered(true);
|
||||
}
|
||||
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
|
||||
value = false;
|
||||
|
|
|
@ -624,7 +624,7 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
* native code to be able to put a docshell in prerendering.
|
||||
*/
|
||||
[noscript] void SetIsPrerendered(in boolean prerendered);
|
||||
readonly attribute boolean isPrerendered;
|
||||
[infallible] readonly attribute boolean isPrerendered;
|
||||
|
||||
/**
|
||||
* The ID of the docshell in the session history.
|
||||
|
|
|
@ -397,10 +397,10 @@ EventListenerManagerHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
|||
lm->~EventListenerManagerMapEntry();
|
||||
}
|
||||
|
||||
class SameOriginChecker MOZ_FINAL : public nsIChannelEventSink,
|
||||
public nsIInterfaceRequestor
|
||||
class SameOriginCheckerImpl MOZ_FINAL : public nsIChannelEventSink,
|
||||
public nsIInterfaceRequestor
|
||||
{
|
||||
~SameOriginChecker() {}
|
||||
~SameOriginCheckerImpl() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
|
@ -5648,11 +5648,11 @@ nsContentUtils::StringContainsASCIIUpper(const nsAString& aStr)
|
|||
|
||||
/* static */
|
||||
nsIInterfaceRequestor*
|
||||
nsContentUtils::GetSameOriginChecker()
|
||||
nsContentUtils::SameOriginChecker()
|
||||
{
|
||||
if (!sSameOriginChecker) {
|
||||
sSameOriginChecker = new SameOriginChecker();
|
||||
NS_IF_ADDREF(sSameOriginChecker);
|
||||
sSameOriginChecker = new SameOriginCheckerImpl();
|
||||
NS_ADDREF(sSameOriginChecker);
|
||||
}
|
||||
return sSameOriginChecker;
|
||||
}
|
||||
|
@ -5683,15 +5683,15 @@ nsContentUtils::CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(SameOriginChecker,
|
||||
NS_IMPL_ISUPPORTS(SameOriginCheckerImpl,
|
||||
nsIChannelEventSink,
|
||||
nsIInterfaceRequestor)
|
||||
|
||||
NS_IMETHODIMP
|
||||
SameOriginChecker::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel,
|
||||
uint32_t aFlags,
|
||||
nsIAsyncVerifyRedirectCallback *cb)
|
||||
SameOriginCheckerImpl::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
|
||||
nsIChannel* aNewChannel,
|
||||
uint32_t aFlags,
|
||||
nsIAsyncVerifyRedirectCallback* cb)
|
||||
{
|
||||
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
|
||||
|
||||
|
@ -5704,7 +5704,7 @@ SameOriginChecker::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SameOriginChecker::GetInterface(const nsIID & aIID, void **aResult)
|
||||
SameOriginCheckerImpl::GetInterface(const nsIID& aIID, void** aResult)
|
||||
{
|
||||
return QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
|
|
@ -1635,7 +1635,7 @@ public:
|
|||
|
||||
// Returns NS_OK for same origin, error (NS_ERROR_DOM_BAD_URI) if not.
|
||||
static nsresult CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel);
|
||||
static nsIInterfaceRequestor* GetSameOriginChecker();
|
||||
static nsIInterfaceRequestor* SameOriginChecker();
|
||||
|
||||
/**
|
||||
* Get the Origin of the passed in nsIPrincipal or nsIURI. If the passed in
|
||||
|
|
|
@ -1337,8 +1337,7 @@ nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
|
|||
|
||||
nsIDocument* doc = aRequestingNode->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
|
||||
NS_ENSURE_TRUE(req, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::SameOriginChecker();
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = doc->GetDocumentLoadGroup();
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
|
|
@ -4342,10 +4342,11 @@ nsGlobalWindow::GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
|
|||
}
|
||||
|
||||
/* static */ bool
|
||||
nsGlobalWindow::IsChromeWindow(JSContext* aCx, JSObject* aObj)
|
||||
nsGlobalWindow::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
// For now, have to deal with XPConnect objects here.
|
||||
return xpc::WindowOrNull(aObj)->IsChromeWindow();
|
||||
return xpc::WindowOrNull(aObj)->IsChromeWindow() &&
|
||||
nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
|
|
|
@ -491,7 +491,7 @@ public:
|
|||
|
||||
void GetSupportedNames(nsTArray<nsString>& aNames);
|
||||
|
||||
static bool IsChromeWindow(JSContext* /* unused */, JSObject* aObj);
|
||||
static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj);
|
||||
|
||||
static bool IsShowModalDialogEnabled(JSContext* /* unused */ = nullptr,
|
||||
JSObject* /* unused */ = nullptr);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "jsfriendapi.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
@ -2381,12 +2382,47 @@ CheckPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CheckSafetyInPrerendering(JSContext* aCx, JSObject* aObj)
|
||||
void
|
||||
HandlePrerenderingViolation(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
//TODO: Check if page is being prerendered.
|
||||
//Returning false for now.
|
||||
return false;
|
||||
// Suspend the window and its workers, and its children too.
|
||||
aWindow->SuspendTimeouts();
|
||||
|
||||
// Suspend event handling on the document
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
if (doc) {
|
||||
doc->SuppressEventHandling(nsIDocument::eEvents);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
EnforceNotInPrerendering(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS::Rooted<JSObject*> thisObj(aCx, js::CheckedUnwrap(aObj));
|
||||
if (!thisObj) {
|
||||
// Without a this object, we cannot check the safety.
|
||||
return true;
|
||||
}
|
||||
nsGlobalWindow* window = xpc::WindowGlobalOrNull(thisObj);
|
||||
if (!window) {
|
||||
// Without a window, we cannot check the safety.
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIDocShell* docShell = window->GetDocShell();
|
||||
if (!docShell) {
|
||||
// Without a docshell, we cannot check the safety.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (docShell->GetIsPrerendered()) {
|
||||
HandlePrerenderingViolation(window);
|
||||
// When the bindings layer sees a false return value, it returns false form
|
||||
// the JSNative in order to trigger an uncatchable exception.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -3142,9 +3142,20 @@ AssertReturnTypeMatchesJitinfo(const JSJitInfo* aJitinfo,
|
|||
bool
|
||||
CheckPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[]);
|
||||
|
||||
//Returns true if page is being prerendered.
|
||||
// This function is called by the bindings layer for methods/getters/setters
|
||||
// that are not safe to be called in prerendering mode. It checks to make sure
|
||||
// that the |this| object is not running in a global that is in prerendering
|
||||
// mode. Otherwise, it aborts execution of timers and event handlers, and
|
||||
// returns false which gets converted to an uncatchable exception by the
|
||||
// bindings layer.
|
||||
bool
|
||||
CheckSafetyInPrerendering(JSContext* aCx, JSObject* aObj);
|
||||
EnforceNotInPrerendering(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Handles the violation of a blacklisted action in prerendering mode by
|
||||
// aborting the scripts, and preventing timers and event handlers from running
|
||||
// in the window in the future.
|
||||
void
|
||||
HandlePrerenderingViolation(nsPIDOMWindow* aWindow);
|
||||
|
||||
bool
|
||||
CallerSubsumes(JSObject* aObject);
|
||||
|
|
|
@ -1829,7 +1829,7 @@ addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSou
|
|||
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
|
||||
addExternalIface('MozSmsMessage')
|
||||
addExternalIface('MozTreeView', nativeType='nsITreeView',
|
||||
headerFile='nsITreeView.h')
|
||||
headerFile='nsITreeView.h', notflattened=True)
|
||||
addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
|
||||
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
|
||||
addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
|
||||
|
|
|
@ -6506,8 +6506,10 @@ class CGPerSignatureCall(CGThing):
|
|||
for i in descriptor.interface.getInheritedInterfaces())):
|
||||
cgThings.append(CGGeneric(dedent(
|
||||
"""
|
||||
if (mozilla::dom::CheckSafetyInPrerendering(cx, obj)) {
|
||||
//TODO: Handle call into unsafe API during Prerendering (Bug 730101)
|
||||
if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
|
||||
// Return false from the JSNative in order to trigger
|
||||
// an uncatchable exception.
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return false;
|
||||
}
|
||||
""")))
|
||||
|
|
|
@ -6,3 +6,8 @@
|
|||
[test_dom_xrays.html]
|
||||
[test_proxies_via_xray.html]
|
||||
[test_document_location_via_xray_cached.html]
|
||||
[test_blacklisted_prerendering_function.xul]
|
||||
support-files =
|
||||
file_focuser.html
|
||||
file_fullScreenPropertyAccessor.html
|
||||
skip-if = e10s # prerendering doesn't work in e10s yet
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE HTML>
|
||||
<div id="stage"></div>
|
||||
<script>
|
||||
function stage(str) {
|
||||
var s = document.getElementById("stage");
|
||||
s.textContent = str;
|
||||
}
|
||||
stage("before");
|
||||
setTimeout(function() {
|
||||
stage("in timeout");
|
||||
});
|
||||
setInterval(function() {
|
||||
stage("in interval");
|
||||
});
|
||||
addEventListener("keydown", function() {
|
||||
stage("keydown");
|
||||
}, false);
|
||||
try {
|
||||
focus();
|
||||
stage("after");
|
||||
} catch(e) {
|
||||
stage("exception raised");
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE HTML>
|
||||
<div id="stage"></div>
|
||||
<script>
|
||||
function stage(str) {
|
||||
var s = document.getElementById("stage");
|
||||
s.textContent = str;
|
||||
}
|
||||
stage("before");
|
||||
setTimeout(function() {
|
||||
stage("in timeout");
|
||||
});
|
||||
setInterval(function() {
|
||||
stage("in interval");
|
||||
});
|
||||
addEventListener("keydown", function() {
|
||||
stage("keydown");
|
||||
}, false);
|
||||
try {
|
||||
window.fullScreen;
|
||||
stage("after");
|
||||
} catch(e) {
|
||||
stage("exception raised");
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="runTest();">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function Listener(aBrowser, aPrerendered, aCallback) {
|
||||
this.init(aBrowser, aPrerendered, aCallback);
|
||||
}
|
||||
|
||||
Listener.prototype = {
|
||||
init: function(aBrowser, aPrerendered, aCallback) {
|
||||
this.mBrowser = aBrowser;
|
||||
this.mPrerendered = aPrerendered;
|
||||
this.mCallback = aCallback;
|
||||
},
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
aIID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
},
|
||||
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
if ((aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) &&
|
||||
(aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_DOCUMENT)) {
|
||||
var doc = this.mBrowser.contentDocument;
|
||||
var stage = doc.getElementById("stage");
|
||||
if (this.mPrerendered) {
|
||||
is(stage.textContent, "before", "The blacklisted call should properly be intercepted in prerendering mode");
|
||||
} else {
|
||||
// In normal mode, we may or may not have run the timeout and/or the interval.
|
||||
switch (stage.textContent) {
|
||||
case "after":
|
||||
case "in timeout":
|
||||
case "in interval":
|
||||
ok(true, "The blacklisted call should work fine in normal mode");
|
||||
break;
|
||||
default:
|
||||
ok(false, "The blacklisted call should work fine in normal mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
progress.removeProgressListener(progressListener);
|
||||
|
||||
// Set three timeouts to see if the interval triggered
|
||||
var self = this;
|
||||
function checkInterval() {
|
||||
var expected = self.mPrerendered ? "before" : "in interval";
|
||||
var desc = self.mPrerendered ? "No timer should be running" : "Timers should run as normal";
|
||||
is(stage.textContent, expected, desc);
|
||||
// Now, dispatch a key event to the window and see if the keydown handler runs
|
||||
synthesizeKey("a", {}, self.mBrowser.contentWindow);
|
||||
expected = self.mPrerendered ? "before" : "keydown";
|
||||
desc = self.mPrerendered ? "No event handler should be running" : "Event handlers should run as normal";
|
||||
is(stage.textContent, expected, desc);
|
||||
self.mCallback();
|
||||
}
|
||||
setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
checkInterval();
|
||||
}, 0);
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
onProgressChange : function(aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress) {},
|
||||
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) {},
|
||||
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {},
|
||||
onSecurityChange : function(aWebProgress, aRequest, aState) {},
|
||||
mBrowser: null,
|
||||
mPrerendered: false,
|
||||
mCallback: null
|
||||
};
|
||||
|
||||
var progress, progressListener;
|
||||
|
||||
function runTest() {
|
||||
testStep(false, "file_focuser.html", function() {
|
||||
testStep(true, "file_focuser.html", function() {
|
||||
testStep(false, "file_fullScreenPropertyAccessor.html", function() {
|
||||
testStep(true, "file_fullScreenPropertyAccessor.html", function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testStep(aPrerendered, aFileName, aCallback) {
|
||||
var browser = document.getElementById(aPrerendered ? "prerendered" : "normal");;
|
||||
progressListener = new Listener(browser, aPrerendered, aCallback);
|
||||
var docShell = browser.docShell;
|
||||
progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebProgress);
|
||||
progress.addProgressListener(progressListener,
|
||||
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
browser.loadURI("chrome://mochitests/content/chrome/dom/bindings/test/" + aFileName);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069719">Mozilla Bug 1069719</a>
|
||||
<p id="display"></p>
|
||||
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
<browser prerendered="true" id="prerendered"/>
|
||||
<browser id="normal"/>
|
||||
</window>
|
|
@ -0,0 +1,429 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothDaemonA2dpInterface.h"
|
||||
#include "BluetoothDaemonSetupInterface.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
//
|
||||
// A2DP module
|
||||
//
|
||||
|
||||
BluetoothA2dpNotificationHandler*
|
||||
BluetoothDaemonA2dpModule::sNotificationHandler;
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::SetNotificationHandler(
|
||||
BluetoothA2dpNotificationHandler* aNotificationHandler)
|
||||
{
|
||||
sNotificationHandler = aNotificationHandler;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonA2dpModule::Send(BluetoothDaemonPDU* aPDU,
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
aRes->AddRef(); // Keep reference for response
|
||||
return Send(aPDU, static_cast<void*>(aRes));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU, void* aUserData)
|
||||
{
|
||||
static void (BluetoothDaemonA2dpModule::* const HandleOp[])(
|
||||
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf),
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
// negate twice to map bit to 0/1
|
||||
unsigned int isNtf = !!(aHeader.mOpcode & 0x80);
|
||||
|
||||
(this->*(HandleOp[isNtf]))(aHeader, aPDU, aUserData);
|
||||
}
|
||||
|
||||
// Commands
|
||||
//
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonA2dpModule::ConnectCmd(
|
||||
const nsAString& aRemoteAddr, BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(SERVICE_ID,
|
||||
OPCODE_CONNECT,
|
||||
6)); // Address
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Send(pdu, aRes);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
unused << pdu.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonA2dpModule::DisconnectCmd(
|
||||
const nsAString& aRemoteAddr, BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(SERVICE_ID,
|
||||
OPCODE_DISCONNECT,
|
||||
6)); // Address
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Send(pdu, aRes);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
unused << pdu.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Responses
|
||||
//
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::ErrorRsp(
|
||||
const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU, BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
ErrorRunnable::Dispatch(
|
||||
aRes, &BluetoothA2dpResultHandler::OnError, UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::ConnectRsp(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
ResultRunnable::Dispatch(
|
||||
aRes, &BluetoothA2dpResultHandler::Connect, UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::DisconnectRsp(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
ResultRunnable::Dispatch(
|
||||
aRes, &BluetoothA2dpResultHandler::Disconnect, UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::HandleRsp(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
|
||||
void* aUserData)
|
||||
{
|
||||
static void (BluetoothDaemonA2dpModule::* const HandleRsp[])(
|
||||
const BluetoothDaemonPDUHeader&,
|
||||
BluetoothDaemonPDU&,
|
||||
BluetoothA2dpResultHandler*) = {
|
||||
INIT_ARRAY_AT(OPCODE_ERROR,
|
||||
&BluetoothDaemonA2dpModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CONNECT,
|
||||
&BluetoothDaemonA2dpModule::ConnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_DISCONNECT,
|
||||
&BluetoothDaemonA2dpModule::DisconnectRsp),
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
||||
if (NS_WARN_IF(!(aHeader.mOpcode < MOZ_ARRAY_LENGTH(HandleRsp))) ||
|
||||
NS_WARN_IF(!HandleRsp[aHeader.mOpcode])) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<BluetoothA2dpResultHandler> res =
|
||||
already_AddRefed<BluetoothA2dpResultHandler>(
|
||||
static_cast<BluetoothA2dpResultHandler*>(aUserData));
|
||||
|
||||
if (!res) {
|
||||
return; // Return early if no result handler has been set for response
|
||||
}
|
||||
|
||||
(this->*(HandleRsp[aHeader.mOpcode]))(aHeader, aPDU, res);
|
||||
}
|
||||
|
||||
// Notifications
|
||||
//
|
||||
|
||||
// Returns the current notification handler to a notification runnable
|
||||
class BluetoothDaemonA2dpModule::NotificationHandlerWrapper MOZ_FINAL
|
||||
{
|
||||
public:
|
||||
typedef BluetoothA2dpNotificationHandler ObjectType;
|
||||
|
||||
static ObjectType* GetInstance()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
return sNotificationHandler;
|
||||
}
|
||||
};
|
||||
|
||||
// Init operator class for ConnectionStateNotification
|
||||
class BluetoothDaemonA2dpModule::ConnectionStateInitOp MOZ_FINAL
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ConnectionStateInitOp(BluetoothDaemonPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothA2dpConnectionState& aArg1, nsString& aArg2) const
|
||||
{
|
||||
BluetoothDaemonPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg2));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::ConnectionStateNtf(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
|
||||
{
|
||||
ConnectionStateNotification::Dispatch(
|
||||
&BluetoothA2dpNotificationHandler::ConnectionStateNotification,
|
||||
ConnectionStateInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AudioStateNotification
|
||||
class BluetoothDaemonA2dpModule::AudioStateInitOp MOZ_FINAL
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AudioStateInitOp(BluetoothDaemonPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothA2dpAudioState& aArg1,
|
||||
nsString& aArg2) const
|
||||
{
|
||||
BluetoothDaemonPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg2));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::AudioStateNtf(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU)
|
||||
{
|
||||
AudioStateNotification::Dispatch(
|
||||
&BluetoothA2dpNotificationHandler::AudioStateNotification,
|
||||
AudioStateInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::HandleNtf(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
|
||||
void* aUserData)
|
||||
{
|
||||
static void (BluetoothDaemonA2dpModule::* const HandleNtf[])(
|
||||
const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf),
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
uint8_t index = aHeader.mOpcode - 0x81;
|
||||
|
||||
if (NS_WARN_IF(!(index < MOZ_ARRAY_LENGTH(HandleNtf))) ||
|
||||
NS_WARN_IF(!HandleNtf[index])) {
|
||||
return;
|
||||
}
|
||||
|
||||
(this->*(HandleNtf[index]))(aHeader, aPDU);
|
||||
}
|
||||
|
||||
//
|
||||
// A2DP interface
|
||||
//
|
||||
|
||||
BluetoothDaemonA2dpInterface::BluetoothDaemonA2dpInterface(
|
||||
BluetoothDaemonA2dpModule* aModule)
|
||||
: mModule(aModule)
|
||||
{ }
|
||||
|
||||
BluetoothDaemonA2dpInterface::~BluetoothDaemonA2dpInterface()
|
||||
{ }
|
||||
|
||||
class BluetoothDaemonA2dpInterface::InitResultHandler MOZ_FINAL
|
||||
: public BluetoothSetupResultHandler
|
||||
{
|
||||
public:
|
||||
InitResultHandler(BluetoothA2dpResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mRes->OnError(aStatus);
|
||||
}
|
||||
|
||||
void RegisterModule() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mRes->Init();
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothA2dpResultHandler> mRes;
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpInterface::Init(
|
||||
BluetoothA2dpNotificationHandler* aNotificationHandler,
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
// Set notification handler _before_ registering the module. It could
|
||||
// happen that we receive notifications, before the result handler runs.
|
||||
mModule->SetNotificationHandler(aNotificationHandler);
|
||||
|
||||
InitResultHandler* res;
|
||||
|
||||
if (aRes) {
|
||||
res = new InitResultHandler(aRes);
|
||||
} else {
|
||||
// We don't need a result handler if the caller is not interested.
|
||||
res = nullptr;
|
||||
}
|
||||
|
||||
nsresult rv = mModule->RegisterModule(BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
0x00, res);
|
||||
if (NS_FAILED(rv) && aRes) {
|
||||
DispatchError(aRes, STATUS_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
class BluetoothDaemonA2dpInterface::CleanupResultHandler MOZ_FINAL
|
||||
: public BluetoothSetupResultHandler
|
||||
{
|
||||
public:
|
||||
CleanupResultHandler(BluetoothDaemonA2dpModule* aModule,
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
: mModule(aModule)
|
||||
, mRes(aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
}
|
||||
|
||||
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mRes) {
|
||||
mRes->OnError(aStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void UnregisterModule() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Clear notification handler _after_ module has been
|
||||
// unregistered. While unregistering the module, we might
|
||||
// still receive notifications.
|
||||
mModule->SetNotificationHandler(nullptr);
|
||||
|
||||
if (mRes) {
|
||||
mRes->Cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothDaemonA2dpModule* mModule;
|
||||
nsRefPtr<BluetoothA2dpResultHandler> mRes;
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpInterface::Cleanup(
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
mModule->UnregisterModule(BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
new CleanupResultHandler(mModule, aRes));
|
||||
}
|
||||
|
||||
/* Connect / Disconnect */
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpInterface::Connect(
|
||||
const nsAString& aBdAddr, BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
|
||||
mModule->ConnectCmd(aBdAddr, aRes);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpInterface::Disconnect(
|
||||
const nsAString& aBdAddr, BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
|
||||
mModule->DisconnectCmd(aBdAddr, aRes);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpInterface::DispatchError(
|
||||
BluetoothA2dpResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothA2dpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothA2dpResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
|
@ -0,0 +1,152 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_bluetooth_bluetoothdaemona2dpinterface_h
|
||||
#define mozilla_dom_bluetooth_bluetoothdaemona2dpinterface_h
|
||||
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothSetupResultHandler;
|
||||
|
||||
class BluetoothDaemonA2dpModule
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
SERVICE_ID = 0x06
|
||||
};
|
||||
|
||||
enum {
|
||||
OPCODE_ERROR = 0x00,
|
||||
OPCODE_CONNECT = 0x01,
|
||||
OPCODE_DISCONNECT = 0x02
|
||||
};
|
||||
|
||||
virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0;
|
||||
|
||||
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult UnregisterModule(uint8_t aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
void SetNotificationHandler(
|
||||
BluetoothA2dpNotificationHandler* aNotificationHandler);
|
||||
|
||||
//
|
||||
// Commands
|
||||
//
|
||||
|
||||
nsresult ConnectCmd(const nsAString& aBdAddr,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
nsresult DisconnectCmd(const nsAString& aBdAddr,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
protected:
|
||||
nsresult Send(BluetoothDaemonPDU* aPDU,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
void HandleSvc(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU, void* aUserData);
|
||||
|
||||
//
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothA2dpResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothA2dpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
void DisconnectRsp(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
void HandleRsp(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU,
|
||||
void* aUserData);
|
||||
|
||||
//
|
||||
// Notifications
|
||||
//
|
||||
|
||||
class NotificationHandlerWrapper;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothA2dpConnectionState,
|
||||
nsString,
|
||||
BluetoothA2dpConnectionState,
|
||||
const nsAString&>
|
||||
ConnectionStateNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothA2dpAudioState,
|
||||
nsString,
|
||||
BluetoothA2dpAudioState,
|
||||
const nsAString&>
|
||||
AudioStateNotification;
|
||||
|
||||
class AudioStateInitOp;
|
||||
class ConnectionStateInitOp;
|
||||
|
||||
void ConnectionStateNtf(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU);
|
||||
|
||||
void AudioStateNtf(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU);
|
||||
|
||||
void HandleNtf(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU,
|
||||
void* aUserData);
|
||||
|
||||
static BluetoothA2dpNotificationHandler* sNotificationHandler;
|
||||
};
|
||||
|
||||
class BluetoothDaemonA2dpInterface MOZ_FINAL
|
||||
: public BluetoothA2dpInterface
|
||||
{
|
||||
class CleanupResultHandler;
|
||||
class InitResultHandler;
|
||||
|
||||
public:
|
||||
BluetoothDaemonA2dpInterface(BluetoothDaemonA2dpModule* aModule);
|
||||
~BluetoothDaemonA2dpInterface();
|
||||
|
||||
void Init(
|
||||
BluetoothA2dpNotificationHandler* aNotificationHandler,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
void Cleanup(BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
/* Connect / Disconnect */
|
||||
|
||||
void Connect(const nsAString& aBdAddr,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
void Disconnect(const nsAString& aBdAddr,
|
||||
BluetoothA2dpResultHandler* aRes);
|
||||
|
||||
private:
|
||||
void DispatchError(BluetoothA2dpResultHandler* aRes,
|
||||
BluetoothStatus aStatus);
|
||||
|
||||
BluetoothDaemonA2dpModule* mModule;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif
|
|
@ -97,6 +97,37 @@ Convert(uint8_t aIn, int& aOut)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut)
|
||||
{
|
||||
static const BluetoothA2dpAudioState sAudioState[] = {
|
||||
CONVERT(0x00, A2DP_AUDIO_STATE_REMOTE_SUSPEND),
|
||||
CONVERT(0x01, A2DP_AUDIO_STATE_STOPPED),
|
||||
CONVERT(0x02, A2DP_AUDIO_STATE_STARTED)
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aOut = sAudioState[aIn];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut)
|
||||
{
|
||||
static const BluetoothA2dpConnectionState sConnectionState[] = {
|
||||
CONVERT(0x00, A2DP_CONNECTION_STATE_DISCONNECTED),
|
||||
CONVERT(0x01, A2DP_CONNECTION_STATE_CONNECTING),
|
||||
CONVERT(0x02, A2DP_CONNECTION_STATE_CONNECTED),
|
||||
CONVERT(0x03, A2DP_CONNECTION_STATE_DISCONNECTING)
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aOut = sConnectionState[aIn];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothAclState& aOut)
|
||||
{
|
||||
|
@ -918,6 +949,20 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut)
|
|||
return UnpackPDU(aPDU, UnpackConversion<uint8_t, char>(aOut));
|
||||
}
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut)
|
||||
{
|
||||
return UnpackPDU(
|
||||
aPDU, UnpackConversion<uint8_t, BluetoothA2dpAudioState>(aOut));
|
||||
}
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut)
|
||||
{
|
||||
return UnpackPDU(
|
||||
aPDU, UnpackConversion<uint8_t, BluetoothA2dpConnectionState>(aOut));
|
||||
}
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,12 @@ Convert(uint8_t aIn, char& aOut);
|
|||
nsresult
|
||||
Convert(uint8_t aIn, int& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, BluetoothAclState& aOut);
|
||||
|
||||
|
@ -531,6 +537,12 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, bool& aOut);
|
|||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut);
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut);
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut);
|
||||
|
||||
nsresult
|
||||
UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothDaemonInterface.h"
|
||||
#include "BluetoothDaemonA2dpInterface.h"
|
||||
#include "BluetoothDaemonHandsfreeInterface.h"
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothDaemonSetupInterface.h"
|
||||
|
@ -1458,6 +1459,7 @@ class BluetoothDaemonProtocol MOZ_FINAL
|
|||
, public BluetoothDaemonCoreModule
|
||||
, public BluetoothDaemonSocketModule
|
||||
, public BluetoothDaemonHandsfreeModule
|
||||
, public BluetoothDaemonA2dpModule
|
||||
{
|
||||
public:
|
||||
BluetoothDaemonProtocol(BluetoothDaemonConnection* aConnection);
|
||||
|
@ -1491,6 +1493,8 @@ private:
|
|||
BluetoothDaemonPDU& aPDU, void* aUserData);
|
||||
void HandleHandsfreeSvc(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU, void* aUserData);
|
||||
void HandleA2dpSvc(const BluetoothDaemonPDUHeader& aHeader,
|
||||
BluetoothDaemonPDU& aPDU, void* aUserData);
|
||||
|
||||
BluetoothDaemonConnection* mConnection;
|
||||
nsTArray<void*> mUserDataQ;
|
||||
|
@ -1559,6 +1563,14 @@ BluetoothDaemonProtocol::HandleHandsfreeSvc(
|
|||
BluetoothDaemonHandsfreeModule::HandleSvc(aHeader, aPDU, aUserData);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonProtocol::HandleA2dpSvc(
|
||||
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
|
||||
void* aUserData)
|
||||
{
|
||||
BluetoothDaemonA2dpModule::HandleSvc(aHeader, aPDU, aUserData);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
|
||||
{
|
||||
|
@ -1573,7 +1585,9 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
|
|||
INIT_ARRAY_AT(0x03, nullptr), // HID host
|
||||
INIT_ARRAY_AT(0x04, nullptr), // PAN
|
||||
INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleHandsfreeSvc)
|
||||
&BluetoothDaemonProtocol::HandleHandsfreeSvc),
|
||||
INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleA2dpSvc)
|
||||
};
|
||||
|
||||
BluetoothDaemonPDUHeader header;
|
||||
|
@ -2158,7 +2172,13 @@ BluetoothDaemonInterface::GetBluetoothHandsfreeInterface()
|
|||
BluetoothA2dpInterface*
|
||||
BluetoothDaemonInterface::GetBluetoothA2dpInterface()
|
||||
{
|
||||
return nullptr;
|
||||
if (mA2dpInterface) {
|
||||
return mA2dpInterface;
|
||||
}
|
||||
|
||||
mA2dpInterface = new BluetoothDaemonA2dpInterface(mProtocol);
|
||||
|
||||
return mA2dpInterface;
|
||||
}
|
||||
|
||||
BluetoothAvrcpInterface*
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothDaemonChannel;
|
||||
class BluetoothDaemonA2dpInterface;
|
||||
class BluetoothDaemonHandsfreeInterface;
|
||||
class BluetoothDaemonProtocol;
|
||||
class BluetoothDaemonSocketInterface;
|
||||
|
@ -128,6 +129,7 @@ private:
|
|||
|
||||
nsAutoPtr<BluetoothDaemonSocketInterface> mSocketInterface;
|
||||
nsAutoPtr<BluetoothDaemonHandsfreeInterface> mHandsfreeInterface;
|
||||
nsAutoPtr<BluetoothDaemonA2dpInterface> mA2dpInterface;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
|
|
@ -51,6 +51,7 @@ if CONFIG['MOZ_B2G_BT']:
|
|||
'bluedroid/BluetoothA2dpHALInterface.cpp',
|
||||
'bluedroid/BluetoothA2dpManager.cpp',
|
||||
'bluedroid/BluetoothAvrcpHALInterface.cpp',
|
||||
'bluedroid/BluetoothDaemonA2dpInterface.cpp',
|
||||
'bluedroid/BluetoothDaemonHandsfreeInterface.cpp',
|
||||
'bluedroid/BluetoothDaemonHelpers.cpp',
|
||||
'bluedroid/BluetoothDaemonInterface.cpp',
|
||||
|
|
|
@ -10,14 +10,86 @@ const DEFAULT_PIN = "0000";
|
|||
// The puk code hard coded in emulator is "12345678".
|
||||
const DEFAULT_PUK = "12345678";
|
||||
|
||||
// Emulate Promise.jsm semantics.
|
||||
Promise.defer = function() { return new Deferred(); }
|
||||
function Deferred() {
|
||||
this.promise = new Promise(function(resolve, reject) {
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
}.bind(this));
|
||||
Object.freeze(this);
|
||||
const WHT = 0xFFFFFFFF;
|
||||
const BLK = 0x000000FF;
|
||||
const RED = 0xFF0000FF;
|
||||
const GRN = 0x00FF00FF;
|
||||
const BLU = 0x0000FFFF;
|
||||
const TSP = 0;
|
||||
|
||||
// Basic Image, see record number 1 in EFimg.
|
||||
const BASIC_ICON = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "basic",
|
||||
pixels: [WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT,
|
||||
BLK, BLK, BLK, BLK, BLK, BLK, WHT, WHT,
|
||||
WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
|
||||
WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
|
||||
WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
|
||||
WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
|
||||
WHT, WHT, BLK, BLK, BLK, BLK, WHT, WHT,
|
||||
WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT]
|
||||
};
|
||||
// Color Image, see record number 3 in EFimg.
|
||||
const COLOR_ICON = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "color",
|
||||
pixels: [BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU,
|
||||
BLU, RED, RED, RED, RED, RED, RED, BLU,
|
||||
BLU, RED, GRN, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, GRN, RED, BLU,
|
||||
BLU, RED, RED, RED, RED, RED, RED, BLU,
|
||||
BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU]
|
||||
};
|
||||
// Color Image with Transparency, see record number 5 in EFimg.
|
||||
const COLOR_TRANSPARENCY_ICON = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "color-transparency",
|
||||
pixels: [TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP,
|
||||
TSP, RED, RED, RED, RED, RED, RED, TSP,
|
||||
TSP, RED, GRN, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, GRN, RED, TSP,
|
||||
TSP, RED, RED, RED, RED, RED, RED, TSP,
|
||||
TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP]
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for checking stk icon.
|
||||
*/
|
||||
function isIcons(aIcons, aExpectedIcons) {
|
||||
is(aIcons.length, aExpectedIcons.length, "icons.length");
|
||||
for (let i = 0; i < aIcons.length; i++) {
|
||||
let icon = aIcons[i];
|
||||
let expectedIcon = aExpectedIcons[i];
|
||||
|
||||
is(icon.width, expectedIcon.width, "icon.width");
|
||||
is(icon.height, expectedIcon.height, "icon.height");
|
||||
is(icon.codingScheme, expectedIcon.codingScheme, "icon.codingScheme");
|
||||
|
||||
is(icon.pixels.length, expectedIcon.pixels.length);
|
||||
for (let j = 0; j < icon.pixels.length; j++) {
|
||||
is(icon.pixels[j], expectedIcon.pixels[j], "icon.pixels[" + j + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for checking stk text.
|
||||
*/
|
||||
function isStkText(aStkText, aExpectedStkText) {
|
||||
is(aStkText.text, aExpectedStkText.text, "stkText.text");
|
||||
if (aExpectedStkText.icons) {
|
||||
is(aStkText.iconSelfExplanatory, aExpectedStkText.iconSelfExplanatory,
|
||||
"stkText.iconSelfExplanatory");
|
||||
isIcons(aStkText.icons, aExpectedStkText.icons);
|
||||
}
|
||||
}
|
||||
|
||||
let _pendingEmulatorCmdCount = 0;
|
||||
|
@ -40,22 +112,35 @@ let _pendingEmulatorCmdCount = 0;
|
|||
* @return A deferred promise.
|
||||
*/
|
||||
function runEmulatorCmdSafe(aCommand) {
|
||||
let deferred = Promise.defer();
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
++_pendingEmulatorCmdCount;
|
||||
runEmulatorCmd(aCommand, function(aResult) {
|
||||
--_pendingEmulatorCmdCount;
|
||||
|
||||
++_pendingEmulatorCmdCount;
|
||||
runEmulatorCmd(aCommand, function(aResult) {
|
||||
--_pendingEmulatorCmdCount;
|
||||
|
||||
ok(true, "Emulator response: " + JSON.stringify(aResult));
|
||||
if (Array.isArray(aResult) &&
|
||||
aResult[aResult.length - 1] === "OK") {
|
||||
deferred.resolve(aResult);
|
||||
} else {
|
||||
deferred.reject(aResult);
|
||||
}
|
||||
ok(true, "Emulator response: " + JSON.stringify(aResult));
|
||||
if (Array.isArray(aResult) &&
|
||||
aResult[aResult.length - 1] === "OK") {
|
||||
aResolve(aResult);
|
||||
} else {
|
||||
aReject(aResult);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
/**
|
||||
* Send stk proactive pdu.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aPdu
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function sendEmulatorStkPdu(aPdu) {
|
||||
let cmd = "stk pdu " + aPdu;
|
||||
return runEmulatorCmdSafe(cmd);
|
||||
}
|
||||
|
||||
let workingFrame;
|
||||
|
@ -78,46 +163,44 @@ let iccManager;
|
|||
* @return A deferred promise.
|
||||
*/
|
||||
function ensureIccManager(aAdditionalPermissions) {
|
||||
let deferred = Promise.defer();
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
aAdditionalPermissions = aAdditionalPermissions || [];
|
||||
|
||||
aAdditionalPermissions = aAdditionalPermissions || [];
|
||||
if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
|
||||
aAdditionalPermissions.push("mobileconnection");
|
||||
}
|
||||
let permissions = [];
|
||||
for (let perm of aAdditionalPermissions) {
|
||||
permissions.push({ "type": perm, "allow": 1, "context": document });
|
||||
}
|
||||
|
||||
if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
|
||||
aAdditionalPermissions.push("mobileconnection");
|
||||
}
|
||||
let permissions = [];
|
||||
for (let perm of aAdditionalPermissions) {
|
||||
permissions.push({ "type": perm, "allow": 1, "context": document });
|
||||
}
|
||||
SpecialPowers.pushPermissions(permissions, function() {
|
||||
ok(true, "permissions pushed: " + JSON.stringify(permissions));
|
||||
|
||||
SpecialPowers.pushPermissions(permissions, function() {
|
||||
ok(true, "permissions pushed: " + JSON.stringify(permissions));
|
||||
// Permission changes can't change existing Navigator.prototype
|
||||
// objects, so grab our objects from a new Navigator.
|
||||
workingFrame = document.createElement("iframe");
|
||||
workingFrame.addEventListener("load", function load() {
|
||||
workingFrame.removeEventListener("load", load);
|
||||
|
||||
// Permission changes can't change existing Navigator.prototype
|
||||
// objects, so grab our objects from a new Navigator.
|
||||
workingFrame = document.createElement("iframe");
|
||||
workingFrame.addEventListener("load", function load() {
|
||||
workingFrame.removeEventListener("load", load);
|
||||
iccManager = workingFrame.contentWindow.navigator.mozIccManager;
|
||||
|
||||
iccManager = workingFrame.contentWindow.navigator.mozIccManager;
|
||||
if (iccManager) {
|
||||
ok(true, "navigator.mozIccManager is instance of " + iccManager.constructor);
|
||||
} else {
|
||||
ok(true, "navigator.mozIccManager is undefined");
|
||||
}
|
||||
|
||||
if (iccManager) {
|
||||
ok(true, "navigator.mozIccManager is instance of " + iccManager.constructor);
|
||||
} else {
|
||||
ok(true, "navigator.mozIccManager is undefined");
|
||||
}
|
||||
if (iccManager instanceof MozIccManager) {
|
||||
aResolve(iccManager);
|
||||
} else {
|
||||
aReject();
|
||||
}
|
||||
});
|
||||
|
||||
if (iccManager instanceof MozIccManager) {
|
||||
deferred.resolve(iccManager);
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
document.body.appendChild(workingFrame);
|
||||
});
|
||||
|
||||
document.body.appendChild(workingFrame);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,17 +276,15 @@ function setRadioEnabled(aEnabled, aServiceId) {
|
|||
* @return A deferred promise.
|
||||
*/
|
||||
function waitForTargetEvent(aEventTarget, aEventName, aMatchFun) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
aEventTarget.addEventListener(aEventName, function onevent(aEvent) {
|
||||
if (!aMatchFun || aMatchFun(aEvent)) {
|
||||
aEventTarget.removeEventListener(aEventName, onevent);
|
||||
ok(true, "Event '" + aEventName + "' got.");
|
||||
deferred.resolve(aEvent);
|
||||
}
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
aEventTarget.addEventListener(aEventName, function onevent(aEvent) {
|
||||
if (!aMatchFun || aMatchFun(aEvent)) {
|
||||
aEventTarget.removeEventListener(aEventName, onevent);
|
||||
ok(true, "Event '" + aEventName + "' got.");
|
||||
aResolve(aEvent);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let iccManager = navigator.mozIccManager;
|
||||
ok(iccManager instanceof MozIccManager,
|
||||
"iccManager is instanceof " + iccManager.constructor);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way to
|
||||
// check iccId and get icc object. But in multi-sim, the index of iccIds may
|
||||
// not map to sim slot directly, we should have a better way to handle this.
|
||||
let iccIds = iccManager.iccIds;
|
||||
ok(Array.isArray(iccIds), "iccIds is an array");
|
||||
ok(iccIds.length > 0, "iccIds.length is " + iccIds.length);
|
||||
|
||||
let iccId = iccIds[0];
|
||||
is(iccId, "89014103211118510720", "iccId is " + iccId);
|
||||
|
||||
let icc = iccManager.getIccById(iccId);
|
||||
ok(icc instanceof MozIcc, "icc is instanceof " + icc.constructor);
|
||||
|
||||
/* Remove permission and execute finish() */
|
||||
let cleanUp = function() {
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
};
|
||||
|
||||
/* Helper for tasks */
|
||||
let taskHelper = {
|
||||
tasks: [],
|
||||
|
||||
push: function(task) {
|
||||
this.tasks.push(task);
|
||||
},
|
||||
|
||||
runNext: function() {
|
||||
let task = this.tasks.shift();
|
||||
if (!task) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof task === "function") {
|
||||
task();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/* Helper for emulator console command */
|
||||
let emulatorHelper = {
|
||||
pendingCommandCount: 0,
|
||||
|
||||
sendCommand: function(cmd, callback) {
|
||||
this.pendingCommandCount++;
|
||||
runEmulatorCmd(cmd, function(result) {
|
||||
this.pendingCommandCount--;
|
||||
is(result[result.length - 1], "OK");
|
||||
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
|
@ -3,7 +3,6 @@ b2g = true
|
|||
browser = false
|
||||
qemu = true
|
||||
|
||||
[test_stk_proactive_command.js]
|
||||
[test_icc_contact.js]
|
||||
[test_icc_card_lock_get_retry_count.js]
|
||||
[test_icc_card_lock_change_pin.js]
|
||||
|
@ -28,6 +27,8 @@ qemu = true
|
|||
[test_stk_setup_menu.js]
|
||||
[test_stk_setup_idle_mode_text.js]
|
||||
[test_stk_bip_command.js]
|
||||
[test_stk_local_info.js]
|
||||
[test_stk_timer_management.js]
|
||||
[test_icc_access_invalid_object.js]
|
||||
[test_icc_detected_undetected_event.js]
|
||||
[test_icc_match_mvno.js]
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
const WHT = 0xFFFFFFFF;
|
||||
const BLK = 0x000000FF;
|
||||
const RED = 0xFF0000FF;
|
||||
const GRN = 0x00FF00FF;
|
||||
const BLU = 0x0000FFFF;
|
||||
const TSP = 0;
|
||||
|
||||
let iccManager = navigator.mozIccManager;
|
||||
ok(iccManager instanceof MozIccManager,
|
||||
"iccManager is instanceof " + iccManager.constructor);
|
||||
|
||||
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
|
||||
// multi-sim
|
||||
// In single sim scenario, there is only one sim card, we can use below way to
|
||||
// check iccId and get icc object. But in multi-sim, the index of iccIds may
|
||||
// not map to sim slot directly, we should have a better way to handle this.
|
||||
let iccIds = iccManager.iccIds;
|
||||
ok(Array.isArray(iccIds), "iccIds is an array");
|
||||
ok(iccIds.length > 0, "iccIds.length is " + iccIds.length);
|
||||
|
||||
let iccId = iccIds[0];
|
||||
is(iccId, "89014103211118510720", "iccId is " + iccId);
|
||||
|
||||
let icc = iccManager.getIccById(iccId);
|
||||
ok(icc instanceof MozIcc, "icc is instanceof " + icc.constructor);
|
||||
|
||||
|
||||
// Basic Image, see record number 1 in EFimg.
|
||||
let basicIcon = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "basic",
|
||||
pixels: [WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT,
|
||||
BLK, BLK, BLK, BLK, BLK, BLK, WHT, WHT,
|
||||
WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
|
||||
WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
|
||||
WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
|
||||
WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
|
||||
WHT, WHT, BLK, BLK, BLK, BLK, WHT, WHT,
|
||||
WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT]
|
||||
};
|
||||
// Color Image, see record number 3 in EFimg.
|
||||
let colorIcon = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "color",
|
||||
pixels: [BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU,
|
||||
BLU, RED, RED, RED, RED, RED, RED, BLU,
|
||||
BLU, RED, GRN, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, RED, RED, BLU,
|
||||
BLU, RED, RED, GRN, GRN, GRN, RED, BLU,
|
||||
BLU, RED, RED, RED, RED, RED, RED, BLU,
|
||||
BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU]
|
||||
};
|
||||
// Color Image with Transparency, see record number 5 in EFimg.
|
||||
let colorTransparencyIcon = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
codingScheme: "color-transparency",
|
||||
pixels: [TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP,
|
||||
TSP, RED, RED, RED, RED, RED, RED, TSP,
|
||||
TSP, RED, GRN, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, RED, RED, TSP,
|
||||
TSP, RED, RED, GRN, GRN, GRN, RED, TSP,
|
||||
TSP, RED, RED, RED, RED, RED, RED, TSP,
|
||||
TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP]
|
||||
};
|
||||
|
||||
function isIcons(icons, expectedIcons, message) {
|
||||
is(icons.length, expectedIcons.length, message);
|
||||
for (let i = 0; i < icons.length; i++) {
|
||||
let icon = icons[i];
|
||||
let expectedIcon = expectedIcons[i];
|
||||
|
||||
is(icon.width, expectedIcon.width, message);
|
||||
is(icon.height, expectedIcon.height, message);
|
||||
is(icon.codingScheme, expectedIcon.codingScheme, message);
|
||||
|
||||
is(icon.pixels.length, expectedIcon.pixels.length);
|
||||
for (let j = 0; j < icon.pixels.length; j++) {
|
||||
is(icon.pixels[j], expectedIcon.pixels[j], message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isStkText(stkText, expectedStkText, message) {
|
||||
is(stkText.text, expectedStkText.text, message);
|
||||
if (expectedStkText.icons) {
|
||||
is(stkText.iconSelfExplanatory, expectedStkText.iconSelfExplanatory, message);
|
||||
isIcons(stkText.icons, expectedStkText.icons, message);
|
||||
}
|
||||
}
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function(result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function(evt) {
|
||||
if (expect) {
|
||||
func(evt.command, expect);
|
||||
} else {
|
||||
func(evt.command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
|
@ -1,114 +1,101 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection);
|
||||
function testInvalidIccObject(aIcc) {
|
||||
// Test access iccInfo.
|
||||
try {
|
||||
is(aIcc.iccInfo, null, "iccInfo: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access iccInfo should not get exception");
|
||||
}
|
||||
|
||||
let request = connection.setRadioEnabled(enabled);
|
||||
// Test access cardState.
|
||||
try {
|
||||
is(aIcc.cardState, null, "cardState: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access cardState should not get exception");
|
||||
}
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
log('setRadioEnabled: ' + enabled);
|
||||
};
|
||||
// Test STK related function.
|
||||
try {
|
||||
aIcc.sendStkResponse({}, {});
|
||||
ok(false, "sendStkResponse() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.sendStkMenuSelection(0, false);
|
||||
ok(false, "sendStkMenuSelection() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.sendStkTimerExpiration({});
|
||||
ok(false, "sendStkTimerExpiration() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.sendStkEventDownload({});
|
||||
ok(false, "sendStkEventDownload() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "setRadioEnabled should be ok");
|
||||
};
|
||||
// Test card lock related function.
|
||||
try {
|
||||
aIcc.getCardLock("pin");
|
||||
ok(false, "getCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.unlockCardLock({});
|
||||
ok(false, "unlockCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.setCardLock({});
|
||||
ok(false, "setCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.getCardLockRetryCount("pin");
|
||||
ok(false, "getCardLockRetryCount() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test contact related function.
|
||||
try {
|
||||
aIcc.readContacts("adn");
|
||||
ok(false, "readContacts() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
aIcc.updateContact("adn", {});
|
||||
ok(false, "updateContact() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test mvno function.
|
||||
try {
|
||||
aIcc.matchMvno("imsi");
|
||||
ok(false, "matchMvno() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test service state function.
|
||||
return aIcc.getServiceState("fdn").then(() => {
|
||||
ok(false, "getServiceState() should be rejected");
|
||||
}, () => {});
|
||||
}
|
||||
|
||||
/* Test access invalid icc object */
|
||||
taskHelper.push(function testAccessRemovedIccObject() {
|
||||
setRadioEnabled(false);
|
||||
iccManager.addEventListener("iccundetected", function oniccundetected(evt) {
|
||||
log("got icc undetected event");
|
||||
iccManager.removeEventListener("iccundetected", oniccundetected);
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " becomes undetected");
|
||||
|
||||
// Test access iccInfo.
|
||||
try {
|
||||
is(icc.iccInfo, null, "iccInfo: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access iccInfo should not get exception");
|
||||
}
|
||||
|
||||
// Test access cardState.
|
||||
try {
|
||||
is(icc.cardState, null, "cardState: expect to get null");
|
||||
} catch(e) {
|
||||
ok(false, "access cardState should not get exception");
|
||||
}
|
||||
|
||||
// Test STK related function.
|
||||
try {
|
||||
icc.sendStkResponse({}, {});
|
||||
ok(false, "sendStkResponse() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkMenuSelection(0, false);
|
||||
ok(false, "sendStkMenuSelection() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkTimerExpiration({});
|
||||
ok(false, "sendStkTimerExpiration() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.sendStkEventDownload({});
|
||||
ok(false, "sendStkEventDownload() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test card lock related function.
|
||||
try {
|
||||
icc.getCardLock("");
|
||||
ok(false, "getCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.unlockCardLock({});
|
||||
ok(false, "unlockCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.setCardLock({});
|
||||
ok(false, "setCardLock() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.getCardLockRetryCount("");
|
||||
ok(false, "getCardLockRetryCount() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test contact related function.
|
||||
try {
|
||||
icc.readContacts("");
|
||||
ok(false, "readContacts() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.updateContact("", {});
|
||||
ok(false, "updateContact() should get exception");
|
||||
} catch(e) {}
|
||||
|
||||
// Test secure element related function.
|
||||
try {
|
||||
icc.iccOpenChannel("");
|
||||
ok(false, "iccOpenChannel() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.iccExchangeAPDU(0, {});
|
||||
ok(false, "iccExchangeAPDU() should get exception");
|
||||
} catch(e) {}
|
||||
try {
|
||||
icc.iccCloseChannel(0);
|
||||
ok(false, "iccCloseChannel() should get exception");
|
||||
} catch(e) {}
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
return Promise.resolve()
|
||||
// Turn off radio.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(false));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccundetected"));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
// Test accessing invalid icc object.
|
||||
.then(() => testInvalidIccObject(icc))
|
||||
// We should restore the radio status.
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(true));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccdetected"));
|
||||
return Promise.all(promises);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
|
|
@ -1,49 +1,32 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection);
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
let request = connection.setRadioEnabled(enabled);
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
log('setRadioEnabled: ' + enabled);
|
||||
};
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "setRadioEnabled should be ok");
|
||||
};
|
||||
}
|
||||
|
||||
/* Basic test */
|
||||
taskHelper.push(function basicTest() {
|
||||
// Basic test.
|
||||
is(icc.cardState, "ready", "card state is " + icc.cardState);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
|
||||
/* Test cardstatechange event by switching radio off */
|
||||
taskHelper.push(function testCardStateChange() {
|
||||
// Turn off radio.
|
||||
setRadioEnabled(false);
|
||||
icc.addEventListener("cardstatechange", function oncardstatechange() {
|
||||
log("card state changes to " + icc.cardState);
|
||||
// Expect to get card state changing to null.
|
||||
if (icc.cardState === null) {
|
||||
icc.removeEventListener("cardstatechange", oncardstatechange);
|
||||
// We should restore radio status and expect to get iccdetected event.
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("icc iccdetected: " + evt.iccId);
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
}
|
||||
});
|
||||
// Test cardstatechange event by switching radio off.
|
||||
return Promise.resolve()
|
||||
// Turn off radio and expect to get card state changing to null.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(false));
|
||||
promises.push(waitForTargetEvent(icc, "cardstatechange", function() {
|
||||
return icc.cardState === null;
|
||||
}));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
// Restore radio status and expect to get iccdetected event.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(true));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccdetected"));
|
||||
return Promise.all(promises);
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
|
|
@ -1,120 +1,81 @@
|
|||
/* 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 = "icc_header.js";
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const EMULATOR_ICCID = "89014103211118510720";
|
||||
function testReadContacts(aIcc, aType) {
|
||||
log("testReadContacts: type=" + aType);
|
||||
let iccId = aIcc.iccInfo.iccid;
|
||||
return aIcc.readContacts(aType)
|
||||
.then((aResult) => {
|
||||
is(Array.isArray(aResult), true);
|
||||
|
||||
function testReadContacts(type) {
|
||||
let request = icc.readContacts(type);
|
||||
request.onsuccess = function onsuccess() {
|
||||
let contacts = request.result;
|
||||
is(aResult[0].name[0], "Mozilla");
|
||||
is(aResult[0].tel[0].value, "15555218201");
|
||||
is(aResult[0].id, iccId + "1");
|
||||
|
||||
is(Array.isArray(contacts), true);
|
||||
is(aResult[1].name[0], "Saßê黃");
|
||||
is(aResult[1].tel[0].value, "15555218202");
|
||||
is(aResult[1].id, iccId + "2");
|
||||
|
||||
is(contacts[0].name[0], "Mozilla");
|
||||
is(contacts[0].tel[0].value, "15555218201");
|
||||
is(contacts[0].id, EMULATOR_ICCID + "1");
|
||||
is(aResult[2].name[0], "Fire 火");
|
||||
is(aResult[2].tel[0].value, "15555218203");
|
||||
is(aResult[2].id, iccId + "3");
|
||||
|
||||
is(contacts[1].name[0], "Saßê黃");
|
||||
is(contacts[1].tel[0].value, "15555218202");
|
||||
is(contacts[1].id, EMULATOR_ICCID + "2");
|
||||
|
||||
is(contacts[2].name[0], "Fire 火");
|
||||
is(contacts[2].tel[0].value, "15555218203");
|
||||
is(contacts[2].id, EMULATOR_ICCID + "3");
|
||||
|
||||
is(contacts[3].name[0], "Huang 黃");
|
||||
is(contacts[3].tel[0].value, "15555218204");
|
||||
is(contacts[3].id, EMULATOR_ICCID + "4");
|
||||
|
||||
taskHelper.runNext();
|
||||
};
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "Cannot get " + type + " contacts");
|
||||
taskHelper.runNext();
|
||||
};
|
||||
is(aResult[3].name[0], "Huang 黃");
|
||||
is(aResult[3].tel[0].value, "15555218204");
|
||||
is(aResult[3].id, iccId + "4");
|
||||
}, (aError) => {
|
||||
ok(false, "Cannot get " + aType + " contacts");
|
||||
});
|
||||
}
|
||||
|
||||
function testAddContact(type, pin2) {
|
||||
function testAddContact(aIcc, aType, aPin2) {
|
||||
log("testAddContact: type=" + aType + ", pin2=" + aPin2);
|
||||
let contact = new mozContact({
|
||||
name: ["add"],
|
||||
tel: [{value: "0912345678"}],
|
||||
email:[]
|
||||
});
|
||||
|
||||
let updateRequest = icc.updateContact(type, contact, pin2);
|
||||
return aIcc.updateContact(aType, contact, aPin2)
|
||||
.then((aResult) => {
|
||||
// Get ICC contact for checking new contact
|
||||
return aIcc.readContacts(aType)
|
||||
.then((aResult) => {
|
||||
// There are 4 SIM contacts which are harded in emulator
|
||||
is(aResult.length, 5);
|
||||
|
||||
updateRequest.onsuccess = function onsuccess() {
|
||||
let updatedContact = updateRequest.result;
|
||||
ok(updatedContact, "updateContact should have retuend a mozContact.");
|
||||
ok(updatedContact.id.startsWith(EMULATOR_ICCID),
|
||||
"The returned mozContact has wrong id.");
|
||||
|
||||
// Get ICC contact for checking new contact
|
||||
|
||||
let getRequest = icc.readContacts(type);
|
||||
|
||||
getRequest.onsuccess = function onsuccess() {
|
||||
let contacts = getRequest.result;
|
||||
|
||||
// There are 4 SIM contacts which are harded in emulator
|
||||
is(contacts.length, 5);
|
||||
|
||||
is(contacts[4].name[0], "add");
|
||||
is(contacts[4].tel[0].value, "0912345678");
|
||||
|
||||
taskHelper.runNext();
|
||||
};
|
||||
|
||||
getRequest.onerror = function onerror() {
|
||||
ok(false, "Cannot get " + type + " contacts: " + getRequest.error.name);
|
||||
taskHelper.runNext();
|
||||
};
|
||||
};
|
||||
|
||||
updateRequest.onerror = function onerror() {
|
||||
if (type === "fdn" && pin2 === undefined) {
|
||||
ok(updateRequest.error.name === "SimPin2",
|
||||
"expected error when pin2 is not provided");
|
||||
} else {
|
||||
ok(false, "Cannot add " + type + " contact: " + updateRequest.error.name);
|
||||
}
|
||||
taskHelper.runNext();
|
||||
};
|
||||
is(aResult[4].name[0], "add");
|
||||
is(aResult[4].tel[0].value, "0912345678");
|
||||
}, (aError) => {
|
||||
ok(false, "Cannot get " + aType + " contacts: " + aError.name);
|
||||
})
|
||||
}, (aError) => {
|
||||
if (aType === "fdn" && aPin2 === undefined) {
|
||||
ok(aError.name === "SimPin2",
|
||||
"expected error when pin2 is not provided");
|
||||
} else {
|
||||
ok(false, "Cannot add " + aType + " contact: " + aError.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Test read adn contacts */
|
||||
taskHelper.push(function testReadAdnContacts() {
|
||||
testReadContacts("adn");
|
||||
});
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
/* Test add adn contacts */
|
||||
taskHelper.push(function testAddAdnContact() {
|
||||
testAddContact("adn");
|
||||
// Test read adn contacts
|
||||
return testReadContacts(icc, "adn")
|
||||
// Test add adn contacts
|
||||
.then(() => testAddContact(icc, "adn"))
|
||||
// Test read fdn contact
|
||||
.then(() => testReadContacts(icc, "fdn"))
|
||||
// Test add fdn contacts
|
||||
.then(() => testAddContact(icc, "fdn", "0000"))
|
||||
// Test add fdn contacts without passing pin2
|
||||
.then(() => testAddContact(icc, "fdn"))
|
||||
// Test read sdn contacts
|
||||
.then(() => testReadContacts(icc, "sdn"));
|
||||
});
|
||||
|
||||
/* Test read fdn contacts */
|
||||
taskHelper.push(function testReadAdnContacts() {
|
||||
testReadContacts("fdn");
|
||||
});
|
||||
|
||||
/* Test add fdn contacts */
|
||||
taskHelper.push(function testReadAdnContacts() {
|
||||
testAddContact("fdn", "0000");
|
||||
});
|
||||
|
||||
/* Test add fdn contacts without passing pin2 */
|
||||
taskHelper.push(function testReadAdnContacts() {
|
||||
testAddContact("fdn");
|
||||
});
|
||||
|
||||
/* Test read sdn contacts */
|
||||
taskHelper.push(function testReadSdnContacts() {
|
||||
testReadContacts("sdn");
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
|
|
@ -1,67 +1,51 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
let origNumICCs = iccManager.iccIds.length;
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let origNumIccs = iccManager.iccIds.length;
|
||||
let icc = getMozIcc();
|
||||
let iccId = icc.iccInfo.iccid;
|
||||
let mobileConnection = getMozMobileConnectionByServiceId();
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection);
|
||||
return Promise.resolve()
|
||||
// Test iccundetected event.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
|
||||
let request = connection.setRadioEnabled(enabled);
|
||||
promises.push(setRadioEnabled(false));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccundetected").then((aEvt) => {
|
||||
is(aEvt.iccId, iccId, "icc " + aEvt.iccId + " becomes undetected");
|
||||
is(iccManager.iccIds.length, origNumIccs - 1,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
is(iccManager.getIccById(aEvt.iccId), null,
|
||||
"should not get a valid icc object here");
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
log('setRadioEnabled: ' + enabled);
|
||||
};
|
||||
// The mozMobileConnection.iccId should be in sync.
|
||||
is(mobileConnection.iccId, null, "check mozMobileConnection.iccId");
|
||||
}));
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "setRadioEnabled should be ok");
|
||||
};
|
||||
}
|
||||
return Promise.all(promises);
|
||||
})
|
||||
// Test iccdetected event.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
|
||||
/* Test iccundetected event */
|
||||
taskHelper.push(function testIccUndetectedEvent() {
|
||||
setRadioEnabled(false);
|
||||
iccManager.addEventListener("iccundetected", function oniccundetected(evt) {
|
||||
log("got icc undetected event");
|
||||
iccManager.removeEventListener("iccundetected", oniccundetected);
|
||||
promises.push(setRadioEnabled(true));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccdetected").then((aEvt) => {
|
||||
is(aEvt.iccId, iccId, "icc " + aEvt.iccId + " is detected");
|
||||
is(iccManager.iccIds.length, origNumIccs,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
ok(iccManager.getIccById(aEvt.iccId) instanceof MozIcc,
|
||||
"should get a valid icc object here");
|
||||
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " becomes undetected");
|
||||
is(iccManager.iccIds.length, origNumICCs - 1,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
is(iccManager.getIccById(evt.iccId), null,
|
||||
"should not get a valid icc object here");
|
||||
// The mozMobileConnection.iccId should be in sync.
|
||||
is(mobileConnection.iccId, iccId, "check mozMobileConnection.iccId");
|
||||
}));
|
||||
|
||||
// The mozMobileConnection.iccId should be in sync.
|
||||
is(navigator.mozMobileConnections[0].iccId, null,
|
||||
"check mozMobileConnection.iccId");
|
||||
|
||||
taskHelper.runNext();
|
||||
});
|
||||
return Promise.all(promises);
|
||||
});
|
||||
});
|
||||
|
||||
/* Test iccdetected event */
|
||||
taskHelper.push(function testIccDetectedEvent() {
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("got icc detected event");
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
|
||||
is(evt.iccId, iccId, "icc " + evt.iccId + " is detected");
|
||||
is(iccManager.iccIds.length, origNumICCs,
|
||||
"iccIds.length becomes to " + iccManager.iccIds.length);
|
||||
ok(iccManager.getIccById(evt.iccId) instanceof MozIcc,
|
||||
"should get a valid icc object here");
|
||||
|
||||
// The mozMobileConnection.iccId should be in sync.
|
||||
is(navigator.mozMobileConnections[0].iccId, iccId,
|
||||
"check mozMobileConnection.iccId");
|
||||
|
||||
taskHelper.runNext();
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
|
|
@ -1,35 +1,12 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
|
||||
function setRadioEnabled(enabled) {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection);
|
||||
|
||||
let request = connection.setRadioEnabled(enabled);
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
log('setRadioEnabled: ' + enabled);
|
||||
};
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "setRadioEnabled should be ok");
|
||||
};
|
||||
}
|
||||
|
||||
function setEmulatorMccMnc(mcc, mnc) {
|
||||
let cmd = "operator set 0 Android,Android," + mcc + mnc;
|
||||
emulatorHelper.sendCommand(cmd, function(result) {
|
||||
let re = new RegExp("" + mcc + mnc + "$");
|
||||
ok(result[0].match(re), "MCC/MNC should be changed.");
|
||||
});
|
||||
}
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
/* Basic test */
|
||||
taskHelper.push(function basicTest() {
|
||||
let iccInfo = icc.iccInfo;
|
||||
function basicTest(aIcc) {
|
||||
let iccInfo = aIcc.iccInfo;
|
||||
|
||||
// The emulator's hard coded iccid value.
|
||||
// See it here {B2G_HOME}/external/qemu/telephony/sim_card.c#L299.
|
||||
|
@ -44,42 +21,44 @@ taskHelper.push(function basicTest() {
|
|||
is(iccInfo.mcc, 310);
|
||||
is(iccInfo.mnc, 260);
|
||||
// Phone number is hardcoded in MSISDN
|
||||
// See {B2G_HOME}/external/qemu/telephony/sim_card.c, in asimcard_io()
|
||||
// See {B2G_HOME}/external/qemu/telephony/sim_card.c, in asimcard_io().
|
||||
is(iccInfo.msisdn, "15555215554");
|
||||
} else {
|
||||
log("Test Cdma IccInfo");
|
||||
is(iccInfo.iccType, "ruim");
|
||||
// MDN is hardcoded as "8587777777".
|
||||
// See it here {B2G_HOME}/hardware/ril/reference-ril/reference-ril.c,
|
||||
// in requestCdmaSubscription()
|
||||
// in requestCdmaSubscription().
|
||||
is(iccInfo.mdn, "8587777777");
|
||||
// PRL version is hardcoded as 1.
|
||||
// See it here {B2G_HOME}/hardware/ril/reference-ril/reference-ril.c,
|
||||
// in requestCdmaSubscription()
|
||||
// in requestCdmaSubscription().
|
||||
is(iccInfo.prlVersion, 1);
|
||||
}
|
||||
}
|
||||
|
||||
taskHelper.runNext();
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
return Promise.resolve()
|
||||
// Basic test
|
||||
.then(() => basicTest(icc))
|
||||
// Test iccInfo when card becomes undetected
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(false));
|
||||
promises.push(waitForTargetEvent(icc, "iccinfochange", function() {
|
||||
// Expect iccInfo changes to null
|
||||
return icc.iccInfo === null;
|
||||
}));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
// Restore radio status and expect to get iccdetected event.
|
||||
.then(() => {
|
||||
let promises = [];
|
||||
promises.push(setRadioEnabled(true));
|
||||
promises.push(waitForTargetEvent(iccManager, "iccdetected"));
|
||||
return Promise.all(promises);
|
||||
});
|
||||
});
|
||||
|
||||
/* Test iccInfo when card becomes undetected */
|
||||
taskHelper.push(function testCardIsNotReady() {
|
||||
// Turn off radio.
|
||||
setRadioEnabled(false);
|
||||
icc.addEventListener("iccinfochange", function oniccinfochange() {
|
||||
// Expect iccInfo changes to null
|
||||
if (icc.iccInfo === null) {
|
||||
icc.removeEventListener("iccinfochange", oniccinfochange);
|
||||
// We should restore radio status and expect to get iccdetected event.
|
||||
setRadioEnabled(true);
|
||||
iccManager.addEventListener("iccdetected", function oniccdetected(evt) {
|
||||
log("icc detected: " + evt.iccId);
|
||||
iccManager.removeEventListener("iccdetected", oniccdetected);
|
||||
taskHelper.runNext();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "icc_header.js";
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
let testCases = [
|
||||
const TEST_DATA = [
|
||||
// mvno type, mvno data, request success, expected result
|
||||
// Emulator's hard coded IMSI: 310260000000000
|
||||
["imsi", "3102600", true, true ],
|
||||
|
@ -31,36 +31,27 @@ let testCases = [
|
|||
["gid", "5a4d6c", true, false ]
|
||||
];
|
||||
|
||||
function matchMvno(mvnoType, mvnoData, success, expectedResult) {
|
||||
log("matchMvno: " + mvnoType + ", " + mvnoData);
|
||||
let request = icc.matchMvno(mvnoType, mvnoData);
|
||||
request.onsuccess = function onsuccess() {
|
||||
log("onsuccess: " + request.result);
|
||||
ok(success, "onsuccess while error expected");
|
||||
is(request.result, expectedResult);
|
||||
testMatchMvno();
|
||||
}
|
||||
request.onerror = function onerror() {
|
||||
log("onerror: " + request.error.name);
|
||||
ok(!success, "onerror while success expected");
|
||||
is(request.error.name, expectedResult);
|
||||
testMatchMvno();
|
||||
}
|
||||
function testMatchMvno(aIcc, aMvnoType, aMvnoData, aSuccess, aExpectedResult) {
|
||||
log("matchMvno: " + aMvnoType + ", " + aMvnoData);
|
||||
return aIcc.matchMvno(aMvnoType, aMvnoData)
|
||||
.then((aResult) => {
|
||||
log("onsuccess: " + aResult);
|
||||
ok(aSuccess, "onsuccess while error expected");
|
||||
is(aResult, aExpectedResult);
|
||||
}, (aError) => {
|
||||
log("onerror: " + aError.name);
|
||||
ok(!aSuccess, "onerror while success expected");
|
||||
is(aError.name, aExpectedResult);
|
||||
});
|
||||
}
|
||||
|
||||
function testMatchMvno() {
|
||||
let testCase = testCases.shift();
|
||||
if (!testCase) {
|
||||
taskHelper.runNext();
|
||||
return;
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testMatchMvno.apply(null, [icc].concat(data)));
|
||||
}
|
||||
matchMvno(testCase[0], testCase[1], testCase[2], testCase[3]);
|
||||
}
|
||||
|
||||
taskHelper.push(
|
||||
testMatchMvno
|
||||
);
|
||||
|
||||
// Start test
|
||||
taskHelper.runNext();
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,58 +1,65 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testBipCommand(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
|
||||
is(command.typeOfCommand, expect.typeOfCommand, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
// Open channel.
|
||||
{command: "d04f81030140018202818205074f70656e204944350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e0521010101019e020007",
|
||||
func: testBipCommand,
|
||||
expect: {name: "open_channel_1",
|
||||
typeOfCommand: iccManager.STK_CMD_OPEN_CHANNEL,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
|
||||
text: "Open ID",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon, colorTransparencyIcon]}},
|
||||
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
|
||||
{command: "d0448103014001820281820500350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101",
|
||||
func: testBipCommand,
|
||||
expect: {name: "open_channel_2",
|
||||
typeOfCommand: iccManager.STK_CMD_OPEN_CHANNEL,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
|
||||
text: ""}},
|
||||
{command: "d05381030140018202818205094f70656e2049442031350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101d004000900b4",
|
||||
func: testBipCommand,
|
||||
expect: {name: "open_channel_3",
|
||||
typeOfCommand: iccManager.STK_CMD_OPEN_CHANNEL,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
|
||||
text: "Open ID 1"}},
|
||||
// Close channel.
|
||||
{command: "d01b810301410082028121850a436c6f73652049442031d004000a00b4",
|
||||
func: testBipCommand,
|
||||
expect: {name: "close_channel_1",
|
||||
typeOfCommand: iccManager.STK_CMD_CLOSE_CHANNEL,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
|
||||
text: "Close ID 1"}},
|
||||
// Recive data.
|
||||
{command: "d022810301420082028121850e5265636569766520446174612031b701c8d004000e00b4",
|
||||
func: testBipCommand,
|
||||
expect: {name: "receive_data_1",
|
||||
typeOfCommand: iccManager.STK_CMD_RECEIVE_DATA,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
|
||||
text: "Receive Data 1"}},
|
||||
// Send data.
|
||||
{command: "d026810301430182028121850b53656e6420446174612031b6080001020304050607d004000b00b4",
|
||||
func: testBipCommand,
|
||||
expect: {name: "send_data_1",
|
||||
typeOfCommand: iccManager.STK_CMD_SEND_DATA,
|
||||
expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
|
||||
text: "Send Data 1"}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testBipCommand(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, aExpect.typeOfCommand, "typeOfCommand");
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("bip_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testBipCommand(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,119 +1,69 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testDisplayText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_DISPLAY_TEXT, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.userClear, expect.userClear, expect.name);
|
||||
is(command.options.isHighPriority, expect.isHighPriority, expect.name);
|
||||
|
||||
let duration = command.options.duration;
|
||||
if (duration) {
|
||||
is(duration.timeUnit, expect.duration.timeUnit, expect.name);
|
||||
is(duration.timeInterval, expect.duration.timeInterval, expect.name);
|
||||
}
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d01a8103012180820281028d0f04546f6f6c6b697420546573742031",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_1",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "Toolkit Test 1",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012181820281028d0f04546f6f6c6b697420546573742032",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_2",
|
||||
commandQualifier: 0x81,
|
||||
expect: {commandQualifier: 0x81,
|
||||
text: "Toolkit Test 2",
|
||||
isHighPriority: true,
|
||||
userClear: true}},
|
||||
{command: "d0198103012180820281028d0e00d4f79bbd4ed341d4f29c0e9a01",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_3",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "Toolkit Test 3",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012100820281028d0f04546f6f6c6b697420546573742034",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test 4"}},
|
||||
{command: "d081ad8103012180820281028d81a1045468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920612074657874206d6573736167652e20497420616c6c6f7773207468652053494d20746f20646566696e6520746865207072696f72697479206f662074686174206d6573736167652c20616e6420746865207465787420737472696e6720666f726d61742e2054776f207479706573206f66207072696f",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_5",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "This command instructs the ME to display a text message. It allows the SIM to define the priority of that message, and the text string format. Two types of prio",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012180820281028d0f043c474f2d4241434b57415244533e",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_6",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "<GO-BACKWARDS>",
|
||||
userClear: true}},
|
||||
{command: "d0248103012180820281028d1908041704140420041004120421042204120423041904220415",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_7",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "ЗДРАВСТВУЙТЕ",
|
||||
userClear: true}},
|
||||
{command: "d0108103012180820281028d05084f60597d",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_8",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "你好",
|
||||
userClear: true}},
|
||||
{command: "d0128103012180820281028d07080038003030eb",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_9",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "80ル",
|
||||
userClear: true}},
|
||||
{command: "d0288103012180820281020d1d00d3309bfc06c95c301aa8e80259c3ec34b9ac07c9602f58ed159bb940",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_10",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "Saldo 2.04 E. Validez 20/05/13. ",
|
||||
userClear: true}},
|
||||
{command: "d0198103012180820281028D0A043130205365636F6E648402010A",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_11",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "10 Second",
|
||||
userClear: true,
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
{command: "d01a8103012180820281028d0b0442617369632049636f6e9e020001",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_12",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
text: "Basic Icon",
|
||||
userClear: true,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "D026810301210082028102" +
|
||||
"8D" +
|
||||
"1B" +
|
||||
"00" + // 7BIT
|
||||
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
|
||||
"0E8687C158A09B304905",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x00, 7BIT"}},
|
||||
{command: "D029810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -121,9 +71,7 @@ let tests = [
|
|||
"04" + // 8BIT
|
||||
"546F6F6C6B697420546573742047524F" +
|
||||
"55503A307830302C2038424954",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x00, 8BIT"}},
|
||||
{command: "D046810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -133,9 +81,7 @@ let tests = [
|
|||
"0054006500730074002000470052004F" +
|
||||
"00550050003A0030007800300030002C" +
|
||||
"00200055004300530032",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x00, UCS2"}},
|
||||
{command: "D026810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -143,9 +89,7 @@ let tests = [
|
|||
"12" + // 7BIT + Class 2
|
||||
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
|
||||
"0E868FC158A09B304905",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x10, 7BIT"}},
|
||||
{command: "D029810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -153,9 +97,7 @@ let tests = [
|
|||
"16" + // 8BIT + Class 2
|
||||
"546F6F6C6B697420546573742047524F" +
|
||||
"55503A307831302C2038424954",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x10, 8BIT"}},
|
||||
{command: "D046810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -165,9 +107,7 @@ let tests = [
|
|||
"0054006500730074002000470052004F" +
|
||||
"00550050003A0030007800310030002C" +
|
||||
"00200055004300530032",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0x10, UCS2"}},
|
||||
{command: "D026810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -175,9 +115,7 @@ let tests = [
|
|||
"F2" + // 7BIT + Class 2
|
||||
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
|
||||
"0E8637C258A09B304905",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0xF0, 7BIT"}},
|
||||
{command: "D029810301210082028102" +
|
||||
"8D" +
|
||||
|
@ -185,9 +123,7 @@ let tests = [
|
|||
"F6" + // 8BIT + Class 2
|
||||
"546F6F6C6B697420546573742047524F" +
|
||||
"55503A307846302C2038424954",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test GROUP:0xF0, 8BIT"}},
|
||||
// Bug 1088573: this test case is to ensure that we provide |length| argument
|
||||
// in |integer| format to GsmPDUHelper.readSeptetsToString().
|
||||
|
@ -214,9 +150,7 @@ let tests = [
|
|||
"0C8287E5207619346D1E73A0783D0D9A" +
|
||||
"9FCA733A885C96BFEBEC32280C9A6689" +
|
||||
"CE621654768382D529551A64268B2E",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Ce message se compose de 273 caracteres en mode " +
|
||||
"compresse. Ce message est affiche sur plusieurs " +
|
||||
"ecrans et ne doit pas etre tronque. 273 est le " +
|
||||
|
@ -225,4 +159,48 @@ let tests = [
|
|||
"deroule a SYDNEY en AUSTRALIE."}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testDisplayText(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_DISPLAY_TEXT,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
is(aCommand.options.userClear, aExpect.userClear, "options.userClear");
|
||||
is(aCommand.options.isHighPriority, aExpect.isHighPriority,
|
||||
"options.isHighPriority");
|
||||
|
||||
if (aExpect.duration) {
|
||||
let duration = aCommand.options.duration;
|
||||
is(duration.timeUnit, aExpect.duration.timeUnit,
|
||||
"options.duration.timeUnit");
|
||||
is(duration.timeInterval, aExpect.duration.timeInterval,
|
||||
"options.duration.timeInterval");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("display_text_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testDisplayText(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,115 +1,106 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testGetInKey(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_GET_INKEY, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.options.isAlphabet, expect.isAlphabet, expect.name);
|
||||
is(command.options.isUCS2, expect.isUCS2, expect.name);
|
||||
is(command.options.isYesNoRequested, expect.isYesNoRequested, expect.name);
|
||||
|
||||
let duration = command.options.duration;
|
||||
if (duration) {
|
||||
is(duration.timeUnit, expect.duration.timeUnit, expect.name);
|
||||
is(duration.timeInterval, expect.duration.timeInterval, expect.name);
|
||||
}
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d0158103012200820281828d0a04456e74657220222b22",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter \"+\""}},
|
||||
{command: "d0148103012200820281828d09004537bd2c07896022",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter \"0\""}},
|
||||
{command: "d01a8103012200820281828d0f043c474f2d4241434b57415244533e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<GO-BACKWARDS>"}},
|
||||
{command: "d0138103012200820281828d08043c41424f52543e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<ABORT>"}},
|
||||
{command: "d0158103012201820281828d0a04456e74657220227122",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_5",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "Enter \"q\"",
|
||||
isAlphabet: true}},
|
||||
{command: "d081ad8103012201820281828d81a104456e746572202278222e205468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920746578742c20616e6420746f2065787065637420746865207573657220746f20656e74657220612073696e676c65206368617261637465722e20416e7920726573706f6e736520656e7465726564206279207468652075736572207368616c6c206265207061737365642074",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_6",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "Enter \"x\". This command instructs the ME to display text, and to expect the user to enter a single character. Any response entered by the user shall be passed t",
|
||||
isAlphabet: true}},
|
||||
{command: "d0168103012200820281828d0b043c54494d452d4f55543e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<TIME-OUT>"}},
|
||||
{command: "d0248103012200820281828d1908041704140420041004120421042204120423041904220415",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d081998103012200820281828d818d080417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ"}},
|
||||
{command: "d0118103012203820281828d0604456e746572",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_10",
|
||||
commandQualifier: 0x03,
|
||||
expect: {commandQualifier: 0x03,
|
||||
text: "Enter",
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d0158103012204820281828d0a04456e74657220594553",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_11",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
text: "Enter YES",
|
||||
isYesNoRequested: true}},
|
||||
{command: "d0148103012204820281828d0904456e746572204e4f",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_12",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
text: "Enter NO",
|
||||
isYesNoRequested: true}},
|
||||
{command: "d0198103012200820281828d0a043c4e4f2d49434f4e3e1e020002",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
// The record number 02 in EFimg is not defined, so no icon will be
|
||||
// shown, but the text string should still be displayed.
|
||||
text: "<NO-ICON>"}},
|
||||
{command: "D0198103012200820281828D0A04456E74657220222B228402010A",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter \"+\"",
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testGetInKey(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INKEY, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
|
||||
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
|
||||
is(aCommand.options.isYesNoRequested, aExpect.isYesNoRequested,
|
||||
"options.isYesNoRequested");
|
||||
|
||||
if (aExpect.duration) {
|
||||
let duration = aCommand.options.duration;
|
||||
is(duration.timeUnit, aExpect.duration.timeUnit,
|
||||
"options.duration.timeUnit");
|
||||
is(duration.timeInterval, aExpect.duration.timeInterval,
|
||||
"options.duration.timeInterval");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("get_inkey_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testGetInKey(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,183 +1,169 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testGetInput(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_GET_INPUT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.options.minLength, expect.minLength, expect.name);
|
||||
is(command.options.maxLength, expect.maxLength, expect.name);
|
||||
if (command.options.defaultText) {
|
||||
is(command.options.defaultText, expect.defaultText, expect.name);
|
||||
}
|
||||
if (command.options.isAlphabet) {
|
||||
is(command.options.isAlphabet, expect.isAlphabet, expect.name);
|
||||
}
|
||||
if (command.options.isUCS2) {
|
||||
is(command.options.isUCS2, expect.isUCS2, expect.name);
|
||||
}
|
||||
if (command.options.isPacked) {
|
||||
is(command.options.isPacked, expect.isPacked, expect.name);
|
||||
}
|
||||
if (command.options.hideInput) {
|
||||
is(command.options.hideInput, expect.hideInput, expect.name);
|
||||
}
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d01b8103012300820281828d0c04456e74657220313233343591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter 12345",
|
||||
minLength: 5,
|
||||
maxLength: 5}},
|
||||
{command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_2",
|
||||
commandQualifier: 0x08,
|
||||
expect: {commandQualifier: 0x08,
|
||||
text: "Enter 67*#+",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isPacked: true}},
|
||||
{command: "d01b8103012301820281828d0c04456e74657220416243644591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_3",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "Enter AbCdE",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_4",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
text: "Password 1<SEND>2345678",
|
||||
minLength: 4,
|
||||
maxLength: 8,
|
||||
hideInput: true}},
|
||||
{command: "d0248103012300820281828d1504456e74657220312e2e392c302e2e392c3028312991020114",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter 1..9,0..9,0(1)",
|
||||
minLength: 1,
|
||||
maxLength: 20}},
|
||||
{command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<GO-BACKWARDS>",
|
||||
minLength: 0,
|
||||
maxLength: 8}},
|
||||
{command: "d0178103012300820281828d08043c41424f52543e91020008",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<ABORT>",
|
||||
minLength: 0,
|
||||
maxLength: 8}},
|
||||
{command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###",
|
||||
minLength: 160,
|
||||
maxLength: 160}},
|
||||
{command: "d0168103012300820281828d07043c53454e443e91020001",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<SEND>",
|
||||
minLength: 0,
|
||||
maxLength: 1}},
|
||||
{command: "d01a8103012300820281828d0b043c54494d452d4f55543e9102000a",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<TIME-OUT>",
|
||||
minLength: 0,
|
||||
maxLength: 10}},
|
||||
{command: "d0288103012301820281828d190804170414042004100412042104220412042304190422041591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_11",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "ЗДРАВСТВУЙТЕ",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_12",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f91020c0c",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_13",
|
||||
commandQualifier: 0x03,
|
||||
expect: {commandQualifier: 0x03,
|
||||
text: "Enter Hello",
|
||||
minLength: 12,
|
||||
maxLength: 12,
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_14",
|
||||
commandQualifier: 0x03,
|
||||
expect: {commandQualifier: 0x03,
|
||||
text: "Enter Hello",
|
||||
minLength: 5,
|
||||
maxLength: 0xFF,
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d0238103012300820281828d0c04456e746572203132333435910205051706043132333435",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter 12345",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
defaultText: "12345"}},
|
||||
{command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Enter:",
|
||||
minLength: 160,
|
||||
maxLength: 160,
|
||||
defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}},
|
||||
{command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020002",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
// The record number 02 in EFimg is not defined, so no icon will be
|
||||
// shown, but the text string should still be displayed.
|
||||
text: "<NO-ICON>",
|
||||
minLength: 0,
|
||||
maxLength: 10}},
|
||||
{command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "<BASIC-ICON>",
|
||||
minLength: 0,
|
||||
maxLength: 10,
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testGetInput(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INPUT, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
is(aCommand.options.minLength, aExpect.minLength, "options.minLength");
|
||||
is(aCommand.options.maxLength, aExpect.maxLength, "options.maxLength");
|
||||
|
||||
if (aExpect.defaultText) {
|
||||
is(aCommand.options.defaultText, aExpect.defaultText, "options.defaultText");
|
||||
}
|
||||
|
||||
if (aExpect.isAlphabet) {
|
||||
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
|
||||
}
|
||||
|
||||
if (aExpect.isUCS2) {
|
||||
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
|
||||
}
|
||||
|
||||
if (aExpect.isPacked) {
|
||||
is(aCommand.options.isPacked, aExpect.isPacked, "options.isPacked");
|
||||
}
|
||||
|
||||
if (aExpect.hideInput) {
|
||||
is(aCommand.options.hideInput, aExpect.hideInput, "options.hideInput");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("get_input_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testGetInput(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,267 +1,208 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testLaunchBrowser(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_LAUNCH_BROWSER, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.url, expect.url, expect.name);
|
||||
if (expect.confirmMessage) {
|
||||
isStkText(command.options.confirmMessage, expect.confirmMessage, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d0188103011500820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL" }}},
|
||||
{command: "d01f8103011500820281823112687474703a2f2f7878782e7979792e7a7a7a0500",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "http://xxx.yyy.zzz",
|
||||
confirmMessage: { text: "" }}},
|
||||
{command: "d00e8103011500820281823001003100",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: ""}},
|
||||
{command: "d0208103011500820281823100320103" +
|
||||
"0d10046162632e6465662e6768692e6a6b6c", // "0D" String TLV is useless for Launch Browser.
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: ""}},
|
||||
{command: "d0188103011502820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_5",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL" }}},
|
||||
{command: "d0188103011503820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_6",
|
||||
commandQualifier: 0x03,
|
||||
expect: {commandQualifier: 0x03,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL"}}},
|
||||
{command: "d00b8103011500820281823100",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: ""}},
|
||||
{command: "d0268103011502820281823100051980041704140420041004120421042204120423041904220415",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_8",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "ЗДРАВСТВУЙТЕ" }}},
|
||||
{command: "d021810301150282028182310005104e6f742073656c66206578706c616e2e1e020101",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_9",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "Not self explan.",
|
||||
iconSelfExplanatory: false,
|
||||
icons : [basicIcon] }
|
||||
icons : [BASIC_ICON] }
|
||||
}},
|
||||
{command: "d01d8103011502820281823100050c53656c66206578706c616e2e1e020001",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_10",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "Self explan.",
|
||||
iconSelfExplanatory: true,
|
||||
icons : [basicIcon] }
|
||||
icons : [BASIC_ICON] }
|
||||
}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d01b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d02b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d04b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d04b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d08b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d08b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d10b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d10b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d20b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d20b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d40b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d40b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d80b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d80b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 3" }}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 1" }}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { text: "Default URL 2" }}},
|
||||
{command: "d01281030115028202818231000505804f60597d",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_37",
|
||||
commandQualifier: 0x02,
|
||||
{command: "d01281030115028202818231000505804f60597d",
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "你好" }}},
|
||||
{command: "d010810301150282028182310005038030eb",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_38",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
url: "",
|
||||
confirmMessage: { text: "ル" }}},
|
||||
{command: "d01281030115008202818230010031001e020001",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { iconSelfExplanatory: true,
|
||||
icons: [basicIcon] }}},
|
||||
icons: [BASIC_ICON] }}},
|
||||
{command: "d01281030115008202818230010031001e020003",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
url: "",
|
||||
confirmMessage: { iconSelfExplanatory: true,
|
||||
icons: [colorIcon] }}},
|
||||
icons: [COLOR_ICON] }}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testLaunchBrowser(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_LAUNCH_BROWSER,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.url, aExpect.url, "options.url");
|
||||
|
||||
if (aExpect.confirmMessage) {
|
||||
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage,
|
||||
"options.confirmMessage");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("launch_browser_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testLaunchBrowser(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// Location
|
||||
{command: "d009810301260082028182",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO}},
|
||||
// Imei
|
||||
{command: "d009810301260182028182",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI}},
|
||||
// Data
|
||||
{command: "d009810301260382028182",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE}},
|
||||
// Language
|
||||
{command: "d009810301260482028182",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE}},
|
||||
];
|
||||
|
||||
function testLocalInfo(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.localInfoType, aExpect.localInfoType, "options.localInfoType");
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("local_info_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testLocalInfo(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -1,21 +1,37 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testPollOff(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_POLL_OFF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d009810301040082028182",
|
||||
func: testPollOff,
|
||||
expect: {name: "pull_off_cmd_1",
|
||||
commandQualifier: 0x00}}
|
||||
expect: {commandQualifier: 0x00}}
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testPollOff(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_OFF, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("pull_off_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testPollOff(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
|
||||
function testLocalInfoLocation(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoImei(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoDate(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testLocalInfoLanguage(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE);
|
||||
is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testRefresh(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, 0x01);
|
||||
is(cmd.options, null);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testTimerManagementStart(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_START);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_START);
|
||||
is(cmd.options.timerId, 0x01);
|
||||
is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testTimerManagementDeactivate(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE);
|
||||
is(cmd.options.timerId, 0x04);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function testTimerManagementGetCurrentValue(cmd) {
|
||||
log("STK CMD " + JSON.stringify(cmd));
|
||||
is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT);
|
||||
is(cmd.commandNumber, 0x01);
|
||||
is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE);
|
||||
is(cmd.options.timerId, 0x08);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d009810301260082028182",
|
||||
func: testLocalInfoLocation},
|
||||
{command: "d009810301260182028182",
|
||||
func: testLocalInfoImei},
|
||||
{command: "d009810301260382028182",
|
||||
func: testLocalInfoDate},
|
||||
{command: "d009810301260482028182",
|
||||
func: testLocalInfoLanguage},
|
||||
{command: "d011810301270082028182a40101a503102030",
|
||||
func: testTimerManagementStart},
|
||||
{command: "d00c810301270182028182a40104",
|
||||
func: testTimerManagementDeactivate},
|
||||
{command: "d00c810301270282028182a40108",
|
||||
func: testTimerManagementGetCurrentValue},
|
||||
];
|
||||
|
||||
runNextTest();
|
|
@ -1,25 +1,39 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testRefresh(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_REFRESH, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d0108103010101820281829205013f002fe2",
|
||||
func: testRefresh,
|
||||
expect: {name: "refresh_cmd_1",
|
||||
commandQualifier: 0x01}},
|
||||
expect: {commandQualifier: 0x01}},
|
||||
{command: "d009810301010482028182",
|
||||
func: testRefresh,
|
||||
expect: {name: "refresh_cmd_2",
|
||||
commandQualifier: 0x04}}
|
||||
expect: {commandQualifier: 0x04}}
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testRefresh(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_REFRESH, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("refresh_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testRefresh(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,347 +1,270 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSelectItem(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SELECT_ITEM, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
|
||||
is(command.options.items[index].text, expect.items[index].text, expect.name);
|
||||
|
||||
let itemIcons = command.options.items[index].icons;
|
||||
if (itemIcons) {
|
||||
isIcons(itemIcons, expect.items[index].icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.items[index].iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.items[index].iconSelfExplanatory, expect.name);
|
||||
}
|
||||
}
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
let length = command.options.nextActionList ? command.options.nextActionList.length : 0;
|
||||
for (let i = 0; i < length; i++) {
|
||||
is(command.options.nextActionList[i], expect.nextActionList[i], expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d03d810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d081fc810301240082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "LargeMenu1",
|
||||
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
|
||||
{command: "d081fb810301240082028182850a4c617267654d656e75328f1eff43616c6c20466f7277617264696e6720556e636f6e646974696f6e616c8f1dfe43616c6c20466f7277617264696e67204f6e205573657220427573798f1cfd43616c6c20466f7277617264696e67204f6e204e6f205265706c798f26fc43616c6c20466f7277617264696e67204f6e2055736572204e6f7420526561636861626c658f1efb42617272696e67204f6620416c6c204f7574676f696e672043616c6c738f2cfa42617272696e67204f6620416c6c204f7574676f696e6720496e7465726e6174696f6e616c2043616c6c738f11f9434c492050726573656e746174696f6e",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "LargeMenu2",
|
||||
items: [{identifier: 255, text: "Call Forwarding Unconditional"}, {identifier: 254, text: "Call Forwarding On User Busy"}, {identifier: 253, text: "Call Forwarding On No Reply"}, {identifier: 252, text: "Call Forwarding On User Not Reachable"}, {identifier: 251, text: "Barring Of All Outgoing Calls"}, {identifier: 250, text: "Barring Of All Outgoing International Calls"}, {identifier: 249, text: "CLI Presentation"}]}},
|
||||
{command: "d022810301240082028182850b53656c656374204974656d8f04114f6e658f041254776f",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Select Item",
|
||||
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
|
||||
{command: "d081fd8103012400820281828581ed5468652053494d207368616c6c20737570706c79206120736574206f66206974656d732066726f6d207768696368207468652075736572206d61792063686f6f7365206f6e652e2045616368206974656d20636f6d70726973657320612073686f7274206964656e74696669657220287573656420746f20696e646963617465207468652073656c656374696f6e2920616e642061207465787420737472696e672e204f7074696f6e616c6c79207468652053494d206d617920696e636c75646520616e20616c706861206964656e7469666965722e2054686520616c706861206964656e74696669657220698f020159",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "The SIM shall supply a set of items from which the user may choose one. Each item comprises a short identifier (used to indicate the selection) and a text string. Optionally the SIM may include an alpha identifier. The alpha identifier i",
|
||||
items: [{identifier: 1, text: "Y"}]}},
|
||||
{command: "d081f3810301240082028182850a304c617267654d656e758f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "0LargeMenu",
|
||||
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
|
||||
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803131026",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
|
||||
nextActionList: [iccManager.STK_CMD_SEND_SMS, iccManager.STK_CMD_SET_UP_CALL, iccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
|
||||
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
|
||||
{command: "d037810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033900102",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301248082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_9",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401030303",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [colorIcon]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [colorIcon]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [colorIcon]}]}},
|
||||
icons: [BASIC_ICON],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
|
||||
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [colorTransparencyIcon]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [colorTransparencyIcon]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [colorTransparencyIcon]}]}},
|
||||
icons: [BASIC_ICON],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
|
||||
{command: "d034810301240382028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_12",
|
||||
commandQualifier: 0x03,
|
||||
expect: {commandQualifier: 0x03,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301240182028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_13",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d02b810301240482028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d2032",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_14",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d030810301240082028182850a3c54494d452d4f55543e8f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "<TIME-OUT>",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001001b4d108000601b4000601b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001002b4d108000602b4000602b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001004b4d108000604b4000604b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001008b4d108000608b4000608b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001010b4d108000610b4000610b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001020b4d108000620b4000620b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001040b4d108000640b4000640b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001080b4d108000680b4000680b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_38",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_41",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d07e8103012400820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c03800417041404200410041204210422041204230419042204150033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_42",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d053810301240082028182850f810c089794a09092a1a292a399a2958f1101810d089794a09092a1a292a399a295318f1102810d089794a09092a1a292a399a295328f1103810d089794a09092a1a292a399a29533",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_43",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d0578103012400820281828510820c04108784908082919282938992858f1201820d0410878490808291928293899285318f1202820d0410878490808291928293899285328f1203820d041087849080829192829389928533",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_44",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d03e810301240082028182850b805de551777bb1900962e98f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_45",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "工具箱选择",
|
||||
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
|
||||
{command: "d0388103012400820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb0033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_46",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}]}},
|
||||
{command: "d03081030124008202818285078104613831eb308f08018104613831eb318f08028104613831eb328f08038104613831eb33",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_47",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "81ル0",
|
||||
items: [{identifier: 1, text: "81ル1"}, {identifier: 2, text: "81ル2"}, {identifier: 3, text: "81ル3"}]}},
|
||||
{command: "d0348103012400820281828508820430a03832cb308f0901820430a03832cb318f0902820430a03832cb328f0903820430a03832cb33",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_48",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "82ル0",
|
||||
items: [{identifier: 1, text: "82ル1"}, {identifier: 2, text: "82ル2"}, {identifier: 3, text: "82ル3"}]}},
|
||||
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803000081",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_49",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
|
||||
nextActionList: [iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION]}},
|
||||
nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION]}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSelectItem(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SELECT_ITEM, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.title, aExpect.title, "options.title");
|
||||
|
||||
for (let index in aExpect.items) {
|
||||
let item = aCommand.options.items[index];
|
||||
let itemExpect = aExpect.items[index];
|
||||
is(item.identifier, itemExpect.identifier,
|
||||
"options.items[" + index + "].identifier");
|
||||
is(item.text, itemExpect.text,
|
||||
"options.items[" + index + "].text");
|
||||
|
||||
if (itemExpect.icons) {
|
||||
isIcons(item.icons, itemExpect.icons);
|
||||
is(item.iconSelfExplanatory, itemExpect.iconSelfExplanatory,
|
||||
"options.items[" + index + "].iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
|
||||
if (aExpect.nextActionList) {
|
||||
for (let index in aExpect.nextActionList) {
|
||||
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
|
||||
"options.nextActionList[" + index + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("select_item_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSelectItem(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,195 +1,138 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSendDTMF(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_DTMF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_1_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF"}},
|
||||
{command: "d010810301140082028183ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_1_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0138103011400820281838500ac06c1cccccccc2c",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_2_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: ""}},
|
||||
{command: "d011810301140082028183ac06c1cccccccc2c",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_2_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d01d810301140082028183850a42617369632049636f6eac02c1f29e020001",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_3_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Basic Icon",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d011810301140082028183ac02c1f29e020005",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_3_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorTransparencyIcon]}},
|
||||
icons: [COLOR_TRANSPARENCY_ICON]}},
|
||||
{command: "d01c810301140082028183850953656e642044544d46ac02c1f29e020101",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_4_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d011810301140082028183ac02c1f29e020105",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_4_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: false,
|
||||
icons: [colorTransparencyIcon]}},
|
||||
icons: [COLOR_TRANSPARENCY_ICON]}},
|
||||
{command: "d028810301140082028183851980041704140420041004120421042204120423041904220415ac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_5_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d00d810301140082028183ac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_5_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_6_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_6_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_7_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
// send_dtmf_cmd_7_without_alpha_identifier has the same pdu as
|
||||
// send_dtmf_cmd_1_without_alpha_identifier.
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b01b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_8_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b01b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_8_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d00400b002b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_9_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d00400b002b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_9_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b04b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_10_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b04b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_10_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_11_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
// send_dtmf_cmd_11_without_alpha_identifier has the same pdu as
|
||||
// send_dtmf_cmd_6_without_alpha_identifier.
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_12_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
// send_dtmf_cmd_12_without_alpha_identifier has the same pdu as
|
||||
// send_dtmf_cmd_1_without_alpha_identifier.
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b08b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_13_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b08b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_13_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b10b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_14_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b10b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_14_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b20b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_15_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b20b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_15_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b40b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_16_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b40b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_16_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b80b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_17_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d016810301140082028183ac052143658709d004000b80b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_17_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0148103011400820281838505804f60597dac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_18_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
// send_dtmf_cmd_18_without_alpha_identifier has the same pdu as
|
||||
// send_dtmf_cmd_5_without_alpha_identifier.
|
||||
{command: "d01281030114008202818385038030ebac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_19_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ル"}}
|
||||
// send_dtmf_cmd_19_without_alpha_identifier has the same pdu as
|
||||
// send_dtmf_cmd_5_without_alpha_identifier.
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSendDTMF(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
|
||||
if (aExpect.text) {
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("send_dtmf_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSendDTMF(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,281 +1,185 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSendSMS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_SMS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d037810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_1_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Send SM"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send SM"}},
|
||||
{command: "d02e81030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_1_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d032810301130182028183850753656e6420534d86099111223344556677f88b130100099110325476f840f40753656e6420534d",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_2_with_alpha_identifier",
|
||||
commandQualifier: 0x01,
|
||||
title: "Send SM"}},
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "Send SM"}},
|
||||
{command: "d02981030113018202818386099111223344556677f88b130100099110325476f840f40753656e6420534d",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_2_without_alpha_identifier",
|
||||
commandQualifier: 0x01}},
|
||||
expect: {commandQualifier: 0x01}},
|
||||
{command: "d03d810301130082028183850d53686f7274204d65737361676586099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_3_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Short Message"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Short Message"}},
|
||||
{command: "d02e81030113008202818386099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_3_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d081fd810301130182028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052501144657374696e6174696f6e114164647265737386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_4_with_alpha_identifier",
|
||||
commandQualifier: 0x01,
|
||||
title: "The address data object holds the RP_Destination_Address"}},
|
||||
expect: {commandQualifier: 0x01,
|
||||
text: "The address data object holds the RP_Destination_Address"}},
|
||||
{command: "d081c381030113018202818386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_4_without_alpha_identifier",
|
||||
commandQualifier: 0x01}},
|
||||
expect: {commandQualifier: 0x01}},
|
||||
{command: "d081e9810301130082028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052502044657374696e6174696f6e204164647265737386099111223344556677f88b81980100099110325476f840f0a0d4fb1b44cfc3cb7350585e0691cbe6b4bb4cd6815aa020688e7ecbe9a076793e0f9fcb20fa1b242e83e665371d447f83e8e832c85da6dfdff23528ed0685dda06973da9a5685cd2415d42ecfe7e17399057acb41613768da9cb686cf6633e82482dae5f93c7c2eb3407774595e06d1d165507d5e9683c8617a18340ebb41e232081e9ecfcb64105d1e76cfe1",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_5_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "The address data object holds the RP Destination Address"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "The address data object holds the RP Destination Address"}},
|
||||
{command: "d081af81030113008202818386099111223344556677f88b81980100099110325476f840f0a0d4fb1b44cfc3cb7350585e0691cbe6b4bb4cd6815aa020688e7ecbe9a076793e0f9fcb20fa1b242e83e665371d447f83e8e832c85da6dfdff23528ed0685dda06973da9a5685cd2415d42ecfe7e17399057acb41613768da9cb686cf6633e82482dae5f93c7c2eb3407774595e06d1d165507d5e9683c8617a18340ebb41e232081e9ecfcb64105d1e76cfe1",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_5_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d081fd8103011300820281838581e654776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e73706172656e746c793b202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954208b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_6_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Two types are defined: - A short message to be sent to the network in an SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can be passed transparently; - A short message to be sent to the network in an SMS-SUBMIT "}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Two types are defined: - A short message to be sent to the network in an SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can be passed transparently; - A short message to be sent to the network in an SMS-SUBMIT "}},
|
||||
{command: "d0148103011300820281838b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_6_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d030810301130082028183850086099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_7_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
// send_sms_cmd_7_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: ""}},
|
||||
{command: "d05581030113008202818385198004170414042004100412042104220412042304190422041586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_8_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d03a81030113008202818386099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_8_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d04b810301130082028183850f810c089794a09092a1a292a399a29586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_9_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
// send_sms_cmd_9_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_8_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d03b81030113008202818385074e4f2049434f4e86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020002",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_10_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
// The record number 02 in EFimg is not defined, so no icon will be
|
||||
// shown, but the text string should still be displayed.
|
||||
title: "NO ICON"}},
|
||||
text: "NO ICON"}},
|
||||
{command: "d03281030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020001",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_10_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d03b810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_11_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Send SM",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Send SM",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d03281030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_11_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_12_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_12_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_13_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_sms_cmd_18_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_6_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001001b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_14_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001001b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_14_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001002b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_15_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001002b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_15_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001004b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_16_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001004b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_16_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_17_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_sms_cmd_17_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_12_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_18_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
// send_sms_cmd_18_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_6_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001008b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_19_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001008b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_19_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001010b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_20_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001010b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_20_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001020b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_21_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001020b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_21_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001040b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_22_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001040b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_22_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001080b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_23_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d01a8103011300820281838b09010002911040f00120d004001080b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_23_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02d8103011300820281838505804e2d4e0086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_24_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "中一"}},
|
||||
{command: "d02681030113008202818386099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_24_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02d810301130082028183850581029cad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_25_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
// send_sms_cmd_25_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_24_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "中一"}},
|
||||
{command: "d02e810301130082028183850682024e00ad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_26_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
// send_sms_cmd_26_without_alpha_identifier has the same pdu as
|
||||
// send_sms_cmd_24_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "中一"}},
|
||||
{command: "d0358103011300820281838509800038003030eb003086099111223344556677f88b140100099110325476f84008080038003030eb0031",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_27_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "80ル0"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "80ル0"}},
|
||||
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0031",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_27_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d03381030113008202818385078104613831eb3186099111223344556677f88b140100099110325476f84008080038003030eb0032",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_28_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "81ル1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "81ル1"}},
|
||||
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0032",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_28_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0348103011300820281838508820430a03832cb3286099111223344556677f88b140100099110325476f84008080038003030eb0033",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_29_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "82ル2"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "82ル2"}},
|
||||
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0033",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_29_without_alpha_identifier",
|
||||
commandQualifier: 0x00}}
|
||||
expect: {commandQualifier: 0x00}}
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSendSMS(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SMS, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
|
||||
if (aExpect.text) {
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("send_sms_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSendSMS(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,222 +1,155 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSendSS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_SS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d029810301110082028183850c43616c6c20466f7277617264891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_1_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Call Forward"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Call Forward"}},
|
||||
{command: "d01b810301110082028183891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_1_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
{command: "d02d810301110082028183850c43616c6c20466f7277617264891491aa120a21436587092143658709214365a711fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_2_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Call Forward"}},
|
||||
text: "Call Forward"}},
|
||||
{command: "d01f810301110082028183891491aa120a21436587092143658709214365a711fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_2_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d081fd8103011100820281838581eb4576656e20696620746865204669786564204469616c6c696e67204e756d626572207365727669636520697320656e61626c65642c2074686520737570706c656d656e74617279207365727669636520636f6e74726f6c20737472696e6720696e636c7564656420696e207468652053454e442053532070726f61637469766520636f6d6d616e64207368616c6c206e6f7420626520636865636b656420616761696e73742074686f7365206f66207468652046444e206c6973742e2055706f6e20726563656976696e67207468697320636f6d6d616e642c20746865204d45207368616c6c20646563698904ffba13fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_3_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Even if the Fixed Dialling Number service is enabled, the supplementary service control string included in the SEND SS proactive command shall not be checked against those of the FDN list. Upon receiving this command, the ME shall deci"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Even if the Fixed Dialling Number service is enabled, the supplementary service control string included in the SEND SS proactive command shall not be checked against those of the FDN list. Upon receiving this command, the ME shall deci"}},
|
||||
{command: "d00f8103011100820281838904ffba13fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_3_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d01d8103011100820281838500891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_4_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
// send_ss_cmd_4_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: ""}},
|
||||
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020001",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_5_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Basic Icon",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020001",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_5_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d02c810301110082028183850b436f6c6f75722049636f6e891091aa120a214365870921436587a901fb9e020003",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_6_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Colour Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Colour Icon",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon]}},
|
||||
icons: [COLOR_ICON]}},
|
||||
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020003",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_6_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon]}},
|
||||
icons: [COLOR_ICON]}},
|
||||
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020101",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_7_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Basic Icon",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020101",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_7_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d036810301110082028183851980041704140420041004120421042204120423041904220415891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_8_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
// send_ss_cmd_8_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_9_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_9_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_10_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_ss_cmd_10_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001001b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_11_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001001b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_11_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001002b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_12_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001002b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_12_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001004b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_13_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001004b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_13_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_14_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_ss_cmd_14_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_9_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_15_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
// send_ss_cmd_15_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001008b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_16_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001008b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_16_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001010b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_17_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001010b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_17_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001020b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_18_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001020b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_18_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001040b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_19_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001040b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_19_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001080b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_20_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001080b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_20_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0228103011100820281838505804f60597d891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_21_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "你好"}},
|
||||
// send_ss_cmd_21_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
{command: "d02081030111008202818385038030eb891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_22_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ル"}},
|
||||
// send_ss_cmd_22_without_alpha_identifier has the same pdu as
|
||||
// send_ss_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ル"}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSendSS(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SS, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
|
||||
if (aExpect.text) {
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("send_ss_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSendSS(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,229 +1,156 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSendUSSD(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SEND_USSD, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d050810301120082028183850a372d62697420555353448a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_1_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "7-bit USSD"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "7-bit USSD"}},
|
||||
{command: "d0448103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_1_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d058810301120082028183850a382d62697420555353448a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_2_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "8-bit USSD"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "8-bit USSD"}},
|
||||
{command: "d04c8103011200820281838a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_2_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d02f81030112008202818385095543533220555353448a1948041704140420041004120421042204120423041904220415",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_3_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "UCS2 USSD"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "UCS2 USSD"}},
|
||||
{command: "d0248103011200820281838a1948041704140420041004120421042204120423041904220415",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_3_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d081fd8103011200820281838581b66f6e636520612052454c4541534520434f4d504c455445206d65737361676520636f6e7461696e696e672074686520555353442052657475726e20526573756c74206d657373616765206e6f7420636f6e7461696e696e6720616e206572726f7220686173206265656e2072656365697665642066726f6d20746865206e6574776f726b2c20746865204d45207368616c6c20696e666f726d207468652053494d20746861742074686520636f6d6d616e64206861738a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_4_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "once a RELEASE COMPLETE message containing the USSD Return Result message not containing an error has been received from the network, the ME shall inform the SIM that the command has"}},
|
||||
// send_ussd_cmd_4_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "once a RELEASE COMPLETE message containing the USSD Return Result message not containing an error has been received from the network, the ME shall inform the SIM that the command has"}},
|
||||
{command: "d04681030112008202818385008a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_5_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
// send_ussd_cmd_5_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: ""}},
|
||||
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_6_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Basic Icon",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_6_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d054810301120082028183850a436f6c6f722049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020003",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_7_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Color Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Color Icon",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon]}},
|
||||
icons: [COLOR_ICON]}},
|
||||
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020003",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_7_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon]}},
|
||||
icons: [COLOR_ICON]}},
|
||||
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020101",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_8_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon",
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Basic Icon",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020101",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_8_without_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d05f8103011200820281838519800417041404200410041204210422041204230419042204158a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_9_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
// send_ussd_cmd_9_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_10_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_10_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_11_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_ussd_cmd_11_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001001b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_12_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001001b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_12_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001002b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_13_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001002b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_13_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001004b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_14_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001004b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_14_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_15_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
// send_ussd_cmd_15_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_10_with_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_16_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
// send_ussd_cmd_16_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001008b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_17_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001008b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_17_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001010b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_18_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001010b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_18_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001020b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_19_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001020b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_19_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001040b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_20_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001040b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_20_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001080b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_21_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Text Attribute 1"}},
|
||||
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001080b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_21_without_alpha_identifier",
|
||||
commandQualifier: 0x00}},
|
||||
expect: {commandQualifier: 0x00}},
|
||||
{command: "d04b8103011200820281838505804f60597d8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_22_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "你好"}},
|
||||
// send_ussd_cmd_22_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
{command: "d04981030112008202818385038030eb8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_23_with_alpha_identifier",
|
||||
commandQualifier: 0x00,
|
||||
title: "ル"}},
|
||||
// send_ussd_cmd_23_without_alpha_identifier has the same pdu as
|
||||
// send_ussd_cmd_1_without_alpha_identifier.
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ル"}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSendUSSD(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_USSD, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
|
||||
if (aExpect.text) {
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("send_ussd_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSendUSSD(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,376 +1,301 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSetupCall(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_CALL, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.address, expect.address, expect.name);
|
||||
|
||||
if (expect.confirmMessage) {
|
||||
isStkText(command.options.confirmMessage, expect.confirmMessage, expect.name);
|
||||
}
|
||||
if (expect.callMessage) {
|
||||
isStkText(command.options.callMessage, expect.callMessage, expect.name);
|
||||
}
|
||||
|
||||
let duration = command.options.duration;
|
||||
if (duration) {
|
||||
is(duration.timeUnit, expect.duration.timeUnit, expect.name);
|
||||
is(duration.timeInterval, expect.duration.timeInterval, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d01e81030110008202818385084e6f7420627573798609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Not busy" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d01d81030110028202818385074f6e20686f6c648609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_2",
|
||||
commandQualifier: 0x02,
|
||||
expect: {commandQualifier: 0x02,
|
||||
confirmMessage: { text: "On hold" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d020810301100482028183850a446973636f6e6e6563748609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_3",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
confirmMessage: { text: "Disconnect" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02b81030110008202818385114361706162696c69747920636f6e6669678609911032042143651c2c870201a0",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Capability config" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d01c81030110018202818386119110325476981032547698103254769810",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_5",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
address: "+01234567890123456789012345678901"}},
|
||||
{command: "d081fd8103011001820281838581ed54687265652074797065732061726520646566696e65643a202d2073657420757020612063616c6c2c20627574206f6e6c79206966206e6f742063757272656e746c792062757379206f6e20616e6f746865722063616c6c3b202d2073657420757020612063616c6c2c2070757474696e6720616c6c206f746865722063616c6c732028696620616e7929206f6e20686f6c643b202d2073657420757020612063616c6c2c20646973636f6e6e656374696e6720616c6c206f746865722063616c6c732028696620616e79292066697273742e20466f722065616368206f662074686573652074797065732c2086029110",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_6",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
confirmMessage: { text: "Three types are defined: - set up a call, but only if not currently busy on another call; - set up a call, putting all other calls (if any) on hold; - set up a call, disconnecting all other calls (if any) first. For each of these types, " },
|
||||
address: "+01"}},
|
||||
{command: "d02b810301100082028183850c43616c6c65642070617274798609911032042143651c2c880780509595959595",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Called party" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02281030110018202818385084475726174696f6e8609911032042143651c2c8402010a",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_8",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
confirmMessage: { text: "Duration" },
|
||||
address: "+012340123456,1,2",
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
{command: "d028810301100082028183850c434f4e4649524d4154494f4e8609911032042143651c2c850443414c4c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION" },
|
||||
callMessage: { text: "CALL" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e312e318609911032042143651c2c9e020101",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Set up call Icon 3.1.1",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon] },
|
||||
icons: [BASIC_ICON] },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e322e318609911032042143651c2c9e020001",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Set up call Icon 3.2.1",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon] },
|
||||
icons: [BASIC_ICON] },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e332e318609911032042143651c2c9e020103",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Set up call Icon 3.3.1",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [colorIcon] },
|
||||
icons: [COLOR_ICON] },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e342e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e342e329e020001",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Set up call Icon 3.4.1",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon] },
|
||||
icons: [BASIC_ICON] },
|
||||
callMessage: { text: "Set up call Icon 3.4.2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e01b4d004000601b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e02b4d004000602b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e04b4d004000604b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e08b4d004000608b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e10b4d004000610b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e20b4d004000620b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e40b4d004000640b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e80b4d004000680b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 3" },
|
||||
callMessage: { text: "CALL 3" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d0040006004b",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_38",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 1" },
|
||||
callMessage: { text: "CALL 1" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "CONFIRMATION 2" },
|
||||
callMessage: { text: "CALL 2" },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d02d810301100082028183851980041704140420041004120421042204120423041904220415860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "ЗДРАВСТВУЙТЕ" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d04c810301100082028183851b800417041404200410041204210422041204230419042204150031860791103204214365851b800417041404200410041204210422041204230419042204150032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_41",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "ЗДРАВСТВУЙТЕ1" },
|
||||
callMessage: { text: "ЗДРАВСТВУЙТЕ2" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d0198103011000820281838505804e0d5fd9860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_42",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "不忙" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d022810301100082028183850580786e5b9a860791103204214365850780625375358bdd",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_43",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "确定" },
|
||||
callMessage: { text: "打电话" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d01781030110008202818385038030eb860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_44",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "ル" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d02081030110008202818385058030eb003186079110320421436585058030eb0032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_45",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "ル1" },
|
||||
callMessage: { text: "ル2" },
|
||||
address: "+012340123456"}},
|
||||
{command: "d029810301100482028182050a446973636f6e6e6563748609811032042143651c2c05074d657373616765",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_46",
|
||||
commandQualifier: 0x04,
|
||||
expect: {commandQualifier: 0x04,
|
||||
confirmMessage: { text: "Disconnect" },
|
||||
address: "012340123456,1,2",
|
||||
callMessage: { text: "Message"}}},
|
||||
{command: "d02281030110008202818385084E6F7420627573798609911032042143651C2C8402010A",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_47",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Not busy" },
|
||||
address: "+012340123456,1,2",
|
||||
duration: {timeUnit: iccManager.STK_TIME_UNIT_SECOND,
|
||||
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 0x0A}}},
|
||||
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e352e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e352e329e020103",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_48",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { text: "Set up call Icon 3.5.1",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon] },
|
||||
icons: [BASIC_ICON] },
|
||||
callMessage: { text: "Set up call Icon 3.5.2",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [colorIcon] },
|
||||
icons: [COLOR_ICON] },
|
||||
address: "+012340123456,1,2"}},
|
||||
{command: "d01c8103011000820281838609911032042143651c2c9e0200019e020103",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_49",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
confirmMessage: { iconSelfExplanatory: true,
|
||||
icons: [basicIcon] },
|
||||
icons: [BASIC_ICON] },
|
||||
callMessage: { iconSelfExplanatory: false,
|
||||
icons: [colorIcon] },
|
||||
icons: [COLOR_ICON] },
|
||||
address: "+012340123456,1,2"}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSetupCall(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_CALL,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier,
|
||||
"commandQualifier");
|
||||
is(aCommand.options.address, aExpect.address,
|
||||
"options.address");
|
||||
|
||||
if (aExpect.confirmMessage) {
|
||||
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage);
|
||||
}
|
||||
|
||||
if (aExpect.callMessage) {
|
||||
isStkText(aCommand.options.callMessage, aExpect.callMessage);
|
||||
}
|
||||
|
||||
let duration = aCommand.options.duration;
|
||||
if (duration) {
|
||||
is(duration.timeUnit, aExpect.duration.timeUnit, "duration.timeUnit");
|
||||
is(duration.timeInterval, aExpect.duration.timeInterval,
|
||||
"duration.timeInterval");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("setup_call_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSetupCall(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,50 +1,59 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSetupEventList(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_EVENT_LIST, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
for (let index in command.options.eventList) {
|
||||
is(command.options.eventList[index], expect.eventList[index], expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d00c810301050082028182990104",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: [4]}},
|
||||
{command: "d00d81030105008202818299020507",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: [5, 7]}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: [7]}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: [7]}},
|
||||
{command: "d00b8103010500820281829900",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: null}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
eventList: [7]}}
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSetupEventList(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_EVENT_LIST,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
|
||||
for (let index in aExpect.eventList) {
|
||||
is(aCommand.options.eventList[index], aExpect.eventList[index],
|
||||
"options.eventList[" + index + "]");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("setup_event_list_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSetupEventList(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,207 +1,154 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSetupIdleModeText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d01a8103012800820281828d0f0449646c65204d6f64652054657874",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text"}},
|
||||
{command: "d0188103012800820281828d0d04546f6f6c6b69742054657374",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Toolkit Test"}},
|
||||
{command: "d081fd8103012800820281828d81f100547419344d3641737498cd06cdeb70383b0f0a83e8653c1d34a7cbd3ee330b7447a7c768d01c1d66b341e232889c9ec3d9e17c990c12e741747419d42c82c27350d80d4a93d96550fb4d2e83e8653c1d943683e8e832a85904a5e7a0b0985d06d1df20f21b94a6bba8e832082e2fcfcb6e7a989e7ebb41737a9e5d06a5e72076d94c0785e7a0b01b946ec3d9e576d94d0fd3d36f37885c1ea7e7e9b71b447f83e8e832a85904b5c3eeba393ca6d7e565b90b444597416932bb0c6abfc96510bd8ca783e6e8309b0d129741e4f41cce0ee7cb6450da0d0a83da61b7bb2c07d1d1613aa8ec9ed7e5e539888e0ed341ee32",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "The SIM shall supply a text string, which shall be displayed by the ME as an idle mode text if the ME is able to do it.The presentation style is left as an implementation decision to the ME manufacturer. The idle mode text shall be displayed in a manner that ensures that ne"}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020001",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle text",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon]}},
|
||||
icons: [BASIC_ICON]}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020105",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle text",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [colorTransparencyIcon]}},
|
||||
icons: [COLOR_TRANSPARENCY_ICON]}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020007",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle text",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [colorIcon, colorTransparencyIcon]}},
|
||||
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
|
||||
{command: "d0248103012800820281828d1908041704140420041004120421042204120423041904220415",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001001b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001002b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001004b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001008b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001010b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001020b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001040b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001080b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0108103012800820281828d05084f60597d",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
{command: "d0148103012800820281828d09080038003030eb0030",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
text: "80ル0"}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSetupIdleModeText(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.text, aExpect.text, "options.text");
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("setup_idle_mode_text_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSetupIdleModeText(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -1,269 +1,216 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_HEAD_JS = "stk_helper.js";
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSetupMenu(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
|
||||
is(command.options.items[index].text, expect.items[index].text, expect.name);
|
||||
|
||||
let itemIcons = command.options.items[index].icons;
|
||||
if (itemIcons) {
|
||||
isIcons(itemIcons, expect.items[index].icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.items[index].iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.items[index].iconSelfExplanatory, expect.name);
|
||||
}
|
||||
}
|
||||
|
||||
let icons = command.options.icons;
|
||||
if (icons) {
|
||||
isIcons(icons, expect.icons, expect.name);
|
||||
|
||||
let iconSelfExplanatory = command.options.iconSelfExplanatory;
|
||||
is(iconSelfExplanatory, expect.iconSelfExplanatory, expect.name);
|
||||
}
|
||||
|
||||
let length = command.options.nextActionList ? command.options.nextActionList.length : 0;
|
||||
for (let i = 0; i < length; i++) {
|
||||
is(command.options.nextActionList[i], expect.nextActionList[i], expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function isFirstMenuItemNull(command) {
|
||||
return (command.options.items.length == 1 && !(command.options.items[0]));
|
||||
}
|
||||
|
||||
function testInitialSetupMenu(command) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
|
||||
is(isFirstMenuItemNull(command), false);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
function testRemoveSetupMenu(command) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, iccManager.STK_CMD_SET_UP_MENU);
|
||||
is(isFirstMenuItemNull(command), true);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
const TEST_DATA = [
|
||||
{command: "d03b810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d023810301250082028182850c546f6f6c6b6974204d656e758f04114f6e658f041254776f",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
|
||||
{command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "LargeMenu1",
|
||||
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
|
||||
{command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "LargeMenu2",
|
||||
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
|
||||
{command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "The SIM shall supply a set of menu items, which shall be integrated with the menu system (or other MMI facility) in order to give the user the opportunity to choose one of these menu items at his own discretion. Each item comprises a sh",
|
||||
items: [{identifier: 1, text: "Y"}]}},
|
||||
{command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_6",
|
||||
commandQualifier: 0x80,
|
||||
expect: {commandQualifier: 0x80,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
|
||||
nextActionList: [iccManager.STK_CMD_SEND_SMS, iccManager.STK_CMD_SET_UP_CALL, iccManager.STK_CMD_LAUNCH_BROWSER, iccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
|
||||
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_LAUNCH_BROWSER, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
|
||||
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401030303",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
iconSelfExplanatory: false,
|
||||
icons: [basicIcon],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [colorIcon]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [colorIcon]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [colorIcon]}]}},
|
||||
icons: [BASIC_ICON],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
|
||||
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
iconSelfExplanatory: true,
|
||||
icons: [basicIcon],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [colorTransparencyIcon]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [colorTransparencyIcon]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [colorTransparencyIcon]}]}},
|
||||
icons: [BASIC_ICON],
|
||||
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
|
||||
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
|
||||
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
|
||||
{command: "d029810301250182028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d2032",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_10",
|
||||
commandQualifier: 0x01,
|
||||
expect: {commandQualifier: 0x01,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e01b4d10c000601b4000601b4000601b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e02b4d10c000602b4000602b4000602b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e04b4d10c000604b4000604b4000604b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036d004000e00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520338f07074974656d20378f07084974656d20388f07094974656d2039",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 3",
|
||||
items: [{identifier: 7, text: "Item 7"}, {identifier: 8, text: "Item 8"}, {identifier: 9, text: "Item 9"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e08b4d10c000608b4000608b4000608b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e10b4d10c000610b4000610b4000610b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e20b4d10c000620b4000620b4000620b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e40b4d10c000640b4000640b4000640b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e80b4d10c000680b4000680b4000680b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d046810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d2033d004000c00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
|
||||
{command: "d0608103012500820281828519800417041404200410041204210422041204230419042204158f1c118004170414042004100412042104220412042304190422041500358f1c12800417041404200410041204210422041204230419042204150036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 17, text: "ЗДРАВСТВУЙТЕ5"}, {identifier: 18, text: "ЗДРАВСТВУЙТЕ6"}]}},
|
||||
{command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "工具箱单",
|
||||
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
|
||||
{command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "工具箱单",
|
||||
items: [{identifier: 17, text: "一"}, {identifier: 18, text: "二"}]}},
|
||||
{command: "d0448103012500820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb00338f0a04800038003030eb0034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}, {identifier: 4, text: "80ル4"}]}},
|
||||
{command: "d02c8103012500820281828509800038003030eb00308f0a11800038003030eb00358f0a12800038003030eb0036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 17, text: "80ル5"}, {identifier: 18, text: "80ル6"}]}},
|
||||
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180481000000",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
|
||||
nextActionList: [iccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL, iccManager.STK_NEXT_ACTION_NULL]}},
|
||||
{command: "D00D81030125008202818285008F00",
|
||||
func: testRemoveSetupMenu},
|
||||
nextActionList: [MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL]}},
|
||||
{command:"D03B810301250082028182850C546F6F6C6B6974204D656E758F07014974656D20318F07024974656D20328F07034974656D20338F07044974656D2034",
|
||||
func: testInitialSetupMenu},
|
||||
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
// Test remove setup menu.
|
||||
{command: "D00D81030125008202818285008F00",
|
||||
expect: {commandQualifier: 0x00,
|
||||
title: "",
|
||||
items: [null]}},
|
||||
];
|
||||
|
||||
runNextTest();
|
||||
function testSetupMenu(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_MENU, "typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.title, aExpect.title, "options.title");
|
||||
|
||||
for (let index in aExpect.items) {
|
||||
let item = aCommand.options.items[index];
|
||||
let itemExpect = aExpect.items[index];
|
||||
|
||||
if (!itemExpect) {
|
||||
is(item, itemExpect, "options.items[" + index + "]");
|
||||
} else {
|
||||
is(item.identifier, itemExpect.identifier,
|
||||
"options.items[" + index + "].identifier");
|
||||
is(item.text, itemExpect.text,
|
||||
"options.items[" + index + "].text");
|
||||
|
||||
if (itemExpect.icons) {
|
||||
isIcons(item.icons, itemExpect.icons);
|
||||
is(item.iconSelfExplanatory, itemExpect.iconSelfExplanatory,
|
||||
"options.items[" + index + "].iconSelfExplanatory");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aExpect.icons) {
|
||||
isIcons(aCommand.options.icons, aExpect.icons);
|
||||
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
|
||||
"options.iconSelfExplanatory");
|
||||
}
|
||||
|
||||
if (aExpect.nextActionList) {
|
||||
for (let index in aExpect.nextActionList) {
|
||||
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
|
||||
"options.nextActionList[" + index + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("setup_menu_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testSetupMenu(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// Start
|
||||
{command: "d011810301270082028182a40101a503102030",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_TIMER_START,
|
||||
timerAction: MozIccManager.STK_TIMER_START,
|
||||
timerId: 0x01,
|
||||
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03}},
|
||||
// Deactivate
|
||||
{command: "d00c810301270182028182a40104",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
|
||||
timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
|
||||
timerId: 0x04}},
|
||||
// Get current value
|
||||
{command: "d00c810301270282028182a40108",
|
||||
expect: {commandNumber: 0x01,
|
||||
commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
|
||||
timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
|
||||
timerId: 0x08}},
|
||||
];
|
||||
|
||||
function testTimerManagement(aCommand, aExpect) {
|
||||
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_TIMER_MANAGEMENT,
|
||||
"typeOfCommand");
|
||||
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
|
||||
is(aCommand.options.timerAction, aExpect.timerAction, "options.timerAction");
|
||||
is(aCommand.options.timerId, aExpect.timerId, "options.timerId");
|
||||
|
||||
if (aExpect.timerValue) {
|
||||
is(aCommand.options.timerValue, aExpect.timerValue, "options.timerValue");
|
||||
}
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => {
|
||||
log("timer_management_cmd: " + data.command);
|
||||
|
||||
let promises = [];
|
||||
// Wait onstkcommand event.
|
||||
promises.push(waitForTargetEvent(icc, "stkcommand")
|
||||
.then((aEvent) => testTimerManagement(aEvent.command, data.expect)));
|
||||
// Send emulator command to generate stk unsolicited event.
|
||||
promises.push(sendEmulatorStkPdu(data.command));
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
#include "mozilla/sandboxTarget.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "windows.h"
|
||||
#include <intrin.h>
|
||||
#include <assert.h>
|
||||
|
@ -33,6 +34,31 @@
|
|||
#include "sha256.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
namespace {
|
||||
|
||||
// Scoped type used by Load
|
||||
struct ScopedActCtxHandleTraits
|
||||
{
|
||||
typedef HANDLE type;
|
||||
|
||||
static type empty()
|
||||
{
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
static void release(type aActCtxHandle)
|
||||
{
|
||||
if (aActCtxHandle != INVALID_HANDLE_VALUE) {
|
||||
ReleaseActCtx(aActCtxHandle);
|
||||
}
|
||||
}
|
||||
};
|
||||
typedef mozilla::Scoped<ScopedActCtxHandleTraits> ScopedActCtxHandle;
|
||||
|
||||
} // anonymous namespace
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace gmp {
|
||||
|
||||
|
@ -168,6 +194,30 @@ GMPLoaderImpl::Load(const char* aLibPath,
|
|||
nodeId = std::string(aOriginSalt, aOriginSalt + aOriginSaltLen);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
// If the GMP DLL is a side-by-side assembly with static imports then the DLL
|
||||
// loader will attempt to create an activation context which will fail because
|
||||
// of the sandbox. If we create an activation context before we start the
|
||||
// sandbox then this one will get picked up by the DLL loader.
|
||||
int pathLen = MultiByteToWideChar(CP_ACP, 0, aLibPath, -1, nullptr, 0);
|
||||
if (pathLen == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
wchar_t* widePath = new wchar_t[pathLen];
|
||||
if (MultiByteToWideChar(CP_ACP, 0, aLibPath, -1, widePath, pathLen) == 0) {
|
||||
delete[] widePath;
|
||||
return false;
|
||||
}
|
||||
|
||||
ACTCTX actCtx = { sizeof(actCtx) };
|
||||
actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
|
||||
actCtx.lpSource = widePath;
|
||||
actCtx.lpResourceName = ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
|
||||
ScopedActCtxHandle actCtxHandle(CreateActCtx(&actCtx));
|
||||
delete[] widePath;
|
||||
#endif
|
||||
|
||||
// Start the sandbox now that we've generated the device bound node id.
|
||||
// This must happen after the node id is bound to the device id, as
|
||||
// generating the device id requires privileges.
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsIRunnable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "prlog.h"
|
||||
#include <time.h>
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
@ -36,14 +37,37 @@ extern PRLogModuleInfo* GetMediaSourceAPILog();
|
|||
#define MSE_API(...)
|
||||
#endif
|
||||
|
||||
// RangeRemoval must be synchronous if appendBuffer is also synchronous.
|
||||
// While waiting for bug 1118589 to land, ensure RangeRemoval is synchronous
|
||||
#define APPENDBUFFER_IS_SYNCHRONOUS
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
|
||||
class AppendDataRunnable : public nsRunnable {
|
||||
public:
|
||||
AppendDataRunnable(SourceBuffer* aSourceBuffer,
|
||||
const uint8_t* aData,
|
||||
uint32_t aLength,
|
||||
double aTimestampOffset)
|
||||
: mSourceBuffer(aSourceBuffer)
|
||||
, mTimestampOffset(aTimestampOffset)
|
||||
{
|
||||
mData.AppendElements(aData, aLength);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL {
|
||||
|
||||
mSourceBuffer->AppendData(mData.Elements(),
|
||||
mData.Length(),
|
||||
mTimestampOffset);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<SourceBuffer> mSourceBuffer;
|
||||
nsTArray<uint8_t> mData;
|
||||
double mTimestampOffset;
|
||||
};
|
||||
|
||||
class RangeRemovalRunnable : public nsRunnable {
|
||||
public:
|
||||
RangeRemovalRunnable(SourceBuffer* aSourceBuffer,
|
||||
|
@ -240,18 +264,8 @@ SourceBuffer::RangeRemoval(double aStart, double aEnd)
|
|||
{
|
||||
StartUpdating();
|
||||
|
||||
#if defined(APPENDBUFFER_IS_SYNCHRONOUS)
|
||||
DoRangeRemoval(aStart, aEnd);
|
||||
|
||||
// Run the final step of the buffer append algorithm asynchronously to
|
||||
// ensure the SourceBuffer's updating flag transition behaves as required
|
||||
// by the spec.
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &SourceBuffer::StopUpdating);
|
||||
NS_DispatchToMainThread(event);
|
||||
#else
|
||||
nsRefPtr<nsIRunnable> task = new RangeRemovalRunnable(this, aStart, aEnd);
|
||||
NS_DispatchToMainThread(task);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -267,9 +281,7 @@ SourceBuffer::DoRangeRemoval(double aStart, double aEnd)
|
|||
mTrackBuffer->RangeRemoval(start, end);
|
||||
}
|
||||
|
||||
#if !defined(APPENDBUFFER_IS_SYNCHRONOUS)
|
||||
StopUpdating();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -405,10 +417,29 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
|
|||
|
||||
MOZ_ASSERT(mAppendMode == SourceBufferAppendMode::Segments,
|
||||
"We don't handle timestampOffset for sequence mode yet");
|
||||
nsRefPtr<nsIRunnable> task =
|
||||
new AppendDataRunnable(this, aData, aLength, mTimestampOffset);
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
void
|
||||
SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, double aTimestampOffset)
|
||||
{
|
||||
if (!mUpdating) {
|
||||
// The buffer append algorithm has been interrupted by abort().
|
||||
//
|
||||
// If the sequence appendBuffer(), abort(), appendBuffer() occurs before
|
||||
// the first StopUpdating() runnable runs, then a second StopUpdating()
|
||||
// runnable will be scheduled, but still only one (the first) will queue
|
||||
// events.
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mMediaSource);
|
||||
|
||||
if (aLength) {
|
||||
if (!mTrackBuffer->AppendData(aData, aLength, mTimestampOffset * USECS_PER_S)) {
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethodWithArg<bool>(this, &SourceBuffer::AppendError, true);
|
||||
NS_DispatchToMainThread(event);
|
||||
if (!mTrackBuffer->AppendData(aData, aLength, aTimestampOffset * USECS_PER_S)) {
|
||||
AppendError(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -419,12 +450,8 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
|
|||
CheckEndTime();
|
||||
}
|
||||
|
||||
// Run the final step of the buffer append algorithm asynchronously to
|
||||
// ensure the SourceBuffer's updating flag transition behaves as required
|
||||
// by the spec.
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &SourceBuffer::StopUpdating);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
StopUpdating();
|
||||
}
|
||||
|
||||
void
|
||||
SourceBuffer::AppendError(bool aDecoderError)
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
~SourceBuffer();
|
||||
|
||||
friend class AsyncEventRunner<SourceBuffer>;
|
||||
friend class AppendDataRunnable;
|
||||
void DispatchSimpleEvent(const char* aName);
|
||||
void QueueAsyncSimpleEvent(const char* aName);
|
||||
|
||||
|
@ -137,6 +138,8 @@ private:
|
|||
|
||||
// Shared implementation of AppendBuffer overloads.
|
||||
void AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aRv);
|
||||
void AppendData(const uint8_t* aData, uint32_t aLength,
|
||||
double aTimestampOffset);
|
||||
|
||||
// Implement the "Append Error Algorithm".
|
||||
// Will call endOfStream() with "decode" error if aDecodeError is true.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "prlog.h"
|
||||
#include "AbstractMediaDecoder.h"
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* GetMediaSourceLog();
|
||||
|
|
|
@ -304,6 +304,11 @@ NetworkManager.prototype = {
|
|||
}
|
||||
this.networkInterfaces[networkId] = network;
|
||||
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
debug("Force setting " + SETTINGS_DUN_REQUIRED + " to true.");
|
||||
this.tetheringSettings[SETTINGS_DUN_REQUIRED] = true;
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(network, TOPIC_INTERFACE_REGISTERED, null);
|
||||
debug("Network '" + networkId + "' registered.");
|
||||
},
|
||||
|
@ -428,6 +433,11 @@ NetworkManager.prototype = {
|
|||
}
|
||||
delete this.networkInterfaces[networkId];
|
||||
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.tetheringSettings[SETTINGS_DUN_REQUIRED] =
|
||||
libcutils.property_get("ro.tethering.dun_required") === "1";
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(network, TOPIC_INTERFACE_UNREGISTERED, null);
|
||||
debug("Network '" + networkId + "' unregistered.");
|
||||
},
|
||||
|
|
|
@ -16,6 +16,8 @@ const TETHERING_SETTING_END_IP = "192.168.1.30";
|
|||
const TETHERING_SETTING_DNS1 = "8.8.8.8";
|
||||
const TETHERING_SETTING_DNS2 = "8.8.4.4";
|
||||
|
||||
const TETHERING_NETWORK_ADDR = "192.168.1.0/24";
|
||||
|
||||
/**
|
||||
* Wifi tethering setting.
|
||||
*/
|
||||
|
@ -24,6 +26,7 @@ const TETHERING_SETTING_SECURITY = "open";
|
|||
const TETHERING_SETTING_KEY = "1234567890";
|
||||
|
||||
const SETTINGS_RIL_DATA_ENABLED = 'ril.data.enabled';
|
||||
const SETTINGS_KEY_DATA_APN_SETTINGS = "ril.data.apnSettings";
|
||||
|
||||
// Emulate Promise.jsm semantics.
|
||||
Promise.defer = function() { return new Deferred(); }
|
||||
|
@ -201,6 +204,20 @@ let gTestSuite = (function() {
|
|||
return setSettings(settings, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function getDataApnSettings(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_APN_SETTINGS, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function setDataApnSettings(aApnSettings, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap DOMRequest onsuccess/onerror events to Promise resolve/reject.
|
||||
*
|
||||
|
@ -297,6 +314,9 @@ let gTestSuite = (function() {
|
|||
* We also verify iptables output as netd's NatController will execute
|
||||
* $ iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE
|
||||
*
|
||||
* For tethering through dun, we use 'ip rule' to find the secondary routing
|
||||
* table and look for default route on that table.
|
||||
*
|
||||
* Resolve when the verification is successful and reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
|
@ -304,9 +324,10 @@ let gTestSuite = (function() {
|
|||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function verifyTetheringRouting(aEnabled) {
|
||||
function verifyTetheringRouting(aEnabled, aIsDun) {
|
||||
let netcfgResult = {};
|
||||
let ipRouteResult = {};
|
||||
let ipSecondaryRouteResult = {};
|
||||
|
||||
// Execute 'netcfg' and parse to |netcfgResult|, each key of which is the
|
||||
// interface name and value is { ip(string) }.
|
||||
|
@ -418,8 +439,76 @@ let gTestSuite = (function() {
|
|||
});
|
||||
}
|
||||
|
||||
// Execute 'ip rule show', there must be one rule for tethering network
|
||||
// address to lookup for a secondary routing table, return that table id.
|
||||
function verifyIpRule() {
|
||||
if (!aIsDun) {
|
||||
return;
|
||||
}
|
||||
|
||||
return runEmulatorShellSafe(['ip', 'rule', 'show'])
|
||||
.then(function (aLines) {
|
||||
// Sample output:
|
||||
//
|
||||
// 0: from all lookup local
|
||||
// 32765: from 192.168.1.0/24 lookup 60
|
||||
// 32766: from all lookup main
|
||||
// 32767: from all lookup default
|
||||
//
|
||||
let tableId = (function findTableId() {
|
||||
for (let i = 0; i < aLines.length; i++) {
|
||||
let tokens = aLines[i].split(/\s+/);
|
||||
if (-1 != tokens.indexOf(TETHERING_NETWORK_ADDR)) {
|
||||
let lookupIndex = tokens.indexOf('lookup');
|
||||
if (lookupIndex < 0 || lookupIndex + 1 >= tokens.length) {
|
||||
return;
|
||||
}
|
||||
return tokens[lookupIndex + 1];
|
||||
}
|
||||
}
|
||||
return;
|
||||
})();
|
||||
|
||||
if ((aEnabled && !tableId) || (!aEnabled && tableId)) {
|
||||
throw 'Secondary table' + (tableId ? '' : ' not') + ' found while tethering is ' +
|
||||
(aEnabled ? 'enabled' : 'disabled');
|
||||
}
|
||||
|
||||
return tableId;
|
||||
});
|
||||
}
|
||||
|
||||
// Given the table id, use 'ip rule show table <table id>' to find the
|
||||
// default route on that secondary routing table.
|
||||
function execAndParseSecondaryTable(aTableId) {
|
||||
if (!aIsDun || !aEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
return runEmulatorShellSafe(['ip', 'route', 'show', 'table', aTableId])
|
||||
.then(function (aLines) {
|
||||
// We only look for default route in secondary table.
|
||||
aLines.forEach(function (aLine) {
|
||||
let tokens = aLine.split(/\s+/);
|
||||
if (tokens.length < 2) {
|
||||
return;
|
||||
}
|
||||
if ('default' === tokens[0]) {
|
||||
let ifnameIndex = tokens.indexOf('dev');
|
||||
if (ifnameIndex < 0 || ifnameIndex + 1 >= tokens.length) {
|
||||
return;
|
||||
}
|
||||
let ifname = tokens[ifnameIndex + 1];
|
||||
ipSecondaryRouteResult[ifname] = { default: true };
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function verifyDefaultRouteAndIp(aExpectedWifiTetheringIp) {
|
||||
log(JSON.stringify(ipRouteResult));
|
||||
log(JSON.stringify(ipSecondaryRouteResult));
|
||||
log(JSON.stringify(netcfgResult));
|
||||
|
||||
if (aEnabled) {
|
||||
|
@ -429,10 +518,19 @@ let gTestSuite = (function() {
|
|||
isOrThrow(ipRouteResult['wlan0'].src, netcfgResult['wlan0'].ip, 'wlan0.ip');
|
||||
isOrThrow(ipRouteResult['wlan0'].src, aExpectedWifiTetheringIp, 'expected ip');
|
||||
isOrThrow(ipRouteResult['wlan0'].default, false, 'wlan0.default');
|
||||
|
||||
if (aIsDun) {
|
||||
isOrThrow(ipRouteResult['rmnet1'].src, netcfgResult['rmnet1'].ip, 'rmnet1.ip');
|
||||
isOrThrow(ipRouteResult['rmnet1'].default, false, 'rmnet1.default');
|
||||
// Dun's network default route is set on secondary routing table.
|
||||
isOrThrow(ipSecondaryRouteResult['rmnet1'].default, true, 'secondary rmnet1.default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return verifyIptables()
|
||||
.then(verifyIpRule)
|
||||
.then(tableId => execAndParseSecondaryTable(tableId))
|
||||
.then(exeAndParseNetcfg)
|
||||
.then(exeAndParseIpRoute)
|
||||
.then(() => verifyDefaultRouteAndIp(TETHERING_SETTING_IP));
|
||||
|
@ -450,10 +548,12 @@ let gTestSuite = (function() {
|
|||
*
|
||||
* @param aEnabled
|
||||
* Boolean that indicates to enable or disable wifi tethering.
|
||||
* @param aIsDun
|
||||
* Boolean that indicates whether dun is required.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setWifiTetheringEnabled(aEnabled) {
|
||||
function setWifiTetheringEnabled(aEnabled, aIsDun) {
|
||||
let RETRY_INTERVAL_MS = 1000;
|
||||
let retryCnt = 20;
|
||||
|
||||
|
@ -472,7 +572,7 @@ let gTestSuite = (function() {
|
|||
|
||||
return tetheringManager.setTetheringEnabled(aEnabled, TYPE_WIFI, config)
|
||||
.then(function waitForRoutingVerified() {
|
||||
return verifyTetheringRouting(aEnabled)
|
||||
return verifyTetheringRouting(aEnabled, aIsDun)
|
||||
.then(null, function onreject(aReason) {
|
||||
|
||||
log('verifyTetheringRouting rejected due to ' + aReason +
|
||||
|
@ -602,6 +702,9 @@ let gTestSuite = (function() {
|
|||
//---------------------------------------------------
|
||||
suite.ensureWifiEnabled = ensureWifiEnabled;
|
||||
suite.setWifiTetheringEnabled = setWifiTetheringEnabled;
|
||||
suite.getDataApnSettings = getDataApnSettings;
|
||||
suite.setDataApnSettings = setDataApnSettings;
|
||||
|
||||
|
||||
/**
|
||||
* The common test routine for wifi tethering.
|
||||
|
|
|
@ -4,3 +4,4 @@ browser = false
|
|||
qemu = true
|
||||
|
||||
[test_wifi_tethering_enabled.js]
|
||||
[test_wifi_tethering_dun.js]
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
gTestSuite.startTest(function() {
|
||||
let origApnSettings;
|
||||
return gTestSuite.getDataApnSettings()
|
||||
.then(value => {
|
||||
origApnSettings = value;
|
||||
})
|
||||
.then(() => {
|
||||
// Set dun apn settings.
|
||||
let apnSettings = [[ { "carrier": "T-Mobile US",
|
||||
"apn": "epc1.tmobile.com",
|
||||
"mmsc": "http://mms.msg.eng.t-mobile.com/mms/wapenc",
|
||||
"types": ["default","supl","mms"] },
|
||||
{ "carrier": "T-Mobile US",
|
||||
"apn": "epc2.tmobile.com",
|
||||
"types": ["dun"] } ]];
|
||||
return gTestSuite.setDataApnSettings(apnSettings);
|
||||
})
|
||||
.then(() => gTestSuite.startTetheringTest(function() {
|
||||
return gTestSuite.ensureWifiEnabled(false)
|
||||
.then(() => gTestSuite.setWifiTetheringEnabled(true, true))
|
||||
.then(() => gTestSuite.setWifiTetheringEnabled(false, true));
|
||||
}))
|
||||
// Restore apn settings.
|
||||
.then(() => {
|
||||
if (origApnSettings) {
|
||||
return gTestSuite.setDataApnSettings(origApnSettings);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -7,5 +7,6 @@ MARIONETTE_HEAD_JS = 'head.js';
|
|||
|
||||
gTestSuite.startTetheringTest(function() {
|
||||
return gTestSuite.ensureWifiEnabled(false)
|
||||
.then(() => gTestSuite.setWifiTetheringEnabled(true));
|
||||
.then(() => gTestSuite.setWifiTetheringEnabled(true))
|
||||
.then(() => gTestSuite.setWifiTetheringEnabled(false));
|
||||
});
|
||||
|
|
|
@ -405,16 +405,16 @@ partial interface Window {
|
|||
|
||||
[Func="IsChromeOrXBL"]
|
||||
interface ChromeWindow {
|
||||
[Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
const unsigned short STATE_MAXIMIZED = 1;
|
||||
[Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
const unsigned short STATE_MINIMIZED = 2;
|
||||
[Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
const unsigned short STATE_NORMAL = 3;
|
||||
[Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
const unsigned short STATE_FULLSCREEN = 4;
|
||||
|
||||
[Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
readonly attribute unsigned short windowState;
|
||||
|
||||
/**
|
||||
|
@ -422,40 +422,40 @@ interface ChromeWindow {
|
|||
* utility functions implemented by chrome script. It will be null
|
||||
* for DOMWindows not corresponding to browsers.
|
||||
*/
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
attribute nsIBrowserDOMWindow? browserDOMWindow;
|
||||
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
void getAttention();
|
||||
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
void getAttentionWithCycleCount(long aCycleCount);
|
||||
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
void setCursor(DOMString cursor);
|
||||
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow", UnsafeInPrerendering]
|
||||
void maximize();
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow", UnsafeInPrerendering]
|
||||
void minimize();
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow", UnsafeInPrerendering]
|
||||
void restore();
|
||||
|
||||
/**
|
||||
* Notify a default button is loaded on a dialog or a wizard.
|
||||
* defaultButton is the default button.
|
||||
*/
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
void notifyDefaultButtonLoaded(Element defaultButton);
|
||||
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
readonly attribute nsIMessageBroadcaster messageManager;
|
||||
|
||||
/**
|
||||
* Returns the message manager identified by the given group name that
|
||||
* manages all frame loaders belonging to that group.
|
||||
*/
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
nsIMessageBroadcaster getGroupMessageManager(DOMString aGroup);
|
||||
|
||||
/**
|
||||
|
@ -468,7 +468,7 @@ interface ChromeWindow {
|
|||
*
|
||||
* Throws NS_ERROR_NOT_IMPLEMENTED if the OS doesn't support this.
|
||||
*/
|
||||
[Throws, Func="nsGlobalWindow::IsChromeWindow"]
|
||||
[Throws, Func="nsGlobalWindow::IsPrivilegedChromeWindow"]
|
||||
void beginWindowMove(Event mouseDownEvent, optional Element? panel = null);
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_dom_ServiceWorkerRegistration_h
|
||||
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/ServiceWorkerBinding.h"
|
||||
#include "mozilla/dom/ServiceWorkerCommon.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
|
|
@ -1100,8 +1100,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> sameOriginChecker = nsContentUtils::GetSameOriginChecker();
|
||||
NS_ENSURE_TRUE(sameOriginChecker, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsCOMPtr<nsIInterfaceRequestor> sameOriginChecker = nsContentUtils::SameOriginChecker();
|
||||
|
||||
channel->SetNotificationCallbacks(sameOriginChecker);
|
||||
|
||||
|
|
|
@ -434,11 +434,7 @@ XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
|
|||
mListenerManager = elm;
|
||||
|
||||
// Create a channel
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
|
||||
if (!req) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::SameOriginChecker();
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// nsIRequest::LOAD_BACKGROUND prevents throbber from becoming active,
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
}
|
||||
|
||||
// We're not COM-y, so we don't get refcounts by default
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Decoder)
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Decoder, MOZ_OVERRIDE)
|
||||
|
||||
// Implement IResumable.
|
||||
virtual void Resume() MOZ_OVERRIDE;
|
||||
|
|
|
@ -453,7 +453,7 @@ AsmJSModule::setAutoFlushICacheRange()
|
|||
static void
|
||||
AsmJSReportOverRecursed()
|
||||
{
|
||||
JSContext *cx = PerThreadData::innermostAsmJSActivation()->cx();
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
js_ReportOverRecursed(cx);
|
||||
}
|
||||
|
||||
|
@ -461,14 +461,14 @@ static void
|
|||
OnDetached()
|
||||
{
|
||||
// See hasDetachedHeap comment in LinkAsmJS.
|
||||
JSContext *cx = PerThreadData::innermostAsmJSActivation()->cx();
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
static bool
|
||||
AsmJSHandleExecutionInterrupt()
|
||||
{
|
||||
AsmJSActivation *act = PerThreadData::innermostAsmJSActivation();
|
||||
AsmJSActivation *act = JSRuntime::innermostAsmJSActivation();
|
||||
act->module().setInterrupted(true);
|
||||
bool ret = CheckForInterrupt(act->cx());
|
||||
act->module().setInterrupted(false);
|
||||
|
@ -478,7 +478,7 @@ AsmJSHandleExecutionInterrupt()
|
|||
static int32_t
|
||||
CoerceInPlace_ToInt32(MutableHandleValue val)
|
||||
{
|
||||
JSContext *cx = PerThreadData::innermostAsmJSActivation()->cx();
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
|
||||
int32_t i32;
|
||||
if (!ToInt32(cx, val, &i32))
|
||||
|
@ -491,7 +491,7 @@ CoerceInPlace_ToInt32(MutableHandleValue val)
|
|||
static int32_t
|
||||
CoerceInPlace_ToNumber(MutableHandleValue val)
|
||||
{
|
||||
JSContext *cx = PerThreadData::innermostAsmJSActivation()->cx();
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
|
||||
double dbl;
|
||||
if (!ToNumber(cx, val, &dbl))
|
||||
|
@ -570,7 +570,7 @@ InvokeFromAsmJS(AsmJSActivation *activation, int32_t exitIndex, int32_t argc, Va
|
|||
static int32_t
|
||||
InvokeFromAsmJS_Ignore(int32_t exitIndex, int32_t argc, Value *argv)
|
||||
{
|
||||
AsmJSActivation *activation = PerThreadData::innermostAsmJSActivation();
|
||||
AsmJSActivation *activation = JSRuntime::innermostAsmJSActivation();
|
||||
JSContext *cx = activation->cx();
|
||||
|
||||
RootedValue rval(cx);
|
||||
|
@ -582,7 +582,7 @@ InvokeFromAsmJS_Ignore(int32_t exitIndex, int32_t argc, Value *argv)
|
|||
static int32_t
|
||||
InvokeFromAsmJS_ToInt32(int32_t exitIndex, int32_t argc, Value *argv)
|
||||
{
|
||||
AsmJSActivation *activation = PerThreadData::innermostAsmJSActivation();
|
||||
AsmJSActivation *activation = JSRuntime::innermostAsmJSActivation();
|
||||
JSContext *cx = activation->cx();
|
||||
|
||||
RootedValue rval(cx);
|
||||
|
@ -602,7 +602,7 @@ InvokeFromAsmJS_ToInt32(int32_t exitIndex, int32_t argc, Value *argv)
|
|||
static int32_t
|
||||
InvokeFromAsmJS_ToNumber(int32_t exitIndex, int32_t argc, Value *argv)
|
||||
{
|
||||
AsmJSActivation *activation = PerThreadData::innermostAsmJSActivation();
|
||||
AsmJSActivation *activation = JSRuntime::innermostAsmJSActivation();
|
||||
JSContext *cx = activation->cx();
|
||||
|
||||
RootedValue rval(cx);
|
||||
|
|
|
@ -448,7 +448,7 @@ HandleFault(PEXCEPTION_POINTERS exception)
|
|||
return false;
|
||||
AutoSetHandlingSignal handling(rt);
|
||||
|
||||
AsmJSActivation *activation = rt->mainThread.asmJSActivationStack();
|
||||
AsmJSActivation *activation = rt->asmJSActivationStack();
|
||||
if (!activation)
|
||||
return false;
|
||||
|
||||
|
@ -647,7 +647,7 @@ HandleMachException(JSRuntime *rt, const ExceptionRequest &request)
|
|||
if (request.body.exception != EXC_BAD_ACCESS || request.body.codeCnt != 2)
|
||||
return false;
|
||||
|
||||
AsmJSActivation *activation = rt->mainThread.asmJSActivationStack();
|
||||
AsmJSActivation *activation = rt->asmJSActivationStack();
|
||||
if (!activation)
|
||||
return false;
|
||||
|
||||
|
@ -861,7 +861,7 @@ HandleFault(int signum, siginfo_t *info, void *ctx)
|
|||
return false;
|
||||
AutoSetHandlingSignal handling(rt);
|
||||
|
||||
AsmJSActivation *activation = rt->mainThread.asmJSActivationStack();
|
||||
AsmJSActivation *activation = rt->asmJSActivationStack();
|
||||
if (!activation)
|
||||
return false;
|
||||
|
||||
|
@ -947,12 +947,12 @@ RedirectJitCodeToInterruptCheck(JSRuntime *rt, CONTEXT *context)
|
|||
{
|
||||
RedirectIonBackedgesToInterruptCheck(rt);
|
||||
|
||||
if (AsmJSActivation *activation = rt->mainThread.asmJSActivationStack()) {
|
||||
if (AsmJSActivation *activation = rt->asmJSActivationStack()) {
|
||||
const AsmJSModule &module = activation->module();
|
||||
|
||||
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
|
||||
if (module.containsFunctionPC((void*)rt->mainThread.simulator()->get_pc()))
|
||||
rt->mainThread.simulator()->set_resume_pc(int32_t(module.interruptExit()));
|
||||
if (module.containsFunctionPC((void*)rt->simulator()->get_pc()))
|
||||
rt->simulator()->set_resume_pc(int32_t(module.interruptExit()));
|
||||
#endif
|
||||
|
||||
uint8_t **ppc = ContextToPC(context);
|
||||
|
|
|
@ -8504,25 +8504,21 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
|
||||
// The following is inlined:
|
||||
// JSContext *cx = activation->cx();
|
||||
// Activation *act = cx->mainThread().activation();
|
||||
// Activation *act = cx->runtime()->activation();
|
||||
// act.active_ = true;
|
||||
// act.prevJitTop_ = cx->mainThread().jitTop;
|
||||
// act.prevJitJSContext_ = cx->mainThread().jitJSContext;
|
||||
// cx->mainThread().jitJSContext = cx;
|
||||
// act.prevJitActivation_ = cx->mainThread().jitActivation;
|
||||
// cx->mainThread().jitActivation = act;
|
||||
// act.prevProfilingActivation_ = cx->mainThread().profilingActivation;
|
||||
// cx->mainThread().profilingActivation_ = act;
|
||||
// act.prevJitTop_ = cx->runtime()->jitTop;
|
||||
// act.prevJitJSContext_ = cx->runtime()->jitJSContext;
|
||||
// cx->runtime()->jitJSContext = cx;
|
||||
// act.prevJitActivation_ = cx->runtime()->jitActivation;
|
||||
// cx->runtime()->jitActivation = act;
|
||||
// act.prevProfilingActivation_ = cx->runtime()->profilingActivation;
|
||||
// cx->runtime()->profilingActivation_ = act;
|
||||
// On the ARM store8() uses the secondScratchReg (lr) as a temp.
|
||||
size_t offsetOfActivation = offsetof(JSRuntime, mainThread) +
|
||||
PerThreadData::offsetOfActivation();
|
||||
size_t offsetOfJitTop = offsetof(JSRuntime, mainThread) + offsetof(PerThreadData, jitTop);
|
||||
size_t offsetOfJitJSContext = offsetof(JSRuntime, mainThread) +
|
||||
offsetof(PerThreadData, jitJSContext);
|
||||
size_t offsetOfJitActivation = offsetof(JSRuntime, mainThread) +
|
||||
offsetof(PerThreadData, jitActivation);
|
||||
size_t offsetOfProfilingActivation = offsetof(JSRuntime, mainThread) +
|
||||
PerThreadData::offsetOfProfilingActivation();
|
||||
size_t offsetOfActivation = JSRuntime::offsetOfActivation();
|
||||
size_t offsetOfJitTop = offsetof(JSRuntime, jitTop);
|
||||
size_t offsetOfJitJSContext = offsetof(JSRuntime, jitJSContext);
|
||||
size_t offsetOfJitActivation = offsetof(JSRuntime, jitActivation);
|
||||
size_t offsetOfProfilingActivation = JSRuntime::offsetOfProfilingActivation();
|
||||
masm.loadAsmJSActivation(reg0);
|
||||
masm.loadPtr(Address(reg0, AsmJSActivation::offsetOfContext()), reg3);
|
||||
masm.loadPtr(Address(reg3, JSContext::offsetOfRuntime()), reg0);
|
||||
|
@ -8531,26 +8527,26 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
// act.active_ = true;
|
||||
masm.store8(Imm32(1), Address(reg1, JitActivation::offsetOfActiveUint8()));
|
||||
|
||||
// act.prevJitTop_ = cx->mainThread().jitTop;
|
||||
// act.prevJitTop_ = cx->runtime()->jitTop;
|
||||
masm.loadPtr(Address(reg0, offsetOfJitTop), reg2);
|
||||
masm.storePtr(reg2, Address(reg1, JitActivation::offsetOfPrevJitTop()));
|
||||
|
||||
// act.prevJitJSContext_ = cx->mainThread().jitJSContext;
|
||||
// act.prevJitJSContext_ = cx->runtime()->jitJSContext;
|
||||
masm.loadPtr(Address(reg0, offsetOfJitJSContext), reg2);
|
||||
masm.storePtr(reg2, Address(reg1, JitActivation::offsetOfPrevJitJSContext()));
|
||||
// cx->mainThread().jitJSContext = cx;
|
||||
// cx->runtime()->jitJSContext = cx;
|
||||
masm.storePtr(reg3, Address(reg0, offsetOfJitJSContext));
|
||||
|
||||
// act.prevJitActivation_ = cx->mainThread().jitActivation;
|
||||
// act.prevJitActivation_ = cx->runtime()->jitActivation;
|
||||
masm.loadPtr(Address(reg0, offsetOfJitActivation), reg2);
|
||||
masm.storePtr(reg2, Address(reg1, JitActivation::offsetOfPrevJitActivation()));
|
||||
// cx->mainThread().jitActivation = act;
|
||||
// cx->runtime()->jitActivation = act;
|
||||
masm.storePtr(reg1, Address(reg0, offsetOfJitActivation));
|
||||
|
||||
// act.prevProfilingActivation_ = cx->mainThread().profilingActivation;
|
||||
// act.prevProfilingActivation_ = cx->runtime()->profilingActivation;
|
||||
masm.loadPtr(Address(reg0, offsetOfProfilingActivation), reg2);
|
||||
masm.storePtr(reg2, Address(reg1, Activation::offsetOfPrevProfiling()));
|
||||
// cx->mainThread().profilingActivation_ = act;
|
||||
// cx->runtime()->profilingActivation_ = act;
|
||||
masm.storePtr(reg1, Address(reg0, offsetOfProfilingActivation));
|
||||
}
|
||||
|
||||
|
@ -8571,41 +8567,37 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
Register reg2 = AsmJSIonExitRegD2;
|
||||
|
||||
// The following is inlined:
|
||||
// rt->mainThread.profilingActivation = prevProfilingActivation_;
|
||||
// rt->mainThread.activation()->active_ = false;
|
||||
// rt->mainThread.jitTop = prevJitTop_;
|
||||
// rt->mainThread.jitJSContext = prevJitJSContext_;
|
||||
// rt->mainThread.jitActivation = prevJitActivation_;
|
||||
// rt->profilingActivation = prevProfilingActivation_;
|
||||
// rt->activation()->active_ = false;
|
||||
// rt->jitTop = prevJitTop_;
|
||||
// rt->jitJSContext = prevJitJSContext_;
|
||||
// rt->jitActivation = prevJitActivation_;
|
||||
// On the ARM store8() uses the secondScratchReg (lr) as a temp.
|
||||
size_t offsetOfActivation = offsetof(JSRuntime, mainThread) +
|
||||
PerThreadData::offsetOfActivation();
|
||||
size_t offsetOfJitTop = offsetof(JSRuntime, mainThread) + offsetof(PerThreadData, jitTop);
|
||||
size_t offsetOfJitJSContext = offsetof(JSRuntime, mainThread) +
|
||||
offsetof(PerThreadData, jitJSContext);
|
||||
size_t offsetOfJitActivation = offsetof(JSRuntime, mainThread) +
|
||||
offsetof(PerThreadData, jitActivation);
|
||||
size_t offsetOfProfilingActivation = offsetof(JSRuntime, mainThread) +
|
||||
PerThreadData::offsetOfProfilingActivation();
|
||||
size_t offsetOfActivation = JSRuntime::offsetOfActivation();
|
||||
size_t offsetOfJitTop = offsetof(JSRuntime, jitTop);
|
||||
size_t offsetOfJitJSContext = offsetof(JSRuntime, jitJSContext);
|
||||
size_t offsetOfJitActivation = offsetof(JSRuntime, jitActivation);
|
||||
size_t offsetOfProfilingActivation = JSRuntime::offsetOfProfilingActivation();
|
||||
|
||||
masm.movePtr(AsmJSImmPtr(AsmJSImm_Runtime), reg0);
|
||||
masm.loadPtr(Address(reg0, offsetOfActivation), reg1);
|
||||
|
||||
// rt->mainThread.jitTop = prevJitTop_;
|
||||
// rt->jitTop = prevJitTop_;
|
||||
masm.loadPtr(Address(reg1, JitActivation::offsetOfPrevJitTop()), reg2);
|
||||
masm.storePtr(reg2, Address(reg0, offsetOfJitTop));
|
||||
|
||||
// rt->mainThread.profilingActivation = rt->mainThread.activation()->prevProfiling_;
|
||||
// rt->profilingActivation = rt->activation()->prevProfiling_;
|
||||
masm.loadPtr(Address(reg1, Activation::offsetOfPrevProfiling()), reg2);
|
||||
masm.storePtr(reg2, Address(reg0, offsetOfProfilingActivation));
|
||||
|
||||
// rt->mainThread.activation()->active_ = false;
|
||||
// rt->activation()->active_ = false;
|
||||
masm.store8(Imm32(0), Address(reg1, JitActivation::offsetOfActiveUint8()));
|
||||
|
||||
// rt->mainThread.jitJSContext = prevJitJSContext_;
|
||||
// rt->jitJSContext = prevJitJSContext_;
|
||||
masm.loadPtr(Address(reg1, JitActivation::offsetOfPrevJitJSContext()), reg2);
|
||||
masm.storePtr(reg2, Address(reg0, offsetOfJitJSContext));
|
||||
|
||||
// rt->mainThread.jitActivation = prevJitActivation_;
|
||||
// rt->jitActivation = prevJitActivation_;
|
||||
masm.loadPtr(Address(reg1, JitActivation::offsetOfPrevJitActivation()), reg2);
|
||||
masm.storePtr(reg2, Address(reg0, offsetOfJitActivation));
|
||||
}
|
||||
|
|
|
@ -1353,11 +1353,11 @@ js::testingFunc_assertFloat32(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
static bool
|
||||
TestingFunc_assertValidJitStack(JSContext *cx, unsigned argc, jsval *vp)
|
||||
TestingFunc_assertJitStackInvariants(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
jit::AssertValidJitStack(cx);
|
||||
jit::AssertJitStackInvariants(cx);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
@ -2499,8 +2499,8 @@ gc::ZealModeHelpText),
|
|||
"bailout()",
|
||||
" Force a bailout out of ionmonkey (if running in ionmonkey)."),
|
||||
|
||||
JS_FN_HELP("assertValidJitStack", TestingFunc_assertValidJitStack, 0, 0,
|
||||
"assertValidJitStack()",
|
||||
JS_FN_HELP("assertJitStackInvariants", TestingFunc_assertJitStackInvariants, 0, 0,
|
||||
"assertJitStackInvariants()",
|
||||
" Iterates the Jit stack and check that stack invariants hold."),
|
||||
|
||||
JS_FN_HELP("setJitCompilerOption", SetJitCompilerOption, 2, 0,
|
||||
|
|
|
@ -1,39 +1,49 @@
|
|||
# Spidermonkey JSAPI rooting analysis
|
||||
|
||||
This directory contains scripts and a makefile for running Brian Hackett's
|
||||
static GC rooting analysis on a JS source directory.
|
||||
|
||||
To use it:
|
||||
To use it on SpiderMonkey:
|
||||
|
||||
1. Download and compile sixgill. Make sure the gcc plugin is enabled. (The
|
||||
configure output will tell you.)
|
||||
1. Be on Fedora/CentOS/RedHat Linux x86_64.
|
||||
|
||||
- [sfink] I needed a couple of patches to get it work on Fedora 16/17/18.
|
||||
Ask me if you need them.
|
||||
(Specifically, the prebuilt GCC **won't work on Ubuntu**
|
||||
without the `CFLAGS` and `CXXFLAGS` settings from
|
||||
http://trac.wildfiregames.com/wiki/StaticRootingAnalysis .)
|
||||
|
||||
2. Compile an optimized JS shell that includes the patch at
|
||||
<http://people.mozilla.org/~sfink/data/bug-835552-cwd-snarf>. This does not
|
||||
need to be in the same source tree as you are running these scripts from.
|
||||
Remember the full path to the resulting JS binary; we'll call it $JS_SHELL
|
||||
below.
|
||||
2. Have the Gecko build prerequisites installed.
|
||||
|
||||
3. |make clean| in the objdir of the JS source tree that you're going to be
|
||||
analyzing. (These analysis scripts will default to the tree they are within,
|
||||
but you can point them at another tree.)
|
||||
3. In this directory, run these commands.
|
||||
|
||||
4. in $objdir/js/src/devtools/analysis, |make JS=$JS_SHELL
|
||||
SIXGILL=.../path/to/sixgill...|. You may need one or more of the following
|
||||
additional settings in addition to the |JS| already given:
|
||||
mkdir builddir
|
||||
cd builddir
|
||||
../run-analysis.sh
|
||||
|
||||
- JSOBJDIR: if you are analyzing a different source tree, set this to the
|
||||
objdir of the tree you want to analyze.
|
||||
`run-analysis.sh` is kind of like `configure` and `make` combined:
|
||||
the build directory can be wherever you want
|
||||
and you can name it whatever you want.
|
||||
(You could just run it right here in the source tree, and it would work,
|
||||
but don't do that -- it spits out files all over the place and
|
||||
then you'd have to clean up your source tree later.)
|
||||
|
||||
- ANALYSIS_SCRIPT_DIR: by default, the *.js files within the directory
|
||||
containing this README will be used, but you can point to a different
|
||||
directory full. At the time of this writing, there are some changes not in
|
||||
bhackett's git repo that are necessary, and you'll also need the
|
||||
gen-hazards.sh shell script.
|
||||
Output goes to `hazards.txt` in the builddir.
|
||||
|
||||
- JOBS: set this to the number of parallel jobs you'd like to run the final
|
||||
analysis pass with. This defaults to 6, somewhat randomly, which gave me a
|
||||
large speedup even on a machine with only 2 cores.
|
||||
To use this analysis on any other codebase,
|
||||
make a copy of `run-analysis.sh` and adapt it for your code.
|
||||
|
||||
|
||||
## Overview of what is going on here
|
||||
|
||||
So what does `run-analysis.sh` actually do?
|
||||
|
||||
1. **It insecurely downloads software over HTTP.** Yeah.
|
||||
See `run-analysis.sh` for details.
|
||||
|
||||
2. It runs `run_complete`, a Perl script, which builds the target
|
||||
codebase with a custom hacked GCC, generating a few database files
|
||||
containing (among other data) the full call graph.
|
||||
|
||||
3. Then it runs `analyze.py`, a Python script, which runs all the scripts
|
||||
which actually perform the analysis -- the tricky parts.
|
||||
(Those scripts are written in JS.)
|
||||
|
||||
The results will be in rootingHazards.txt
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
# setup.sh - Run the rooting analysis on SpiderMonkey. See `README.txt` for usage.
|
||||
#
|
||||
# This script is based on the wiki page:
|
||||
# http://trac.wildfiregames.com/wiki/StaticRootingAnalysis
|
||||
|
||||
set -eu
|
||||
|
||||
BUILD_DIR="$PWD"
|
||||
ANALYSIS_SCRIPTDIR="$(dirname $0)"
|
||||
MOZILLA_SRCDIR="$(cd $ANALYSIS_SCRIPTDIR && (hg root || git rev-parse --show-toplevel))"
|
||||
|
||||
|
||||
# Requirements
|
||||
# ============
|
||||
#
|
||||
# Download and unpack the Sixgill plugin binaries.
|
||||
# (`wget -c` skips the download if you've already got the file.)
|
||||
#
|
||||
# This insecurely downloads software over HTTP. Sorry.
|
||||
#
|
||||
# The alternative is building your own Sixgill. That can be a pain and you may
|
||||
# need some patches to get it to work on your Linux distribution. Ask sfink for
|
||||
# details.
|
||||
|
||||
mkdir -p downloads
|
||||
(cd downloads && wget -c http://people.mozilla.org/~sfink/data/hazards-sixgill.tar.xz)
|
||||
tar xf downloads/hazards-sixgill.tar.xz
|
||||
|
||||
# Download and unpack GCC binaries compatible with the Sixgill plugin.
|
||||
(cd downloads && wget -c http://people.mozilla.org/~sfink/data/hazards-gcc4.7.tar.xz)
|
||||
tar xf downloads/hazards-gcc4.7.tar.xz
|
||||
|
||||
|
||||
# Generate raw data (.xdb files)
|
||||
# ==============================
|
||||
#
|
||||
# The first step is to generate the .xdb files that contain the information
|
||||
# needed by the analysis. This is done by compiling SpiderMonkey with the
|
||||
# sixgill plugin enabled. The plugin creates .xdb files which the analysis
|
||||
# consumes.
|
||||
|
||||
PATH=$BUILD_DIR/sixgill/usr/bin:$PATH
|
||||
export PATH
|
||||
GCCDIR=$BUILD_DIR/gcc/bin
|
||||
export GCCDIR
|
||||
|
||||
# Create a SpiderMonkey build directory and run configure.
|
||||
mkdir -p spidermonkey-analysis
|
||||
(cd spidermonkey-analysis && \
|
||||
$MOZILLA_SRCDIR/js/src/configure --enable-optimize)
|
||||
|
||||
# Make SpiderMonkey.
|
||||
$MOZILLA_SRCDIR/js/src/devtools/rootAnalysis/run_complete \
|
||||
--build-root=$BUILD_DIR/spidermonkey-analysis \
|
||||
--binaries=$BUILD_DIR/sixgill/usr/bin \
|
||||
--wrap-dir=$BUILD_DIR/sixgill/usr/libexec/sixgill/scripts/wrap_gcc \
|
||||
--buildcommand='make' \
|
||||
--foreground \
|
||||
--no-logs \
|
||||
.
|
||||
|
||||
|
||||
# Run the analysis
|
||||
# ================
|
||||
|
||||
# Build *another* copy of SpiderMonkey, using the system C++ compiler, without
|
||||
# Sixgill. This is what we use to run the analysis. (We don't let you skip this
|
||||
# step by setting a $JS environment variable or something, because you need
|
||||
# ctypes. Relax and spin a build. Get yourself a cup of tea.)
|
||||
mkdir -p spidermonkey-opt
|
||||
(cd spidermonkey-opt && \
|
||||
$MOZILLA_SRCDIR/js/src/configure --enable-optimize --enable-ctypes --enable-nspr-build && \
|
||||
make -j8)
|
||||
JS="$BUILD_DIR/spidermonkey-opt/dist/bin/js"
|
||||
|
||||
# Write a config file used by analyze.py.
|
||||
rm -f defaults.py
|
||||
echo "objdir = '${BUILD_DIR}/spidermonkey-analysis'" >> defaults.py
|
||||
echo "sixgill = '${BUILD_DIR}/sixgill/usr/libexec/sixgill'" >> defaults.py
|
||||
echo "sixgill_bin = '${BUILD_DIR}/sixgill/usr/bin'" >> defaults.py
|
||||
echo "js = '${JS}'" >> defaults.py
|
||||
echo "analysis_scriptdir = '${ANALYSIS_SCRIPTDIR}'" >> defaults.py
|
||||
|
||||
# Run the script that runs the scripts that do the analysis.
|
||||
python2.7 "${MOZILLA_SRCDIR}/js/src/devtools/rootAnalysis/analyze.py" -j 8 callgraph
|
|
@ -152,7 +152,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only)
|
|||
|
||||
// Check if we have space on the stack.
|
||||
Label stack_ok;
|
||||
void *stack_limit = runtime->mainThread.addressOfJitStackLimit();
|
||||
void *stack_limit = runtime->addressOfJitStackLimit();
|
||||
masm.branchPtr(Assembler::Below, AbsoluteAddress(stack_limit), StackPointer, &stack_ok);
|
||||
|
||||
// Exit with an exception. There is not enough space on the stack
|
||||
|
@ -262,7 +262,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only)
|
|||
}
|
||||
|
||||
// Initialize backtrack stack pointer.
|
||||
masm.loadPtr(AbsoluteAddress(runtime->mainThread.regexpStack.addressOfBase()), backtrack_stack_pointer);
|
||||
masm.loadPtr(AbsoluteAddress(runtime->regexpStack.addressOfBase()), backtrack_stack_pointer);
|
||||
masm.storePtr(backtrack_stack_pointer, Address(StackPointer, offsetof(FrameData, backtrackStackBase)));
|
||||
|
||||
masm.jump(&start_label_);
|
||||
|
@ -422,7 +422,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only)
|
|||
Address backtrackStackBaseAddress(temp2, offsetof(FrameData, backtrackStackBase));
|
||||
masm.subPtr(backtrackStackBaseAddress, backtrack_stack_pointer);
|
||||
|
||||
masm.loadPtr(AbsoluteAddress(runtime->mainThread.regexpStack.addressOfBase()), temp1);
|
||||
masm.loadPtr(AbsoluteAddress(runtime->regexpStack.addressOfBase()), temp1);
|
||||
masm.storePtr(temp1, backtrackStackBaseAddress);
|
||||
masm.addPtr(temp1, backtrack_stack_pointer);
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ NativeRegExpMacroAssembler::CheckBacktrackStackLimit()
|
|||
{
|
||||
JitSpew(SPEW_PREFIX "CheckBacktrackStackLimit");
|
||||
|
||||
const void *limitAddr = runtime->mainThread.regexpStack.addressOfLimit();
|
||||
const void *limitAddr = runtime->regexpStack.addressOfLimit();
|
||||
|
||||
Label no_stack_overflow;
|
||||
masm.branchPtr(Assembler::AboveOrEqual, AbsoluteAddress(limitAddr),
|
||||
|
|
|
@ -36,7 +36,7 @@ using namespace js;
|
|||
using namespace js::irregexp;
|
||||
|
||||
RegExpStackScope::RegExpStackScope(JSRuntime *rt)
|
||||
: regexp_stack(&rt->mainThread.regexpStack)
|
||||
: regexp_stack(&rt->regexpStack)
|
||||
{}
|
||||
|
||||
RegExpStackScope::~RegExpStackScope()
|
||||
|
@ -47,7 +47,7 @@ RegExpStackScope::~RegExpStackScope()
|
|||
int
|
||||
irregexp::GrowBacktrackStack(JSRuntime *rt)
|
||||
{
|
||||
return rt->mainThread.regexpStack.grow();
|
||||
return rt->regexpStack.grow();
|
||||
}
|
||||
|
||||
RegExpStack::RegExpStack()
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
// The bug was that the asm.js linker did not catch that an unshared
|
||||
// view was created on a shared buffer. (Nor did it catch the vice
|
||||
// versa case.) As a consequence the code was not rejected (and run
|
||||
// as plain JS) as it should be. That gave rise to a difference in
|
||||
// output.
|
||||
|
||||
// Original test
|
||||
|
||||
g = (function(stdlib, n, heap) {
|
||||
"use asm";
|
||||
var Float32ArrayView = new stdlib.Float32Array(heap);
|
||||
function f() {
|
||||
return +Float32ArrayView[0]
|
||||
}
|
||||
return f
|
||||
})(this, {}, new SharedArrayBuffer(4096));
|
||||
assertEq(g(), NaN);
|
||||
|
||||
// Additional test: vice versa case.
|
||||
|
||||
try {
|
||||
g = (function(stdlib, n, heap) {
|
||||
"use asm";
|
||||
var Float32ArrayView = new stdlib.SharedFloat32Array(heap);
|
||||
function f() {
|
||||
return +Float32ArrayView[0]
|
||||
}
|
||||
return f
|
||||
})(this, {}, new ArrayBuffer(4096));
|
||||
// If the code runs, as it would with the bug present, it must return NaN.
|
||||
assertEq(g(), NaN);
|
||||
}
|
||||
catch (e) {
|
||||
// If the code throws then that's OK too. The current (January 2015)
|
||||
// semantics is for the SharedFloat32Array constructor to throw if
|
||||
// handed an ArrayBuffer, but asm.js does not execute that constructor
|
||||
// and before the fix it would not throw.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// A resumption value can't have both {return:} and {throw:} properties.
|
||||
|
||||
var g = newGlobal();
|
||||
var dbg = Debugger(g);
|
||||
dbg.onDebuggerStatement = stack => ({return: 1, throw: 2});
|
||||
dbg.uncaughtExceptionHook = exc => ({return: "corrected"});
|
||||
assertEq(g.eval("debugger; false;"), "corrected");
|
|
@ -0,0 +1,16 @@
|
|||
// Error handling if parsing a resumption value throws.
|
||||
|
||||
var g = newGlobal();
|
||||
var dbg = Debugger(g);
|
||||
var rv;
|
||||
dbg.onDebuggerStatement = stack => rv;
|
||||
dbg.uncaughtExceptionHook = function (exc) {
|
||||
assertEq(exc, "BANG");
|
||||
return {return: "recovered"};
|
||||
};
|
||||
|
||||
rv = {get throw() { throw "BANG"; }};
|
||||
assertEq(g.eval("debugger; false;"), "recovered");
|
||||
|
||||
rv = new Proxy({}, {has() { throw "BANG"; }});
|
||||
assertEq(g.eval("debugger; false;"), "recovered");
|
|
@ -0,0 +1,108 @@
|
|||
if (typeof SIMD === "undefined")
|
||||
quit();
|
||||
|
||||
setJitCompilerOption("baseline.warmup.trigger", 10);
|
||||
setJitCompilerOption("ion.warmup.trigger", 30);
|
||||
var max = 40, pivot = 35;
|
||||
|
||||
var i32x4 = SIMD.int32x4;
|
||||
var f32x4 = SIMD.float32x4;
|
||||
var i32x4Add = SIMD.int32x4.add;
|
||||
|
||||
var FakeSIMDType = function (o) { this.x = o.x; this.y = o.y; this.z = o.z; this.w = o.w; };
|
||||
if (this.hasOwnProperty("TypedObject")) {
|
||||
var TO = TypedObject;
|
||||
FakeSIMDType = new TO.StructType({ x: TO.int32, y: TO.int32, z: TO.int32, w: TO.int32 });
|
||||
}
|
||||
|
||||
|
||||
function simdunbox_bail_undef(i, lhs, rhs) {
|
||||
return i32x4Add(lhs, rhs);
|
||||
}
|
||||
|
||||
function simdunbox_bail_object(i, lhs, rhs) {
|
||||
return i32x4Add(lhs, rhs);
|
||||
}
|
||||
|
||||
function simdunbox_bail_typeobj(i, lhs, rhs) {
|
||||
return i32x4Add(lhs, rhs);
|
||||
}
|
||||
|
||||
function simdunbox_bail_badsimd(i, lhs, rhs) {
|
||||
return i32x4Add(lhs, rhs);
|
||||
}
|
||||
|
||||
var arr_undef = [ i32x4(0, 1, 1, 2), i32x4(1, 1, 2, 3) ];
|
||||
var fail_undef = 0;
|
||||
var arr_object = [ i32x4(0, 1, 1, 2), i32x4(1, 1, 2, 3) ];
|
||||
var fail_object = 0;
|
||||
var arr_typeobj = [ i32x4(0, 1, 1, 2), i32x4(1, 1, 2, 3) ];
|
||||
var fail_typeobj = 0;
|
||||
var arr_badsimd = [ i32x4(0, 1, 1, 2), i32x4(1, 1, 2, 3) ];
|
||||
var fail_badsimd = 0;
|
||||
for (var i = 0; i < max; i++) {
|
||||
try {
|
||||
arr_undef[i + 2] = simdunbox_bail_undef(i, arr_undef[i], arr_undef[i + 1]);
|
||||
} catch (x) {
|
||||
arr_undef[i + 2] = arr_undef[i - 1];
|
||||
fail_undef++;
|
||||
}
|
||||
|
||||
try {
|
||||
arr_object[i + 2] = simdunbox_bail_object(i, arr_object[i], arr_object[i + 1]);
|
||||
} catch (x) {
|
||||
arr_object[i + 2] = arr_object[i - 1];
|
||||
fail_object++;
|
||||
}
|
||||
|
||||
try {
|
||||
arr_typeobj[i + 2] = simdunbox_bail_typeobj(i, arr_typeobj[i], arr_typeobj[i + 1]);
|
||||
} catch (x) {
|
||||
arr_typeobj[i + 2] = arr_typeobj[i - 1];
|
||||
fail_typeobj++;
|
||||
}
|
||||
|
||||
try {
|
||||
arr_badsimd[i + 2] = simdunbox_bail_badsimd(i, arr_badsimd[i], arr_badsimd[i + 1]);
|
||||
} catch (x) {
|
||||
arr_badsimd[i + 2] = arr_badsimd[i - 1];
|
||||
fail_badsimd++;
|
||||
}
|
||||
|
||||
if (i + 2 == pivot) {
|
||||
arr_undef[pivot] = undefined;
|
||||
arr_object[pivot] = { x: 0, y: 1, z: 2, w: 3 };
|
||||
arr_typeobj[pivot] = new FakeSIMDType({ x: 0, y: 1, z: 2, w: 3 });
|
||||
arr_badsimd[pivot] = f32x4(0, 1, 2, 3);
|
||||
}
|
||||
}
|
||||
|
||||
assertEq(fail_undef, 2);
|
||||
assertEq(fail_object, 2);
|
||||
assertEq(fail_typeobj, 2);
|
||||
assertEq(fail_badsimd, 2);
|
||||
|
||||
// Assert that all SIMD values are correct.
|
||||
function assertEqX4(real, expected, assertFunc) {
|
||||
if (typeof assertFunc === 'undefined')
|
||||
assertFunc = assertEq;
|
||||
|
||||
assertFunc(real.x, expected[0]);
|
||||
assertFunc(real.y, expected[1]);
|
||||
assertFunc(real.z, expected[2]);
|
||||
assertFunc(real.w, expected[3]);
|
||||
}
|
||||
|
||||
var fib = [0, 1];
|
||||
for (i = 0; i < max + 5; i++)
|
||||
fib[i+2] = (fib[i] + fib[i+1]) | 0;
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
if (i == pivot)
|
||||
continue;
|
||||
var ref = fib.slice(i < pivot ? i : i - 3);
|
||||
assertEqX4(arr_undef[i], ref);
|
||||
assertEqX4(arr_object[i], ref);
|
||||
assertEqX4(arr_typeobj[i], ref);
|
||||
assertEqX4(arr_badsimd[i], ref);
|
||||
}
|
|
@ -4,11 +4,33 @@ var i;
|
|||
|
||||
// Check that an entry frame is always aligned properly.
|
||||
function entryFrame_1() {
|
||||
assertValidJitStack();
|
||||
assertJitStackInvariants();
|
||||
}
|
||||
|
||||
// Check rectifier frames are keeping the same alignment.
|
||||
function rectifierFrame_verify(a, b, c, d) {
|
||||
assertJitStackInvariants();
|
||||
}
|
||||
|
||||
function rectifierFrame_1(i) {
|
||||
rectifierFrame_verify();
|
||||
}
|
||||
function rectifierFrame_2(i) {
|
||||
rectifierFrame_verify(i);
|
||||
}
|
||||
function rectifierFrame_3(i) {
|
||||
rectifierFrame_verify(i, i);
|
||||
}
|
||||
function rectifierFrame_4(i) {
|
||||
rectifierFrame_verify(i, i, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < 40; i++) {
|
||||
entryFrame_1();
|
||||
entryFrame_1(0);
|
||||
entryFrame_1(0, 1);
|
||||
rectifierFrame_1(i);
|
||||
rectifierFrame_2(i);
|
||||
rectifierFrame_3(i);
|
||||
rectifierFrame_4(i);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Getting a property that exists on an ordinary object
|
||||
// does not touch a proxy on its proto chain.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
var angryHandler = new Proxy({}, {
|
||||
get(t, id) { throw new Error("angryHandler should not be queried (" + id + ")"); }
|
||||
});
|
||||
var angryProto = new Proxy({}, angryHandler);
|
||||
var obj = Object.create(angryProto, {
|
||||
x: {value: 3},
|
||||
y: {get: () => 4}
|
||||
});
|
||||
assertThrowsInstanceOf(() => obj.z, Error); // check that angryProto works
|
||||
assertEq(obj.x, 3);
|
||||
assertEq(obj.y, 4);
|
|
@ -0,0 +1,31 @@
|
|||
// Getting a property that's inherted from a proxy calls the proxy's get handler.
|
||||
|
||||
var handler = {
|
||||
get(t, id, r) {
|
||||
assertEq(this, handler);
|
||||
assertEq(t, target);
|
||||
assertEq(id, "foo");
|
||||
assertEq(r, obj);
|
||||
return "bar";
|
||||
},
|
||||
getOwnPropertyDescriptor(t, id) {
|
||||
throw "FAIL";
|
||||
}
|
||||
};
|
||||
|
||||
var target = {};
|
||||
var proto = new Proxy(target, handler);
|
||||
var obj = Object.create(proto);
|
||||
assertEq(obj.foo, "bar");
|
||||
|
||||
// Longer proto chain: same result.
|
||||
var origObj = obj;
|
||||
for (var i = 0; i < 4; i++)
|
||||
obj = Object.create(obj);
|
||||
assertEq(obj.foo, "bar");
|
||||
|
||||
// Chain of transparent proxy wrappers: same result.
|
||||
obj = origObj;
|
||||
for (var i = 0; i < 4; i++)
|
||||
obj = new Proxy(obj, {});
|
||||
assertEq(obj.foo, "bar");
|
|
@ -0,0 +1,21 @@
|
|||
// Recursion through the get hook works; runaway recursion is checked.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
var hits = 0, limit = 10;
|
||||
var proto = new Proxy({}, {
|
||||
get(t, id, r) {
|
||||
assertEq(r, obj);
|
||||
if (hits++ >= limit)
|
||||
return "ding";
|
||||
return obj[id];
|
||||
}
|
||||
});
|
||||
|
||||
var obj = Object.create(proto);
|
||||
assertEq(obj.prop, "ding");
|
||||
|
||||
hits = 0;
|
||||
limit = Infinity;
|
||||
assertThrowsInstanceOf(() => obj.prop, InternalError);
|
||||
assertEq(hits > 10, true);
|
|
@ -0,0 +1,6 @@
|
|||
// A proxy P whose target is an object X whose prototype is an array V inherits V.length.
|
||||
|
||||
var V = [1, 2, 3];
|
||||
var X = Object.create(V);
|
||||
var P = new Proxy(X, {});
|
||||
assertEq(P.length, 3);
|
|
@ -0,0 +1,18 @@
|
|||
// Getting a property O.X, inherited from a transparent cross-compartment wrapper W
|
||||
// that wraps a Proxy P.
|
||||
|
||||
var g = newGlobal();
|
||||
var target = {}
|
||||
var P = new Proxy(target, {
|
||||
get(t, id, r) {
|
||||
assertEq(t, target);
|
||||
assertEq(id, "X");
|
||||
assertEq(r, wO);
|
||||
return "vega";
|
||||
}
|
||||
});
|
||||
|
||||
g.W = P;
|
||||
g.eval("var O = Object.create(W);");
|
||||
var wO = g.O;
|
||||
assertEq(g.eval("O.X"), "vega");
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче