Bug 983347 - Need different paths for displaying to the screen and sending over the wire, fix tests. rs=test-only-bustage-fix a=bustage
authorPatrick Cloke <clokep@gmail.com>
Sun, 14 Sep 2014 21:42:02 -0400
changeset 16801 0c3c6ce0353fda9ba680349442c1c1445ed2f9b1
parent 16800 e2c85d70fda266eb3db5e2dc2e2fc95b7f12fcd1
child 16802 f1fe79198f96db21dd007ba7ac75fbdd9ac41cdf
push id10452
push userclokep@gmail.com
push dateMon, 15 Sep 2014 01:43:56 +0000
treeherdercomm-central@0c3c6ce0353f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only-bustage-fix, bustage
bugs983347
Bug 983347 - Need different paths for displaying to the screen and sending over the wire, fix tests. rs=test-only-bustage-fix a=bustage
chat/components/src/test/test_logger.js
chat/protocols/irc/test/test_splitLongMessages.js
--- a/chat/components/src/test/test_logger.js
+++ b/chat/components/src/test/test_logger.js
@@ -288,35 +288,35 @@ let test_logging = function* () {
   // Creates a set of dummy messages for a conv (sets appropriate times).
   let getMsgsForConv = function(aConv) {
     // Convert to seconds because that's what logMessage expects.
     let startTime = Math.round(aConv.startDate / oneSec);
     return [
       {
         time: startTime + 1,
         who: "personA",
-        originalMessage: "Hi!",
+        displayMessage: "Hi!",
         outgoing: true
       },
       {
         time: startTime + 2,
         who: "personB",
-        originalMessage: "Hello!",
+        displayMessage: "Hello!",
         incoming: true
       },
       {
         time: startTime + 3,
         who: "personA",
-        originalMessage: "What's up?",
+        displayMessage: "What's up?",
         outgoing: true
       },
       {
         time: startTime + 4,
         who: "personB",
-        originalMessage: "Nothing much!",
+        displayMessage: "Nothing much!",
         incoming: true
       }
     ];
   }
   let firstDayMsgs = getMsgsForConv(dummyConv);
   let secondDayMsgs = getMsgsForConv(dummyConv2);
 
   let logMessagesForConv = Task.async(function* (aConv, aMessages) {
--- a/chat/protocols/irc/test/test_splitLongMessages.js
+++ b/chat/protocols/irc/test/test_splitLongMessages.js
@@ -12,33 +12,28 @@ const messages = {
   "This is a message that is too long.":
     ["This is a", "message that is", "too long."],
   // Too short.
   "Short msg.": ["Short msg."],
   "Thismessagecan'tbecut.": ["Thismessagecan'", "tbecut."]
 };
 
 irc.GenericIRCConversation.name = "target";
-irc.GenericIRCConversation.writeMessage =
-  function(aSource, aMessage, aParams) this.messages.push(aMessage);
 irc.GenericIRCConversation._account = {
   __proto__: irc.ircAccount.prototype,
   _nickname: "sender",
   prefix: "!user@host",
-  maxMessageLength: 51, // For convenience.
-  sendMessage: function(aCommand, aParams) true
+  maxMessageLength: 51 // For convenience.
 };
 
 function run_test() {
   for (let message in messages) {
-    irc.GenericIRCConversation.messages = [];
-    irc.GenericIRCConversation.sendMsg(message);
+    let msg = {message: message};
+    let generatedMsgs = irc.GenericIRCConversation.prepareForSending(msg, {});
 
-    // The split messages from sendMsg.
-    let generatedMsgs = irc.GenericIRCConversation.messages;
     // The expected messages as defined above.
     let expectedMsgs = messages[message];
     // Ensure both arrays have the same length.
     do_check_eq(expectedMsgs.length, generatedMsgs.length);
     // Ensure the values in the arrays are equal.
     for (let i = 0; i < expectedMsgs.length; ++i)
       do_check_eq(generatedMsgs[i], expectedMsgs[i]);
   }