mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920013 - Rewrite test_cocoa_focus.html to use SpecialPowers. r=smichaud
This commit is contained in:
parent
121794fd96
commit
5df22d1a7c
@ -15,7 +15,6 @@
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var utils = SpecialPowers.DOMWindowUtils;
|
||||
var scale = utils.screenPixelsPerCSSPixel;
|
||||
|
||||
@ -67,7 +66,7 @@
|
||||
// change plugin focus.
|
||||
|
||||
// Blur the window.
|
||||
window.blur();
|
||||
SpecialPowers.focus(opener);
|
||||
|
||||
is(plugin1.getFocusState(), true, "(2) Plugin should still have focus.");
|
||||
is(plugin1.getFocusEventCount(), expectedEventCount, "Focus event count should be " + expectedEventCount);
|
||||
@ -95,7 +94,7 @@
|
||||
expectedEventCount++;
|
||||
|
||||
// Blur the window.
|
||||
window.blur();
|
||||
SpecialPowers.focus(opener);
|
||||
|
||||
// Take focus from the plugin while the window is blurred.
|
||||
plugin2.focus();
|
||||
@ -104,7 +103,7 @@
|
||||
is(plugin1.getFocusEventCount(), expectedEventCount, "Focus event count should be " + expectedEventCount);
|
||||
|
||||
// Focus the window.
|
||||
window.focus();
|
||||
SpecialPowers.focus(window);
|
||||
expectedEventCount++;
|
||||
|
||||
is(plugin1.getFocusState(), false, "(6) Plugin should not have focus.");
|
||||
|
@ -53,9 +53,7 @@
|
||||
ok(false, "Plugin does not know its initial top-level window activation state!");
|
||||
}
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"].
|
||||
getService(SpecialPowers.Ci.nsIFocusManager);
|
||||
var fm = SpecialPowers.Services.focus;
|
||||
|
||||
waitForFocus(function() {
|
||||
// Make sure the plugin handled the focus event before checking.
|
||||
@ -69,7 +67,6 @@
|
||||
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.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
fm.focusedWindow = window;
|
||||
|
||||
waitForFocus(function() {
|
||||
@ -91,7 +88,6 @@
|
||||
|
||||
// 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;
|
||||
}
|
||||
</script>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<title>NPCocoaEventFocusChanged Tests</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body onload="runTests()">
|
||||
|
@ -3,6 +3,7 @@
|
||||
<title>NPCocoaEventWindowFocusChanged Tests</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body onload="runTests()">
|
||||
|
Loading…
Reference in New Issue
Block a user