Bug 1412401: accessible/tests/mochitest/events/docload/test_docload_root.html: Wait for focus event after opening the dialog. r=MarcoZ, a=test-only
authorJames Teh <jteh@mozilla.com>
Tue, 14 Jan 2020 06:59:56 +0000
changeset 571184 47915803a649d1136cfaf6bbf88860782f8abb74
parent 571183 6d557aa160160cc80b59c18077f83098409896cb
child 571185 d2dfae9a06bfdc0467c63d3be3a2c66660ac6a0b
push id12562
push userryanvm@gmail.com
push dateWed, 15 Jan 2020 15:48:57 +0000
treeherdermozilla-beta@d2dfae9a06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, test-only
bugs1412401
milestone73.0
Bug 1412401: accessible/tests/mochitest/events/docload/test_docload_root.html: Wait for focus event after opening the dialog. r=MarcoZ, a=test-only Previously, when opening the dialog, we only waited for a reorder event. This could mean we programmatically closed the dialog before it was ever focused. That in turn would mean that focus would never be fired on the previous window when the dialog was closed, causing the close dialog test to time out. Differential Revision: https://phabricator.services.mozilla.com/D59826
accessible/tests/mochitest/events/docload/test_docload_root.html
--- a/accessible/tests/mochitest/events/docload/test_docload_root.html
+++ b/accessible/tests/mochitest/events/docload/test_docload_root.html
@@ -31,17 +31,22 @@
         try {
           docAcc = docAcc.parent;
         } catch (e) {
           ok(false, `Can't get parent for ${prettyName(docAcc)}`);
           throw e;
         }
       }
 
-      this.eventSeq = [ new invokerChecker(EVENT_REORDER, gRootAcc) ];
+      this.eventSeq = [
+        new invokerChecker(EVENT_REORDER, gRootAcc),
+        // We use a function here to get the target because gDialog isn't set
+        // yet, but it will be when the function is called.
+        new invokerChecker(EVENT_FOCUS, () => gDialog.document)
+      ];
 
       this.invoke = () => (gDialog = window.docShell.rootTreeItem.domWindow.openDialog(aURL));
 
       this.finalCheck = () => {
         const accTree = {
           role: ROLE_APP_ROOT,
           children: [
             {