Bug 1100200 - Part 3: Merge test cases into test_incoming_connecting_hangup.js. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Wed, 17 Dec 2014 23:47:55 +0800
changeset 220217 426b1a22e1abe5b671301f8b9b9cf76034fa65d7
parent 220216 b5572f21d6ab744f9e155dcf68541aacd7389dce
child 220218 6e009bb139fd5999a1279afb07f76737e4707d2e
push id53051
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 02:08:11 +0000
treeherdermozilla-inbound@ffb2b4550976 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs1100200
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1100200 - Part 3: Merge test cases into test_incoming_connecting_hangup.js. r=hsinyi
dom/telephony/test/marionette/manifest.ini
dom/telephony/test/marionette/test_incoming_connecting_hangup.js
dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
--- a/dom/telephony/test/marionette/manifest.ini
+++ b/dom/telephony/test/marionette/manifest.ini
@@ -26,17 +26,16 @@ qemu = true
 [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_oncallschanged.js]
 [test_incoming_basic_operations.js]
 [test_incoming_connecting_hangup.js]
-[test_incoming_connecting_remote_hangup.js]
 [test_incoming_onstatechange.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]
--- a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
@@ -3,27 +3,54 @@
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = 'head.js';
 
 const inNumber = "5555552222";
 const inInfo = gInCallStrPool(inNumber);
 let inCall;
 
-startTest(function() {
-  gRemoteDial(inNumber)
+function incoming() {
+  return gRemoteDial(inNumber)
     .then(call => inCall = call)
-    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
+    .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]));
+}
+
+function connecting() {
+  let promise = gWaitForNamedStateEvent(inCall, "connecting");
+  inCall.answer();
+  return promise;
+}
+
+function hangUp() {
+  return gHangUp(inCall)
+    .then(() => gCheckAll(null, [], "", [], []));
+}
 
-    // Answer incoming call
-    .then(() => {
-      let promise = gWaitForNamedStateEvent(inCall, "connecting");
-      inCall.answer();
-      return promise;
-    })
+function remoteHangUp() {
+  return gRemoteHangUp(inCall)
+    .then(() => gCheckAll(null, [], "", [], []));
+}
+
+// Test cases.
 
-    // Hang-up call
-    .then(() => gHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
+function testConnectingHangUp() {
+  log("= testConnectingHangUp =");
+  return incoming()
+    .then(() => connecting())
+    .then(() => hangUp());
+}
+
+function testConnectingRemoteHangUp() {
+  log("= testConnectingRemoteHangUp =");
+  return incoming()
+    .then(() => connecting())
+    .then(() => remoteHangUp());
+}
+
+startTest(function() {
+  Promise.resolve()
+    .then(() => testConnectingHangUp())
+    .then(() => testConnectingRemoteHangUp())
 
     .catch(error => ok(false, "Promise reject: " + error))
     .then(finish);
 });
deleted file mode 100644
--- a/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
+++ /dev/null
@@ -1,29 +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(() => {
-      let promise = gWaitForNamedStateEvent(inCall, "connecting");
-      inCall.answer();
-      return promise;
-    })
-
-    // Remote hang-up call
-    .then(() => gRemoteHangUp(inCall))
-    .then(() => gCheckAll(null, [], "", [], []))
-
-    .catch(error => ok(false, "Promise reject: " + error))
-    .then(finish);
-});