Bug 787619 - Test that click events on the C2P overlay don't trigger other handlers. r=jaws

This commit is contained in:
Georg Fritzsche 2012-10-19 15:21:19 +02:00
parent 73fb7845da
commit 6288fe114b
2 changed files with 48 additions and 0 deletions

View File

@ -15,6 +15,7 @@ DIRS += \
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES = \
head.js \
test_feed_discovery.html \
feed_discovery.html \
test_bug395533.html \
@ -39,6 +40,7 @@ MOCHITEST_FILES = \
gZipOfflineChild.html^headers^ \
gZipOfflineChild.cacheManifest \
gZipOfflineChild.cacheManifest^headers^ \
test_bug787619.html \
$(NULL)
# test_contextmenu.html is disabled on Linux due to bug 513558

View File

@ -0,0 +1,46 @@
<html>
<head>
<title>Test for Bug 787619</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript;version=1.7" src="head.js"></script>
<script>
SpecialPowers.setBoolPref('plugins.click_to_play', true);
</script>
</head>
<body>
<a id="wrapper">
<embed id="plugin" style="width: 200px; height: 200px" type="application/x-test">
</a>
<script class="testbody" type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
const Ci = Components.interfaces;
let wrapperClickCount = 0;
function test1() {
let plugin = document.getElementById('plugin');
ok(plugin, 'got plugin element');
let objLC = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLC.activated, 'plugin should not be activated');
synthesizeMouseAtCenter(plugin, {});
waitForCondition(function() objLC.activated, test2,
'waited too long for plugin to activate');
}
function test2() {
is(wrapperClickCount, 0, 'wrapper should not have received any clicks');
SpecialPowers.clearUserPref('plugins.click_to_play');
SimpleTest.finish();
}
let wrapper = document.getElementById('wrapper');
wrapper.addEventListener('click', function() ++wrapperClickCount, false);
SimpleTest.waitForFocus(test1);
</script>
</body>
</html>