Bug 1499996 - Wait to run tests until new window gets focus r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 23 Oct 2018 07:34:55 +0000
changeset 490878 d9c2a804cbc8188d5b15e3c8038ea27300ab79a6
parent 490877 2e4bdafb70ce4febc9fb071ad1743cc0b49096de
child 490879 271d76b2997b8010c69e15be8f972ce278d99727
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerssmaug
bugs1499996
milestone65.0a1
Bug 1499996 - Wait to run tests until new window gets focus r=smaug test_expanding_selection_per_page.html creates another window and requires focus event on each case which creates editing host because EditorEventListener::Focus() sets ancestor limit of Selection as the editing host. Therefore, if the window itself does not have focus, focus event won't be fired on editing hosts. So, the reason why the orange occurs almost all with opt build is, debug build is enough slow to wait focus of new window before running test. Differential Revision: https://phabricator.services.mozilla.com/D9473
layout/base/tests/test_expanding_selection_per_page.html
--- a/layout/base/tests/test_expanding_selection_per_page.html
+++ b/layout/base/tests/test_expanding_selection_per_page.html
@@ -32,16 +32,17 @@ async function doTests(aWindow) {
                                        .QueryInterface(SpecialPowers.Ci.nsISelectionController);
   }
   // On Windows, per-page selection to start or end expands selection to same
   // column of first or last line.  On the other platforms, it expands selection
   // to start or end of first or last line.
   const kSelectToStartOrEnd = !IS_WIN;
 
   await SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]]});
+  await SimpleTest.promiseFocus(aWindow);
 
   function getNodeDescription(aNode) {
     function getElementDescription(aElement) {
       if (aElement.getAttribute("id") !== null) {
         return `${aElement.tagName.toLowerCase()}#${aElement.getAttribute("id")}`;
       }
       if (aElement.tagName === "BR") {
         return `${getElementDescription(aElement.previousSibling)} + br`;