mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 839402 - Part 5 - Test case for updating display condition. r=vicamo
This commit is contained in:
parent
beb4eaa824
commit
89269ffdb0
@ -169,3 +169,64 @@ add_test(function test_read_cdmaspn() {
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify display condition for CDMA.
|
||||
*/
|
||||
add_test(function test_cdma_spn_display_condition() {
|
||||
let worker = newWorker({
|
||||
postRILMessage: function fakePostRILMessage(data) {
|
||||
// Do nothing
|
||||
},
|
||||
postMessage: function fakePostMessage(message) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
let RIL = worker.RIL;
|
||||
let ICCUtilsHelper = worker.ICCUtilsHelper;
|
||||
|
||||
// Set cdma.
|
||||
RIL._isCdma = true;
|
||||
|
||||
// Test updateDisplayCondition runs before any of SIM file is ready.
|
||||
do_check_eq(ICCUtilsHelper.updateDisplayCondition(), true);
|
||||
do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, true);
|
||||
do_check_eq(RIL.iccInfo.isDisplaySpnRequired, false);
|
||||
|
||||
// Test with value.
|
||||
function testDisplayCondition(ruimDisplayCondition,
|
||||
homeSystemIds, homeNetworkIds,
|
||||
currentSystemId, currentNetworkId,
|
||||
expectUpdateDisplayCondition,
|
||||
expectIsDisplaySPNRequired) {
|
||||
RIL.iccInfoPrivate.SPN = {
|
||||
spnDisplayCondition: ruimDisplayCondition
|
||||
};
|
||||
RIL.cdmaHome = {
|
||||
systemId: homeSystemIds,
|
||||
networkId: homeNetworkIds
|
||||
};
|
||||
RIL.cdmaSubscription = {
|
||||
systemId: currentSystemId,
|
||||
networkId: currentNetworkId
|
||||
};
|
||||
|
||||
do_check_eq(ICCUtilsHelper.updateDisplayCondition(), expectUpdateDisplayCondition);
|
||||
do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, false);
|
||||
do_check_eq(RIL.iccInfo.isDisplaySpnRequired, expectIsDisplaySPNRequired);
|
||||
};
|
||||
|
||||
// SPN is not required when ruimDisplayCondition is false.
|
||||
testDisplayCondition(false, [123], [345], 123, 345, true, false);
|
||||
|
||||
// System id and network id are all match.
|
||||
testDisplayCondition(true, [123], [345], 123, 345, true, true);
|
||||
|
||||
// Network is 65535, we should only need to match system id.
|
||||
testDisplayCondition(true, [123], [65535], 123, 345, false, true);
|
||||
|
||||
// Not match.
|
||||
testDisplayCondition(true, [123], [456], 123, 345, true, false);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user