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 524424 f182cdc7247a58b57ebd7fd202a703e51b7df1da
parent 524423 7d85cbdd3ea34c2d5b940c92387699eea3901ace
child 524425 a917dc818e2f0ef216160d009bc7ec31c0576923
push id769
push userryanvm@gmail.com
push dateWed, 15 Jan 2020 15:44:36 +0000
treeherdermozilla-esr68@f182cdc7247a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, test-only
bugs1412401
milestone68.5.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.openDialog(aURL));
 
       this.finalCheck = () => {
         const accTree = {
           role: ROLE_APP_ROOT,
           children: [
             {