Loading dom/telephony/test/marionette/test_conference.js +4 −26 Original line number Diff line number Diff line Loading @@ -4,10 +4,7 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let conference = telephony.conferenceGroup; let conference; let outNumber = "5555551111"; let inNumber = "5555552222"; let inNumber2 = "5555553333"; Loading Loading @@ -43,25 +40,6 @@ function checkState(telephonyActive, telephonyCalls, conferenceState, } } function verifyInitialState() { log("Verifying initial state."); ok(telephony); ok(conference); emulator.run("gsm clear", function(result) { log("Clear up calls from a previous test if any."); is(result[0], "OK"); // No more calls in the list; give time for emulator to catch up. waitFor(function next() { checkState(null, [], '', []); dial(); }, function isDone() { return (telephony.calls.length === 0); }); }); } function dial() { log("Making an outgoing call."); outgoingCall = telephony.dial(outNumber); Loading Loading @@ -701,11 +679,11 @@ function hangUpLastCall() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } // Start the test startTest(function() { verifyInitialState(); conference = telephony.conferenceGroup; ok(conference); dial(); }); dom/telephony/test/marionette/test_crash_emulator.js +1 −36 Original line number Diff line number Diff line Loading @@ -4,44 +4,9 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let outNumber = "5555551111"; let outgoingCall; function getExistingCalls() { emulator.run("gsm list", function(result) { log("Initial call list: " + result); if (result[0] == "OK") { dial(); } else { cancelExistingCalls(result); } }); } function cancelExistingCalls(callList) { if (callList.length && callList[0] != "OK") { // Existing calls remain; get rid of the next one in the list nextCall = callList.shift().split(/\s+/)[2].trim(); log("Cancelling existing call '" + nextCall +"'"); emulator.run("gsm cancel " + nextCall, function(result) { if (result[0] == "OK") { cancelExistingCalls(callList); } else { log("Failed to cancel existing call"); cleanUp(); } }); } else { // No more calls in the list; give time for emulator to catch up waitFor(dial, function() { return (telephony.calls.length === 0); }); } } function dial() { log("Make an outgoing call."); outgoingCall = telephony.dial(outNumber); Loading Loading @@ -75,5 +40,5 @@ function cleanUp(){ } startTest(function() { getExistingCalls(); dial(); }); dom/telephony/test/marionette/test_emergency.js +1 −25 Original line number Diff line number Diff line Loading @@ -4,33 +4,10 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number = "911"; let outgoing; let calls; function verifyInitialState() { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); calls = telephony.calls; emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } function dial() { log("Make an emergency call."); Loading Loading @@ -103,10 +80,9 @@ function hangUp() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } startTest(function() { verifyInitialState(); dial(); }); dom/telephony/test/marionette/test_emergency_badNumber.js +1 −25 Original line number Diff line number Diff line Loading @@ -4,33 +4,10 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number = "not a valid emergency number"; let outgoing; let calls; function verifyInitialState() { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); calls = telephony.calls; emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } function dial() { log("Make an outgoing call to an invalid number."); Loading Loading @@ -62,10 +39,9 @@ function dial() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } startTest(function() { verifyInitialState(); dial(); }); dom/telephony/test/marionette/test_emergency_label.js +5 −59 Original line number Diff line number Diff line Loading @@ -4,9 +4,6 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number; let emergency; let outgoing; Loading @@ -19,60 +16,6 @@ let expectedResults = [ ["777", false], ]; function getExistingCalls() { emulator.run("gsm list", function(result) { log("Initial call list: " + result); if (result[0] == "OK") { verifyInitialState(false); } else { cancelExistingCalls(result); } }); } function cancelExistingCalls(callList) { if (callList.length && callList[0] != "OK") { // Existing calls remain; get rid of the next one in the list nextCall = callList.shift().split(/\s+/)[2].trim(); log("Cancelling existing call '" + nextCall +"'"); emulator.run("gsm cancel " + nextCall, function(result) { if (result[0] == "OK") { cancelExistingCalls(callList); } else { log("Failed to cancel existing call"); cleanUp(); } }); } else { // No more calls in the list; give time for emulator to catch up waitFor(verifyInitialState, function() { return (telephony.calls.length === 0); }); } } function verifyInitialState(confirmNoCalls = true) { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); if (confirmNoCalls) { emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } else { dial(); } } function createGoldenCallListResult0(number, state) { // "outbound to xxxxxxxxxx : ringing" let padPattern = " "; Loading Loading @@ -154,7 +97,6 @@ function hangUp() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } Loading @@ -165,8 +107,12 @@ function verifyNextEmergencyLabel() { log("Running test case: " + testCase + "/" + expectedResults.length); number = expectedResults[testCase][0]; emergency = expectedResults[testCase][1]; getExistingCalls(); testCase++; // No more calls in the list; give time for emulator to catch up waitFor(dial, function() { return (telephony.calls.length === 0); }); } } Loading Loading
dom/telephony/test/marionette/test_conference.js +4 −26 Original line number Diff line number Diff line Loading @@ -4,10 +4,7 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let conference = telephony.conferenceGroup; let conference; let outNumber = "5555551111"; let inNumber = "5555552222"; let inNumber2 = "5555553333"; Loading Loading @@ -43,25 +40,6 @@ function checkState(telephonyActive, telephonyCalls, conferenceState, } } function verifyInitialState() { log("Verifying initial state."); ok(telephony); ok(conference); emulator.run("gsm clear", function(result) { log("Clear up calls from a previous test if any."); is(result[0], "OK"); // No more calls in the list; give time for emulator to catch up. waitFor(function next() { checkState(null, [], '', []); dial(); }, function isDone() { return (telephony.calls.length === 0); }); }); } function dial() { log("Making an outgoing call."); outgoingCall = telephony.dial(outNumber); Loading Loading @@ -701,11 +679,11 @@ function hangUpLastCall() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } // Start the test startTest(function() { verifyInitialState(); conference = telephony.conferenceGroup; ok(conference); dial(); });
dom/telephony/test/marionette/test_crash_emulator.js +1 −36 Original line number Diff line number Diff line Loading @@ -4,44 +4,9 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let outNumber = "5555551111"; let outgoingCall; function getExistingCalls() { emulator.run("gsm list", function(result) { log("Initial call list: " + result); if (result[0] == "OK") { dial(); } else { cancelExistingCalls(result); } }); } function cancelExistingCalls(callList) { if (callList.length && callList[0] != "OK") { // Existing calls remain; get rid of the next one in the list nextCall = callList.shift().split(/\s+/)[2].trim(); log("Cancelling existing call '" + nextCall +"'"); emulator.run("gsm cancel " + nextCall, function(result) { if (result[0] == "OK") { cancelExistingCalls(callList); } else { log("Failed to cancel existing call"); cleanUp(); } }); } else { // No more calls in the list; give time for emulator to catch up waitFor(dial, function() { return (telephony.calls.length === 0); }); } } function dial() { log("Make an outgoing call."); outgoingCall = telephony.dial(outNumber); Loading Loading @@ -75,5 +40,5 @@ function cleanUp(){ } startTest(function() { getExistingCalls(); dial(); });
dom/telephony/test/marionette/test_emergency.js +1 −25 Original line number Diff line number Diff line Loading @@ -4,33 +4,10 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number = "911"; let outgoing; let calls; function verifyInitialState() { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); calls = telephony.calls; emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } function dial() { log("Make an emergency call."); Loading Loading @@ -103,10 +80,9 @@ function hangUp() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } startTest(function() { verifyInitialState(); dial(); });
dom/telephony/test/marionette/test_emergency_badNumber.js +1 −25 Original line number Diff line number Diff line Loading @@ -4,33 +4,10 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number = "not a valid emergency number"; let outgoing; let calls; function verifyInitialState() { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); calls = telephony.calls; emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } function dial() { log("Make an outgoing call to an invalid number."); Loading Loading @@ -62,10 +39,9 @@ function dial() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } startTest(function() { verifyInitialState(); dial(); });
dom/telephony/test/marionette/test_emergency_label.js +5 −59 Original line number Diff line number Diff line Loading @@ -4,9 +4,6 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; SpecialPowers.addPermission("telephony", true, document); let telephony = window.navigator.mozTelephony; let number; let emergency; let outgoing; Loading @@ -19,60 +16,6 @@ let expectedResults = [ ["777", false], ]; function getExistingCalls() { emulator.run("gsm list", function(result) { log("Initial call list: " + result); if (result[0] == "OK") { verifyInitialState(false); } else { cancelExistingCalls(result); } }); } function cancelExistingCalls(callList) { if (callList.length && callList[0] != "OK") { // Existing calls remain; get rid of the next one in the list nextCall = callList.shift().split(/\s+/)[2].trim(); log("Cancelling existing call '" + nextCall +"'"); emulator.run("gsm cancel " + nextCall, function(result) { if (result[0] == "OK") { cancelExistingCalls(callList); } else { log("Failed to cancel existing call"); cleanUp(); } }); } else { // No more calls in the list; give time for emulator to catch up waitFor(verifyInitialState, function() { return (telephony.calls.length === 0); }); } } function verifyInitialState(confirmNoCalls = true) { log("Verifying initial state."); ok(telephony); is(telephony.active, null); ok(telephony.calls); is(telephony.calls.length, 0); if (confirmNoCalls) { emulator.run("gsm list", function(result) { log("Initial call list: " + result); is(result[0], "OK"); if (result[0] == "OK") { dial(); } else { log("Call exists from a previous test, failing out."); cleanUp(); } }); } else { dial(); } } function createGoldenCallListResult0(number, state) { // "outbound to xxxxxxxxxx : ringing" let padPattern = " "; Loading Loading @@ -154,7 +97,6 @@ function hangUp() { } function cleanUp() { SpecialPowers.removePermission("telephony", document); finish(); } Loading @@ -165,8 +107,12 @@ function verifyNextEmergencyLabel() { log("Running test case: " + testCase + "/" + expectedResults.length); number = expectedResults[testCase][0]; emergency = expectedResults[testCase][1]; getExistingCalls(); testCase++; // No more calls in the list; give time for emulator to catch up waitFor(dial, function() { return (telephony.calls.length === 0); }); } } Loading