Bug 1029433 When in a Loop call, the title bar should display the remote party's information. r=nperriault a=lmandel
authorMark Banner <standard8@mozilla.com>
Fri, 10 Oct 2014 14:03:56 +0100
changeset 225721 530ec559a14c
parent 225720 0033bca3ce22
child 225722 0b7106ef79d2
push id3990
push userrjesup@wgate.com
push date2014-10-17 02:29 +0000
treeherdermozilla-beta@530ec559a14c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnperriault, lmandel
bugs1029433
milestone34.0
Bug 1029433 When in a Loop call, the title bar should display the remote party's information. r=nperriault a=lmandel
browser/components/loop/content/js/conversation.js
browser/components/loop/content/js/conversation.jsx
browser/components/loop/test/desktop-local/conversation_test.js
browser/components/loop/test/shared/models_test.js
--- a/browser/components/loop/content/js/conversation.js
+++ b/browser/components/loop/content/js/conversation.js
@@ -232,18 +232,17 @@ loop.conversation = (function(mozL10n) {
           return (
             IncomingCallView({
               model: this.props.conversation, 
               video: this.props.conversation.hasVideoStream("incoming")}
             )
           );
         }
         case "connected": {
-          // XXX This should be the caller id (bug 1020449)
-          document.title = mozL10n.get("incoming_call_title2");
+          document.title = this.props.conversation.getCallIdentifier();
 
           var callType = this.props.conversation.get("selectedCallType");
 
           return (
             sharedViews.ConversationView({
               initiate: true, 
               sdk: this.props.sdk, 
               model: this.props.conversation, 
--- a/browser/components/loop/content/js/conversation.jsx
+++ b/browser/components/loop/content/js/conversation.jsx
@@ -232,18 +232,17 @@ loop.conversation = (function(mozL10n) {
           return (
             <IncomingCallView
               model={this.props.conversation}
               video={this.props.conversation.hasVideoStream("incoming")}
             />
           );
         }
         case "connected": {
-          // XXX This should be the caller id (bug 1020449)
-          document.title = mozL10n.get("incoming_call_title2");
+          document.title = this.props.conversation.getCallIdentifier();
 
           var callType = this.props.conversation.get("selectedCallType");
 
           return (
             <sharedViews.ConversationView
               initiate={true}
               sdk={this.props.sdk}
               model={this.props.conversation}
--- a/browser/components/loop/test/desktop-local/conversation_test.js
+++ b/browser/components/loop/test/desktop-local/conversation_test.js
@@ -604,16 +604,24 @@ describe("loop.conversation", function()
       describe("call:accepted", function() {
         it("should display the ConversationView",
           function() {
             conversation.accepted();
 
             TestUtils.findRenderedComponentWithType(icView,
               sharedView.ConversationView);
           });
+
+        it("should set the title to the call identifier", function() {
+          sandbox.stub(conversation, "getCallIdentifier").returns("fakeId");
+
+          conversation.accepted();
+
+          expect(document.title).eql("fakeId");
+        });
       });
 
       describe("session:ended", function() {
         it("should display the feedback view when the call session ends",
           function() {
             conversation.trigger("session:ended");
 
             TestUtils.findRenderedComponentWithType(icView,
--- a/browser/components/loop/test/shared/models_test.js
+++ b/browser/components/loop/test/shared/models_test.js
@@ -369,24 +369,34 @@ describe("loop.shared.models", function(
         beforeEach(function() {
           model = new sharedModels.ConversationModel(fakeSessionData, {
             sdk: fakeSDK
           });
           model.startSession();
         });
 
         it("should return the callerId", function() {
-          expect(model.getCallIdentifier()).to.eql("mrssmith");
+          expect(model.getCallIdentifier()).eql("mrssmith");
         });
 
         it("should return the shorted callUrl if the callerId does not exist",
           function() {
-            model.set({"callerId": ""});
+            model.set({callerId: ""});
+
+            expect(model.getCallIdentifier()).eql("invalid/callToken");
+          });
 
-            expect(model.getCallIdentifier()).to.eql("invalid/callToken");
+        it("should return an empty string if neither callerId nor callUrl exist",
+          function() {
+            model.set({
+              callerId: undefined,
+              callUrl: undefined
+            });
+
+            expect(model.getCallIdentifier()).eql("");
           });
       });
     });
   });
 
   describe("NotificationCollection", function() {
     var collection, notifData, testNotif;