michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: MARIONETTE_TIMEOUT = 30000; michael@0: MARIONETTE_HEAD_JS = "icc_header.js"; michael@0: michael@0: // Emulator's hard coded IMSI: 310260000000000 michael@0: let testCases = [ michael@0: // mvno type, mvno data, request success, expected result michael@0: ["imsi", "3102600", true, true ], michael@0: // x and X means skip the comparison. michael@0: ["imsi", "31026xx0", true, true ], michael@0: ["imsi", "310260x0x", true, true ], michael@0: ["imsi", "310260X00", true, true ], michael@0: ["imsi", "310260XX1", true, false ], michael@0: ["imsi", "31026012", true, false ], michael@0: ["imsi", "310260000000000", true, true ], michael@0: ["imsi", "310260000000000123", true, false ], michael@0: ["imsi", "", false, "InvalidParameter"], michael@0: // Currently we only support imsi match. michael@0: ["spn", "Android", false, "ModeNotSupported"] michael@0: ]; michael@0: michael@0: function matchMvno(mvnoType, mvnoData, success, expectedResult) { michael@0: log("matchMvno: " + mvnoType + ", " + mvnoData); michael@0: let request = icc.matchMvno(mvnoType, mvnoData); michael@0: request.onsuccess = function onsuccess() { michael@0: log("onsuccess: " + request.result); michael@0: ok(success, "onsuccess while error expected"); michael@0: is(request.result, expectedResult); michael@0: testMatchMvno(); michael@0: } michael@0: request.onerror = function onerror() { michael@0: log("onerror: " + request.error.name); michael@0: ok(!success, "onerror while success expected"); michael@0: is(request.error.name, expectedResult); michael@0: testMatchMvno(); michael@0: } michael@0: } michael@0: michael@0: function testMatchMvno() { michael@0: let testCase = testCases.shift(); michael@0: if (!testCase) { michael@0: taskHelper.runNext(); michael@0: return; michael@0: } michael@0: matchMvno(testCase[0], testCase[1], testCase[2], testCase[3]); michael@0: } michael@0: michael@0: taskHelper.push( michael@0: testMatchMvno michael@0: ); michael@0: michael@0: // Start test michael@0: taskHelper.runNext(); michael@0: