From 79380f89c80ca470fce70e111faa1b8a5cabd7f2 Mon Sep 17 00:00:00 2001 From: "Szu-Yu Chen [:aknow]" Date: Wed, 17 Dec 2014 23:47:55 +0800 Subject: [PATCH] Bug 1100200 - Part 4: Merge test cases into test_outgoing_basic_operations.js. r=hsinyi --- dom/telephony/test/marionette/manifest.ini | 8 +- .../test_incoming_basic_operations.js | 20 +-- .../marionette/test_outgoing_answer_hangup.js | 24 ---- .../test_outgoing_answer_local_hangup.js | 24 ---- .../test_outgoing_basic_operations.js | 117 ++++++++++++++++++ .../test_outgoing_hangup_alerting.js | 22 ---- .../marionette/test_outgoing_hangup_held.js | 26 ---- .../marionette/test_outgoing_hold_resume.js | 28 ----- .../test/marionette/test_outgoing_reject.js | 22 ---- .../test_outgoing_remote_hangup_held.js | 26 ---- 10 files changed, 128 insertions(+), 189 deletions(-) delete mode 100644 dom/telephony/test/marionette/test_outgoing_answer_hangup.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js create mode 100644 dom/telephony/test/marionette/test_outgoing_basic_operations.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_hangup_alerting.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_hangup_held.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_hold_resume.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_reject.js delete mode 100644 dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js diff --git a/dom/telephony/test/marionette/manifest.ini b/dom/telephony/test/marionette/manifest.ini index 0f3a09f269a0..5e725675d82b 100644 --- a/dom/telephony/test/marionette/manifest.ini +++ b/dom/telephony/test/marionette/manifest.ini @@ -38,22 +38,16 @@ qemu = true [test_mmi_unlock_puk.js] [test_multiple_hold.js] [test_outgoing_already_held.js] -[test_outgoing_answer_hangup.js] [test_outgoing_answer_hangup_oncallschanged.js] -[test_outgoing_answer_local_hangup.js] [test_outgoing_answer_radio_off.js] [test_outgoing_auto_hold.js] [test_outgoing_badNumber.js] +[test_outgoing_basic_operations.js] [test_outgoing_busy.js] [test_outgoing_emergency_in_airplane_mode.js] [test_outgoing_error_state.js] -[test_outgoing_hangup_alerting.js] -[test_outgoing_hangup_held.js] -[test_outgoing_hold_resume.js] [test_outgoing_onstatechange.js] [test_outgoing_radio_off.js] -[test_outgoing_reject.js] -[test_outgoing_remote_hangup_held.js] [test_outgoing_when_two_calls_on_line.js] [test_ready.js] [test_redundant_operations.js] diff --git a/dom/telephony/test/marionette/test_incoming_basic_operations.js b/dom/telephony/test/marionette/test_incoming_basic_operations.js index f66d7ed79bb0..5df529d07bb8 100644 --- a/dom/telephony/test/marionette/test_incoming_basic_operations.js +++ b/dom/telephony/test/marionette/test_incoming_basic_operations.js @@ -19,16 +19,6 @@ function answer() { .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active])); } -function hangUp() { - return gHangUp(inCall) - .then(() => gCheckAll(null, [], "", [], [])); -} - -function remoteHangUp() { - return gRemoteHangUp(inCall) - .then(() => gCheckAll(null, [], "", [], [])); -} - function hold() { return gHold(inCall) .then(() => gCheckAll(null, [inCall], "", [], [inInfo.held])); @@ -39,6 +29,16 @@ function resume() { .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active])); } +function hangUp() { + return gHangUp(inCall) + .then(() => gCheckAll(null, [], "", [], [])); +} + +function remoteHangUp() { + return gRemoteHangUp(inCall) + .then(() => gCheckAll(null, [], "", [], [])); +} + // Test cases. function testIncomingReject() { diff --git a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js b/dom/telephony/test/marionette/test_outgoing_answer_hangup.js deleted file mode 100644 index 36288d135d06..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js +++ /dev/null @@ -1,24 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - .then(() => gRemoteAnswer(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - - // Hang-up - .then(() => gRemoteHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js b/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js deleted file mode 100644 index 177dcdb93be3..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js +++ /dev/null @@ -1,24 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - .then(() => gRemoteAnswer(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - - // Hang-up - .then(() => gHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_basic_operations.js b/dom/telephony/test/marionette/test_outgoing_basic_operations.js new file mode 100644 index 000000000000..ac0acf56ac08 --- /dev/null +++ b/dom/telephony/test/marionette/test_outgoing_basic_operations.js @@ -0,0 +1,117 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 90000; +MARIONETTE_HEAD_JS = 'head.js'; + +const outNumber = "5555551111"; +const outInfo = gOutCallStrPool(outNumber); +let outCall; + +function outgoing() { + return gDial(outNumber) + .then(call => outCall = call) + .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])); +} + +function answer() { + return gRemoteAnswer(outCall) + .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])); +} + +function hangUp() { + return gHangUp(outCall) + .then(() => gCheckAll(null, [], "", [], [])); +} + +function remoteHangUp() { + return gRemoteHangUp(outCall) + .then(() => gCheckAll(null, [], "", [], [])); +} + +function hold() { + return gHold(outCall) + .then(() => gCheckAll(null, [outCall], "", [], [outInfo.held])); +} + +function resume() { + return gResume(outCall) + .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])); +} + +// Test cases. + +function testOutgoingReject() { + log("= testOutgoingReject ="); + return outgoing() + .then(() => remoteHangUp()); +} + +function testOutgoingCancel() { + log("= testOutgoingCancel ="); + return outgoing() + .then(() => hangUp()); +} + +function testOutgoingAnswerHangUp() { + log("= testOutgoingAnswerHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => hangUp()); +} + +function testOutgoingAnswerRemoteHangUp() { + log("= testOutgoingAnswerRemoteHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => remoteHangUp()); +} + +function testOutgoingAnswerHoldHangUp() { + log("= testOutgoingAnswerHoldHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => hold()) + .then(() => hangUp()); +} + +function testOutgoingAnswerHoldRemoteHangUp() { + log("= testOutgoingAnswerHoldRemoteHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => hold()) + .then(() => remoteHangUp()); +} + +function testOutgoingAnswerHoldResumeHangUp() { + log("= testOutgoingAnswerHoldResumeHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => hold()) + .then(() => resume()) + .then(() => hangUp()); +} + +function testOutgoingAnswerHoldResumeRemoteHangUp() { + log("= testOutgoingAnswerHoldResumeRemoteHangUp ="); + return outgoing() + .then(() => answer()) + .then(() => hold()) + .then(() => resume()) + .then(() => remoteHangUp()); +} + +startTest(function() { + Promise.resolve() + .then(() => testOutgoingReject()) + .then(() => testOutgoingCancel()) + .then(() => testOutgoingAnswerHangUp()) + .then(() => testOutgoingAnswerRemoteHangUp()) + .then(() => testOutgoingAnswerHoldHangUp()) + .then(() => testOutgoingAnswerHoldRemoteHangUp()) + .then(() => testOutgoingAnswerHoldResumeHangUp()) + .then(() => testOutgoingAnswerHoldResumeRemoteHangUp()) + + .catch(error => ok(false, "Promise reject: " + error)) + .then(finish); +}); diff --git a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js b/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js deleted file mode 100644 index 3fc28180d18c..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js +++ /dev/null @@ -1,22 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - - // Hang-up - .then(() => gRemoteHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_hangup_held.js b/dom/telephony/test/marionette/test_outgoing_hangup_held.js deleted file mode 100644 index 4f6334685dc7..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_hangup_held.js +++ /dev/null @@ -1,26 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - .then(() => gRemoteAnswer(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - .then(() => gHold(outCall)) - .then(() => gCheckAll(null, [outCall], "", [], [outInfo.held])) - - // Hang-up - .then(() => gHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_hold_resume.js b/dom/telephony/test/marionette/test_outgoing_hold_resume.js deleted file mode 100644 index 2b289a7ae8a7..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_hold_resume.js +++ /dev/null @@ -1,28 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - .then(() => gRemoteAnswer(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - .then(() => gHold(outCall)) - .then(() => gCheckAll(null, [outCall], "", [], [outInfo.held])) - .then(() => gResume(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - - // Hang-up - .then(() => gRemoteHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_reject.js b/dom/telephony/test/marionette/test_outgoing_reject.js deleted file mode 100644 index 3fc28180d18c..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_reject.js +++ /dev/null @@ -1,22 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - - // Hang-up - .then(() => gRemoteHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -}); diff --git a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js b/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js deleted file mode 100644 index cb4e13b24080..000000000000 --- a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js +++ /dev/null @@ -1,26 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 60000; -MARIONETTE_HEAD_JS = 'head.js'; - -const outNumber = "5555551111"; -const outInfo = gOutCallStrPool(outNumber); -let outCall; - -startTest(function() { - gDial(outNumber) - .then(call => outCall = call) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing])) - .then(() => gRemoteAnswer(outCall)) - .then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active])) - .then(() => gHold(outCall)) - .then(() => gCheckAll(null, [outCall], "", [], [outInfo.held])) - - // Hang-up - .then(() => gRemoteHangUp(outCall)) - .then(() => gCheckAll(null, [], "", [], [])) - - .catch(error => ok(false, "Promise reject: " + error)) - .then(finish); -});