Bug 1077075 - Part 7: Update the related testcases. r=aknow
☠☠ backed out by 4431d1b8a247 ☠ ☠
authorBen Hsu <bhsu@mozilla.com>
Wed, 24 Dec 2014 02:32:00 +0100
changeset 221474 b51678e8e5e8d4edd73cc36196d3ca278748bbea
parent 221473 69e5f05ade70cea6ca5964ffe4cdae025050c207
child 221475 4431d1b8a2473d8a66a72af69133243430ab1e62
push id53352
push usercbook@mozilla.com
push dateMon, 29 Dec 2014 15:17:49 +0000
treeherdermozilla-inbound@8530f5b7443b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaknow
bugs1077075
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 1077075 - Part 7: Update the related testcases. r=aknow
dom/telephony/test/marionette/head.js
dom/telephony/test/marionette/test_incoming_connecting_hangup.js
dom/telephony/test/marionette/test_redundant_operations.js
--- a/dom/telephony/test/marionette/head.js
+++ b/dom/telephony/test/marionette/head.js
@@ -515,73 +515,86 @@ let emulator = (function() {
           if (typeof conferenceStateChangeCallback === "function") {
             conferenceStateChangeCallback();
           }
         });
 
       promises.push(promise);
     }
 
-    call.answer();
+    promise = call.answer();
+    promises.push(promise);
 
     return Promise.all(promises).then(() => call);
   }
 
   /**
    * Hold a call.
    *
    * @param call
    *        A TelephonyCall object.
    * @return Promise<TelephonyCall>
    */
   function hold(call) {
     log("Putting the call on hold.");
 
+    let promises = [];
+
     let promise = waitForNamedStateEvent(call, "holding")
       .then(() => waitForNamedStateEvent(call, "held"));
+    promises.push(promise);
 
-    call.hold();
+    promise = call.hold();
+    promises.push(promise);
 
-    return promise;
+    return Promise.all(promises).then(() => call);
   }
 
   /**
    * Resume a call.
    *
    * @param call
    *        A TelephonyCall object.
    * @return Promise<TelephonyCall>
    */
   function resume(call) {
     log("Resuming the held call.");
 
+    let promises = [];
+
     let promise = waitForNamedStateEvent(call, "resuming")
       .then(() => waitForNamedStateEvent(call, "connected"));
+    promises.push(promise);
 
-    call.resume();
+    promise = call.resume();
+    promises.push(promise);
 
-    return promise;
+    return Promise.all(promises).then(() => call);
   }
 
   /**
    * Locally hang up a call.
    *
    * @param call
    *        A TelephonyCall object.
    * @return Promise<TelephonyCall>
    */
   function hangUp(call) {
     log("Local hanging up the call: " + call.id.number);
 
+    let promises = [];
+
     let promise = waitForNamedStateEvent(call, "disconnecting")
       .then(() => waitForNamedStateEvent(call, "disconnected"));
+    promises.push(promise);
 
-    call.hangUp();
+    promise = call.hangUp();
+    promises.push(promise);
 
-    return promise;
+    return Promise.all(promises).then(() => call);
   }
 
   /**
    * Simulate an incoming call.
    *
    * @param number
    *        A string.
    * @param numberPresentation [optional]
--- a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
@@ -10,19 +10,21 @@ let inCall;
 
 function incoming() {
   return gRemoteDial(inNumber)
     .then(call => inCall = call)
     .then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]));
 }
 
 function connecting() {
-  let promise = gWaitForNamedStateEvent(inCall, "connecting");
-  inCall.answer();
-  return promise;
+  let promises = [
+    gWaitForNamedStateEvent(inCall, "connecting"),
+    inCall.answer()
+  ];
+  return Promise.all(promises).then(() => inCall);
 }
 
 function hangUp() {
   return gHangUp(inCall)
     .then(() => gCheckAll(null, [], "", [], []));
 }
 
 function remoteHangUp() {
--- a/dom/telephony/test/marionette/test_redundant_operations.js
+++ b/dom/telephony/test/marionette/test_redundant_operations.js
@@ -13,22 +13,23 @@ function error(event, action) {
 }
 
 function checkUnexpected(msg, call, event1, event2, actionCallback) {
   let error1 = error.bind(this, event1, msg);
   let error2 = error.bind(this, event2, msg);
 
   call.addEventListener(event1, error1);
   call.addEventListener(event2, error2);
-  actionCallback();
 
-  return gDelay(2000).then(() => {
-    call.removeEventListener(event1, error1);
-    call.removeEventListener(event2, error2);
-  });
+  return actionCallback().then(
+    () => ok(false, msg + "should be rejected."),
+    () => gDelay(2000).then(() => {
+      call.removeEventListener(event1, error1);
+      call.removeEventListener(event2, error2);
+    }));
 }
 
 startTest(function() {
   gRemoteDial(inNumber)
     .then(call => inCall = call)
     .then(() => gAnswer(inCall))
     .then(() => checkUnexpected("answered an active call", inCall,
                                 "connecting", "connected",