Bug 1103731 - Part 3: Update the related testcase. r=aknow
authorBen Hsu <bhsu@mozilla.com>
Mon, 26 Jan 2015 00:38:00 -0500
changeset 226491 12ac667d15324d19dc053b634f138381926c1a99
parent 226490 422bed2705ee75d95574385aef6bf17321c2ad69
child 226492 fd5c7ee88faaf08a0a1c4e6797a5d0df4e2dc263
push id28198
push usercbook@mozilla.com
push dateThu, 29 Jan 2015 15:11:14 +0000
treeherdermozilla-central@0467412f8413 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaknow
bugs1103731
milestone38.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 1103731 - Part 3: Update the related testcase. r=aknow
dom/telephony/test/marionette/test_outgoing_auto_hold.js
--- a/dom/telephony/test/marionette/test_outgoing_auto_hold.js
+++ b/dom/telephony/test/marionette/test_outgoing_auto_hold.js
@@ -1,50 +1,93 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = 'head.js';
 
 function testAutoHoldCall() {
+  log('= testAutoHoldCall =');
+
   let outCall1;
   let outCall2;
+  const callNumber1 = "0900000001";
+  const callNumber2 = "0900000002";
 
-  return gDial("0900000001")
+  return Promise.resolve()
+    .then(() => gDial(callNumber1))
     .then(call => { outCall1 = call; })
     .then(() => gRemoteAnswer(outCall1))
     .then(() => {
       is(outCall1.state, "connected");
     })
-    .then(() => gDial("0900000002"))
+    .then(() => gDial(callNumber2))
     .then(call => { outCall2 = call; })
     .then(() => {
       is(outCall1.state, "held");
     })
     .then(() => gRemoteHangUpCalls([outCall1, outCall2]));
 }
 
+
+function testAutoHoldCallFailed() {
+  log('= testAutoHoldCallFailed =');
+
+  let outCall1;
+  let outCall2;
+  const callNumber1 = "0900000011";
+  const callNumber2 = "0900000012";
+
+  return Promise.resolve()
+    .then(() => emulator.runCmd("gsm disable hold"))
+    .then(() => gDial(callNumber1))
+    .then(call => { outCall1 = call; })
+    .then(() => gRemoteAnswer(outCall1))
+    .then(() => {
+      is(outCall1.state, "connected");
+    })
+    .then(() => gDial(callNumber2))
+    .then(call => {
+      ok(false, "The second |dial()| should be rejected.");
+      outCall2 = call;
+      return gRemoteHangUpCalls([outCall2]);
+    }, () => log("The second |dial()| is rejected as expected."))
+    .then(() => gRemoteHangUpCalls([outCall1]))
+    .then(() => emulator.runCmd("gsm enable hold"));
+}
+
 function testAutoHoldConferenceCall() {
+  log('= testAutoHoldConferenceCall =');
+
   let subCall1;
   let subCall2;
   let outCall;
+  const subNumber1 = "0900000021";
+  const subNumber2 = "0900000022";
+  const outNumber = "0900000023";
 
-  return gSetupConference(["0900000001", "0900000002"])
+  return Promise.resolve()
+    .then(() => gSetupConference([subNumber1, subNumber2]))
     .then(calls => {
       [subCall1, subCall2] = calls;
       is(conference.state, "connected");
     })
-    .then(() => gDial("0900000003"))
+    .then(() => gDial(outNumber))
     .then(call => { outCall = call; })
     .then(() => {
       is(subCall1.state, "held");
       is(subCall2.state, "held");
       is(conference.state, "held");
     })
     .then(() => gRemoteHangUpCalls([subCall1, subCall2, outCall]));
 }
 
 startTest(function() {
-  testAutoHoldCall()
+  Promise.resolve()
+    .then(() => testAutoHoldCall())
+    .then(() => testAutoHoldCallFailed())
     .then(() => testAutoHoldConferenceCall())
-    .catch(error => ok(false, "Promise reject: " + error))
+    .catch(error => {
+      ok(false, "Promise reject: " + error);
+      emulator.runCmd("gsm enable hold");
+    })
     .then(finish);
 });