Bug 595062 - Fix Intermittent mochitest-ipcplugins failures in test_cocoa_focus.html. r=jst a=tests

This commit is contained in:
Mounir Lamouri 2010-10-29 21:50:27 +02:00
Родитель 5c01cd49ec
Коммит f858d0ac44
1 изменённых файлов: 29 добавлений и 22 удалений

Просмотреть файл

@ -45,32 +45,39 @@
ok(false, "Plugin does not know its initial top-level window activation state!");
}
// Send our window to the back and make sure plugins were properly notified.
// Calling window.blur() is not allowed.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
window.opener.addEventListener("focus", function() {
window.opener.removeEventListener("focus", arguments.callee, false);
expectedEventCount++;
is(plugin1.getTopLevelWindowActivationState(), false, "Activation state should be: deactivated");
is(plugin1.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
is(plugin2.getTopLevelWindowActivationState(), false, "Activation state should be: deactivated");
is(plugin2.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
// Bring our window back to the front and make sure plugins were properly notified.
window.focus();
expectedEventCount++;
is(plugin1.getTopLevelWindowActivationState(), true, "Activation state should be: activated");
is(plugin1.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
is(plugin2.getTopLevelWindowActivationState(), true, "Activation state should be: activated");
is(plugin2.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
window.opener.testsFinished();
}, false);
// Send our window to the back and make sure plugins were properly notified.
// Calling window.blur() is not allowed.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
fm.focusedWindow = window.opener;
expectedEventCount++;
is(plugin1.getTopLevelWindowActivationState(), false, "Activation state should be: deactivated");
is(plugin1.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
is(plugin2.getTopLevelWindowActivationState(), false, "Activation state should be: deactivated");
is(plugin2.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
// Bring our window back to the front and make sure plugins were properly notified.
window.focus();
expectedEventCount++;
is(plugin1.getTopLevelWindowActivationState(), true, "Activation state should be: activated");
is(plugin1.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
is(plugin2.getTopLevelWindowActivationState(), true, "Activation state should be: activated");
is(plugin2.getTopLevelWindowActivationEventCount(), expectedEventCount, "Window focus event count should be " + expectedEventCount);
window.opener.testsFinished();
}
</script>
</body>