зеркало из https://github.com/mozilla/gecko-dev.git
Bug 920013 - Rewrite test_cocoa_focus.html to use SpecialPowers. r=smichaud
--HG-- extra : rebase_source : 9d7d90b5ee9c8d2b6a867fd7880600e211cf4e42
This commit is contained in:
Родитель
586ae964db
Коммит
cf9f023525
|
@ -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()">
|
||||
|
|
Загрузка…
Ссылка в новой задаче