Closed Bug 1376857 Opened 7 years ago Closed 7 years ago

Port some mochitest events tests to browser tests

Categories

(Core :: Disability Access APIs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: eeejay, Assigned: eeejay)

References

Details

Attachments

(2 files, 2 obsolete files)

      No description provided.
Attachment #8881851 - Flags: review?(yzenevich)
Comment on attachment 8881851 [details] [diff] [review]
Port events/test_focus_dialog.html to browser tests. r?yzen

Review of attachment 8881851 [details] [diff] [review]:
-----------------------------------------------------------------

cool

::: accessible/tests/browser/events/browser_test_focus_dialog.js
@@ +25,5 @@
> +  await BrowserTestUtils.closeWindow(newWin);
> +  testStates((await onFocus).accessible, STATE_FOCUSED);
> +
> +  onFocus = waitForEvent(EVENT_FOCUS, "body2");
> +  await ContentTask.spawn(browser, {}, async function() {

do we need async here?

@@ +37,5 @@
> +  testStates((await onFocus).accessible, STATE_FOCUSED);
> +
> +  let onShow = waitForEvent(EVENT_SHOW, "alertdialog");
> +  onFocus = waitForEvent(EVENT_FOCUS, "alertdialog");
> +  await ContentTask.spawn(browser, {}, async function() {

do we need async here?
Attachment #8881851 - Flags: review?(yzenevich) → review+
Comment on attachment 8881850 [details] [diff] [review]
Port events/test_{docload,focus_browserui}.xul to browser tests. r?yzen

Review of attachment 8881850 [details] [diff] [review]:
-----------------------------------------------------------------

thanks

::: accessible/tests/browser/e10s/browser_caching_description.js
@@ +143,5 @@
>      for (let { desc, waitFor, attrs, expected } of tests) {
>        info(desc);
>        let onUpdate;
>        if (waitFor) {
> +        onUpdate = waitForOrderedEvents(

I would rather update the waitFor fields in the declarative 'test' structure.

::: accessible/tests/browser/events.js
@@ +56,5 @@
> +  let acc = event.accessible;
> +  switch (typeof matchCriteria) {
> +    case "string":
> +      let id = getAccessibleDOMNodeID(acc);
> +      if (id == matchCriteria) {

nit: here and below ===

@@ +159,5 @@
>   * specified order.
>   * @param {Array} events        a list of events to wait (same format as
>   *                              waitForEvent arguments)
>   */
> +function waitForEvents(events, unexpected=[], ordered=false) {

nit: spaces around =

@@ +180,5 @@
> +    return results;
> +  });
> +}
> +
> +function waitForOrderedEvents(events, unexpected=[]) {

nit: spaces around = and jsdoc

::: accessible/tests/browser/events/browser_test_focus_browserui.js
@@ +36,5 @@
> +  EventUtils.synthesizeKey("w", { accelKey: true }, browser.ownerGlobal);
> +  evt = await onFocus;
> +  testStates(evt.accessible, STATE_FOCUSED);
> +
> +  info(evt);

is this still needed?

::: accessible/tests/browser/shared-head.js
@@ +203,5 @@
>      loadedScriptSet.add(browser);
>    }
>  }
>  
> +function snippetToURL(snippet, bodyAttrs={}) {

jsdoc,
nit: space around =
Attachment #8881850 - Flags: review?(yzenevich) → review+
When a new window shows up, and you load a document, the resulting events are not determininstic in e10s. You may get a FOCUS event on the blank browser window, or on the loaded document. Opened a bug for this..
Attachment #8883645 - Flags: review?(yzenevich)
Attachment #8881851 - Attachment is obsolete: true
Comment on attachment 8883645 [details] [diff] [review]
Port events/test_focus_dialog.html to browser tests.

Review of attachment 8883645 [details] [diff] [review]:
-----------------------------------------------------------------

looks good, thanks
Attachment #8883645 - Flags: review?(yzenevich) → review+
Just wait for a focus event for now, don't check the target. This should be fixed, and I opened bug 1377942 for that.
Attachment #8883679 - Flags: review?(yzenevich)
Attachment #8883645 - Attachment is obsolete: true
Attachment #8883679 - Flags: review?(yzenevich)
Comment on attachment 8883679 [details] [diff] [review]
Port events/test_focus_dialog.html to browser tests.

Review of attachment 8883679 [details] [diff] [review]:
-----------------------------------------------------------------

looks good

::: accessible/tests/browser/events/browser_test_focus_dialog.js
@@ +17,5 @@
> +  let button = (await onFocus).accessible;
> +  testStates(button, STATE_FOCUSED);
> +
> +  // Bug 1377942 - The target of the focus event changes under different
> +  // circumstances. 

nit: whitespace

@@ +19,5 @@
> +
> +  // Bug 1377942 - The target of the focus event changes under different
> +  // circumstances. 
> +  // In e10s the focus event is the new window, in non-e10s it's the doc.
> +  onFocus = waitForEvent(EVENT_FOCUS, () => true);

Maybe we can do the something similar here (check for either doc or chrome window only)?
Attachment #8883679 - Flags: review+
Pushed by eisaacson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/27cbe1c0b7c5
Port events/test_{docload,focus_browserui}.xul to browser tests. r=yzen
https://hg.mozilla.org/integration/mozilla-inbound/rev/3497ed165c84
Port events/test_focus_dialog.html to browser tests. r=yzen
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/mozilla-inbound/rev/288575a7c30a
Port events/test_focus_dialog.html to browser tests: remove trailing whitespace to make eslint happy. r=eslint-fix
Assignee: nobody → eitan
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: