Bug 1163592 - Chat resize intermittent, reduce unused infra that may slow things down. a=test-only
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 01 Sep 2015 14:33:35 -0700
changeset 289061 964c244342551dec7db357aa37bf156307ba18bd
parent 289060 440d55ad4feb145cbf6ad25dbc8027842aa6dfe6
child 289062 55dae3e3f058b91e85c1cd427a06a62aacc8abb3
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only
bugs1163592
milestone42.0a2
Bug 1163592 - Chat resize intermittent, reduce unused infra that may slow things down. a=test-only
browser/base/content/test/social/browser_social_chatwindow_resize.js
browser/base/content/test/social/head.js
--- a/browser/base/content/test/social/browser_social_chatwindow_resize.js
+++ b/browser/base/content/test/social/browser_social_chatwindow_resize.js
@@ -4,53 +4,45 @@
 
 function test() {
   requestLongerTimeout(2); // only debug builds seem to need more time...
   waitForExplicitFinish();
 
   let manifest = { // normal provider
     name: "provider 1",
     origin: "https://example.com",
-    sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
-    workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
+    sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
     iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png",
     // added for test purposes
-    chatURL: "https://example.com/browser/browser/base/content/test/social/social_chat.html"
+    chatURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html"
   };
   let oldwidth = window.outerWidth; // we futz with these, so we restore them
   let oldleft = window.screenX;
   window.moveTo(0, window.screenY)
   let postSubTest = function(cb) {
     let chats = document.getElementById("pinnedchats");
     ok(chats.children.length == 0, "no chatty children left behind");
     cb();
   };
 
   runSocialTestWithProvider(manifest, function (finishcb) {
-    SocialSidebar.show();
-    let port = SocialSidebar.provider.getWorkerPort();
-    ok(port, "provider has a port");
-    port.postMessage({topic: "test-init"});
-    // we require a logged in user for chats, wait for that
-    waitForCondition(function() {
-      let sbrowser = document.getElementById("social-sidebar-browser");
-      return SocialSidebar.provider &&
-             SocialSidebar.provider.profile &&
-             SocialSidebar.provider.profile.displayName &&
-             sbrowser.docShellIsActive;
-    }, function() {
+    let sbrowser = document.getElementById("social-sidebar-browser");
+    ensureFrameLoaded(sbrowser).then(() => {
+      let provider = SocialSidebar.provider;
+      provider.chatURL = manifest.chatURL;
+      ok(provider, "provider is set");
+      ok(provider.chatURL, "provider has chatURL");
       // executeSoon to let the browser UI observers run first
       runSocialTests(tests, undefined, postSubTest, function() {
         window.moveTo(oldleft, window.screenY)
         window.resizeTo(oldwidth, window.outerHeight);
-        port.close();
         finishcb();
       });
-    },
-    "waitForProviderLoad: provider profile was not set", 100);
+    });
+    SocialSidebar.show();
   });
 }
 
 var tests = {
 
   // resize and collapse testing.
   testBrowserResize: function(next, mode) {
     let chats = document.getElementById("pinnedchats");
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -484,17 +484,22 @@ function get3ChatsForCollapsing(mode, cb
       }, mode);
     });
   }, mode);
 }
 
 function makeChat(mode, uniqueid, cb) {
   info("making a chat window '" + uniqueid +"'");
   let provider = SocialSidebar.provider;
-  const chatUrl = provider.origin + "/browser/browser/base/content/test/social/social_chat.html";
+  let chatUrl = provider.origin + "/browser/browser/base/content/test/social/social_chat.html";
+  // chatURL is not a part of the provider class, but is added by tests if we
+  // want to use a specific url (different than above) for testing
+  if (provider.chatURL) {
+    chatUrl = provider.chatURL;
+  }
   // Note that we use promiseChatLoaded instead of the callback to ensure the
   // content has started loading.
   let chatbox = getChatBar().openChat(provider.origin, provider.name,
                                       chatUrl + "?id=" + uniqueid, mode);
   chatbox.promiseChatLoaded.then(
     () => {
     info("chat window has opened");
     chatbox.contentDocument.title = uniqueid;