Bug 1163592 chat resize intermittent, reduce unused infra that may slow things down. r=me
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 01 Sep 2015 14:33:35 -0700
changeset 260396 d9753d7da8dfaf7583bf777ed6ee5535cb9b4393
parent 260395 b9c136a827c50a356ae18d9cf2b4f76237c7f780
child 260397 fb720c90eb49590ba55bf52a8a4826ffff9f528b
child 260404 5183c511ce583ee0ea00a6e057b2fa092a871290
push id29308
push userryanvm@gmail.com
push dateWed, 02 Sep 2015 01:15:13 +0000
treeherdermozilla-central@fb720c90eb49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1163592
milestone43.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 1163592 chat resize intermittent, reduce unused infra that may slow things down. r=me
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;