Bug 1376822 - Re-enable appmenu reflow tests for sync subview. r?Gijs draft
authorMike Conley <mconley@mozilla.com>
Thu, 13 Jul 2017 07:59:35 -0700
changeset 615865 a443c092b35241376cc93119b366b3e42d7d7e41
parent 614544 462d7561089c98e33382384896434861ad7bc491
child 615867 0db5eafa8f0ba0ec86977a05f250f66d61da0b92
push id70510
push usermconley@mozilla.com
push dateWed, 26 Jul 2017 14:05:55 +0000
reviewersGijs
bugs1376822
milestone56.0a1
Bug 1376822 - Re-enable appmenu reflow tests for sync subview. r?Gijs MozReview-Commit-ID: B95VVqaTDja
browser/base/content/test/performance/browser_appmenu_reflows.js
--- a/browser/base/content/test/performance/browser_appmenu_reflows.js
+++ b/browser/base/content/test/performance/browser_appmenu_reflows.js
@@ -78,33 +78,27 @@ const EXPECTED_APPMENU_SUBVIEW_REFLOWS =
   /**
    * The synced tabs view has labels that are multiline. Because of bugs in
    * XUL layout relating to multiline text in scrollable containers, we need
    * to manually read their height in order to ensure container heights are
    * correct. Unfortunately this requires 2 sync reflows.
    *
    * If we add more views where this is necessary, we may need to duplicate
    * these expected reflows further.
-   *
-   * Because the test dirties the frame tree by manipulating margins,
-   * getBoundingClientRect() in the descriptionHeightWorkaround code
-   * seems to sometimes fire multiple times. Bug 1363361 will change how the
-   * test dirties the frametree, after which this (2 hits in that method)
-   * should become deterministic and we can re-enable the subview testing
-   * for the remotetabs subview (this is bug 1376822). In the meantime,
-   * that subview only is excluded from this test.
+   */
   [
     "descriptionHeightWorkaround@resource:///modules/PanelMultiView.jsm",
     "onTransitionEnd@resource:///modules/PanelMultiView.jsm",
   ],
+
   [
     "descriptionHeightWorkaround@resource:///modules/PanelMultiView.jsm",
     "onTransitionEnd@resource:///modules/PanelMultiView.jsm",
   ],
-   */
+
   /**
    * Please don't add anything new!
    */
 ];
 
 add_task(async function() {
   await ensureNoPreloadedBrowser();
 
@@ -130,33 +124,37 @@ add_task(async function() {
     // exhausted, we go back up a level.
     async function openSubViewsRecursively(currentView) {
       let navButtons = Array.from(currentView.querySelectorAll(".subviewbutton-nav"));
       if (!navButtons) {
         return;
       }
 
       for (let button of navButtons) {
-        // We skip the remote tabs subview, see the comments above
-        // in EXPECTED_APPMENU_SUBVIEW_REFLOWS. bug 1376822 tracks
-        // re-enabling this.
-        if (button.id == "appMenu-library-remotetabs-button") {
-          info("Skipping " + button.id);
-          continue;
-        }
         info("Click " + button.id);
         button.click();
         await BrowserTestUtils.waitForEvent(PanelUI.panel, "ViewShown");
+
+        // Workaround until bug 1363756 is fixed, then this can be removed.
+        await BrowserTestUtils.waitForCondition(() => {
+          return !PanelUI.multiView.instance._viewContainer.hasAttribute("width");
+        });
+
         info("Shown " + PanelUI.multiView.instance._currentSubView.id);
         // Unfortunately, I can't find a better accessor to the current
         // subview, so I have to reach the PanelMultiView instance
         // here.
         await openSubViewsRecursively(PanelUI.multiView.instance._currentSubView);
         PanelUI.multiView.goBack();
         await BrowserTestUtils.waitForEvent(PanelUI.panel, "ViewShown");
+
+        // Workaround until bug 1363756 is fixed, then this can be removed.
+        await BrowserTestUtils.waitForCondition(() => {
+          return !PanelUI.multiView.instance._viewContainer.hasAttribute("width");
+        });
       }
     }
 
     await openSubViewsRecursively(PanelUI.mainView);
 
     let hidden = BrowserTestUtils.waitForEvent(PanelUI.panel, "popuphidden");
     PanelUI.hide();
     await hidden;