Bug 1372924 - Handle input focus notifications at the right times in test_nsITextInputProcessor.xul. r?jmaher
This patch prevents a part of the test from creating a notify-focus event at random times later in the test by taking care of it as soon as it can be received. It also removes an unecessary focus call.
MozReview-Commit-ID: DJJaKmaT5wm
--- a/dom/base/test/chrome/window_nsITextInputProcessor.xul
+++ b/dom/base/test/chrome/window_nsITextInputProcessor.xul
@@ -4036,16 +4036,17 @@ function* runCallbackTests(aForTests)
input.blur();
is(notifications.length, 1,
description + "input.blur() should cause a notification");
is(notifications[0].type, "notify-blur",
description + "input.blur() should cause \"notify-focus\"");
dumpUnexpectedNotifications(1);
input.focus();
+ yield waitUntilNotificationsReceived();
notifications = [];
TIP.setPendingCompositionString("foo");
TIP.appendClauseToPendingComposition(3, TIP.ATTR_RAW_CLAUSE);
TIP.flushPendingComposition();
is(notifications.length, 3,
description + "creating composition string 'foo' should cause 3 notifications");
checkTextChangeNotification(notifications[0], description + "creating composition string 'foo'",
{ offset: 0, removedLength: 0, addedLength: 3,
@@ -4062,30 +4063,30 @@ function* runCallbackTests(aForTests)
is(notifications[0].type, "request-to-commit",
description + "synthesizeMouseAtCenter(input, {}) during composition should cause \"request-to-commit\"");
checkTextChangeNotification(notifications[1], description + "synthesizeMouseAtCenter(input, {}) during composition",
{ offset: 0, removedLength: 3, addedLength: 3,
causedOnlyByComposition: true, includingChangesDuringComposition: false, includingChangesWithoutComposition: false});
checkPositionChangeNotification(notifications[2], description + "synthesizeMouseAtCenter(input, {}) during composition");
dumpUnexpectedNotifications(3);
+ input.focus();
+ yield waitUntilNotificationsReceived();
+ notifications = [];
// XXX On macOS, window.moveBy() doesn't cause notify-position-change.
// Investigate this later (although, we cannot notify position change to
// native IME on macOS).
if (!kIsMac) {
- input.focus();
- notifications = [];
window.moveBy(0, 10);
yield waitUntilNotificationsReceived();
is(notifications.length, 1,
description + "window.moveBy(0, 10) should cause a notification");
checkPositionChangeNotification(notifications[0], description + "window.moveBy(0, 10)");
dumpUnexpectedNotifications(1);
- input.focus();
notifications = [];
window.moveBy(10, 0);
yield waitUntilNotificationsReceived();
is(notifications.length, 1,
description + "window.moveBy(10, 0) should cause a notification");
checkPositionChangeNotification(notifications[0], description + "window.moveBy(10, 0)");
dumpUnexpectedNotifications(1);
}