Bug 1100200 - Part 2: Merge test cases into test_incoming_basic_operations.js. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Wed, 17 Dec 2014 23:47:54 +0800
changeset 220158 b5572f21d6ab744f9e155dcf68541aacd7389dce
parent 220157 7ea0cf5b6bc644d587b01bdfdb9c669815db14de
child 220159 426b1a22e1abe5b671301f8b9b9cf76034fa65d7
push id10457
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 01:54:25 +0000
treeherderfx-team@0e441ff66c5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs1100200
milestone37.0a1
Bug 1100200 - Part 2: Merge test cases into test_incoming_basic_operations.js. r=hsinyi
dom/telephony/test/marionette/manifest.ini
dom/telephony/test/marionette/test_incoming_answer_hangup.js
dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
dom/telephony/test/marionette/test_incoming_basic_operations.js
dom/telephony/test/marionette/test_incoming_hangup_held.js
dom/telephony/test/marionette/test_incoming_hold_resume.js
dom/telephony/test/marionette/test_incoming_reject.js
dom/telephony/test/marionette/test_incoming_remote_cancel.js
dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
--- a/dom/telephony/test/marionette/manifest.ini
+++ b/dom/telephony/test/marionette/manifest.ini
@@ -23,27 +23,21 @@ qemu = true
 [test_emergency.js]
 [test_emergency_badNumber.js]
 [test_emergency_label.js]
 [test_incall_mmi_call_hold.js]
 [test_incall_mmi_call_waiting.js]
 [test_incall_mmi_conference.js]
 [test_incoming_already_connected.js]
 [test_incoming_already_held.js]
-[test_incoming_answer_hangup.js]
 [test_incoming_answer_hangup_oncallschanged.js]
-[test_incoming_answer_remote_hangup.js]
+[test_incoming_basic_operations.js]
 [test_incoming_connecting_hangup.js]
 [test_incoming_connecting_remote_hangup.js]
-[test_incoming_hangup_held.js]
-[test_incoming_hold_resume.js]
 [test_incoming_onstatechange.js]
-[test_incoming_reject.js]
-[test_incoming_remote_cancel.js]
-[test_incoming_remote_hangup_held.js]
 [test_mmi.js]
 [test_mmi_call_forwarding.js]
 [test_mmi_change_pin.js]
 [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]
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_answer_hangup.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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Answer incoming call
-    .then(() => gAnswer(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Hang-up call
-    .then(() => gHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Answer incoming call
-    .then(() => gAnswer(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Remote hang-up call
-    .then(() => gRemoteHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
new file mode 100644
--- /dev/null
+++ b/dom/telephony/test/marionette/test_incoming_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 inNumber = "5555552222";
+const inInfo = gInCallStrPool(inNumber);
+let inCall;
+
+function incoming() {
+  return gRemoteDial(inNumber)
+    .then(call => inCall = call)
+    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]));
+}
+
+function answer() {
+  return gAnswer(inCall)
+    .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]));
+}
+
+function resume() {
+  return gResume(inCall)
+    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]));
+}
+
+// Test cases.
+
+function testIncomingReject() {
+  log("= testIncomingReject =");
+  return incoming()
+    .then(() => hangUp());
+}
+
+function testIncomingCancel() {
+  log("= testIncomingCancel =");
+  return incoming()
+    .then(() => remoteHangUp());
+}
+
+function testIncomingAnswerHangUp() {
+  log("= testIncomingAnswerHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => hangUp());
+}
+
+function testIncomingAnswerRemoteHangUp() {
+  log("= testIncomingAnswerRemoteHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => remoteHangUp());
+}
+
+function testIncomingAnswerHoldHangUp() {
+  log("= testIncomingAnswerHoldHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => hold())
+    .then(() => hangUp());
+}
+
+function testIncomingAnswerHoldRemoteHangUp() {
+  log("= testIncomingAnswerHoldRemoteHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => hold())
+    .then(() => remoteHangUp());
+}
+
+function testIncomingAnswerHoldResumeHangUp() {
+  log("= testIncomingAnswerHoldResumeHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => hold())
+    .then(() => resume())
+    .then(() => hangUp());
+}
+
+function testIncomingAnswerHoldResumeRemoteHangUp() {
+  log("= testIncomingAnswerHoldResumeRemoteHangUp =");
+  return incoming()
+    .then(() => answer())
+    .then(() => hold())
+    .then(() => resume())
+    .then(() => remoteHangUp());
+}
+
+startTest(function() {
+  Promise.resolve()
+    .then(() => testIncomingReject())
+    .then(() => testIncomingCancel())
+    .then(() => testIncomingAnswerHangUp())
+    .then(() => testIncomingAnswerRemoteHangUp())
+    .then(() => testIncomingAnswerHoldHangUp())
+    .then(() => testIncomingAnswerHoldRemoteHangUp())
+    .then(() => testIncomingAnswerHoldResumeHangUp())
+    .then(() => testIncomingAnswerHoldResumeRemoteHangUp())
+
+    .catch(error => ok(false, "Promise reject: " + error))
+    .then(finish);
+});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_hangup_held.js
+++ /dev/null
@@ -1,30 +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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Answer incoming call
-    .then(() => gAnswer(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Hold the call.
-    .then(() => gHold(inCall))
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.held]))
-
-    // Hang-up call
-    .then(() => gHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_hold_resume.js
+++ /dev/null
@@ -1,34 +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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Answer incoming call
-    .then(() => gAnswer(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Hold the call.
-    .then(() => gHold(inCall))
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.held]))
-
-    // Resume the call.
-    .then(() => gResume(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Hang-up call
-    .then(() => gHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Hang-up call
-    .then(() => gHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_remote_cancel.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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Remote cancel call
-    .then(() => gRemoteHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
+++ /dev/null
@@ -1,30 +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 inNumber = "5555552222";
-const inInfo = gInCallStrPool(inNumber);
-let inCall;
-
-startTest(function() {
-  gRemoteDial(inNumber)
-    .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
-
-    // Answer incoming call
-    .then(() => gAnswer(inCall))
-    .then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
-
-    // Hold the call.
-    .then(() => gHold(inCall))
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.held]))
-
-    // Remote hang-up call
-    .then(() => gRemoteHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});