mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 561733 - Mouse click event in iframe doesn't fire (tests) [r=mfinkle]
This commit is contained in:
parent
73abc853b4
commit
a3969e33b6
@ -53,11 +53,13 @@ _BROWSER_FILES = \
|
||||
browser_bookmarks_tags.js \
|
||||
browser_select.js \
|
||||
browser_rect.js \
|
||||
browser_click_content.js \
|
||||
browser_FormAssistant.js \
|
||||
browser_viewport.js \
|
||||
browser_blank_01.html \
|
||||
browser_blank_02.html \
|
||||
browser_select.html \
|
||||
browser_click_content.html \
|
||||
browser_FormAssistant.html \
|
||||
browser_viewport_00.html \
|
||||
browser_viewport_01.html \
|
||||
|
6
mobile/chrome/tests/browser_click_content.html
Normal file
6
mobile/chrome/tests/browser_click_content.html
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<title>Browser Click Page 01</title>
|
||||
<body>
|
||||
<iframe src="data:,test test" width="100" height="100"><iframe>
|
||||
</body>
|
||||
</html>
|
51
mobile/chrome/tests/browser_click_content.js
Normal file
51
mobile/chrome/tests/browser_click_content.js
Normal file
@ -0,0 +1,51 @@
|
||||
let testURL_click = "chrome://mochikit/content/browser/mobile/chrome/browser_click_content.html";
|
||||
|
||||
let newTab;
|
||||
let element;
|
||||
let isClickFired = false;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point (must be named "test")
|
||||
function test() {
|
||||
// This test is async
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Add new tab
|
||||
newTab = Browser.addTab(testURL_click, true);
|
||||
ok(newTab, "Tab Opened");
|
||||
|
||||
// Wait for tab load (need to check the tab "loading", not the document "loading")
|
||||
waitFor(testClick, function() { return newTab.isLoading() == false; });
|
||||
}
|
||||
|
||||
function clickFired() {
|
||||
isClickFired = true;
|
||||
}
|
||||
|
||||
function testClick() {
|
||||
// Do sanity tests
|
||||
let uri = newTab.browser.currentURI.spec;
|
||||
is(uri, testURL_click, "URL Matches newly created Tab");
|
||||
|
||||
// Check click
|
||||
element = newTab.browser.contentDocument.querySelector("iframe");
|
||||
element.addEventListener("click", clickFired, true);
|
||||
EventUtils.synthesizeMouseForContent(element, 1, 1, {}, window);
|
||||
waitFor(checkClick, function() { return isClickFired });
|
||||
}
|
||||
|
||||
function checkClick() {
|
||||
ok(isClickFired, "Click handler fired");
|
||||
close();
|
||||
}
|
||||
|
||||
function close() {
|
||||
// Close the tab
|
||||
Browser.closeTab(newTab);
|
||||
|
||||
// Remove the listener
|
||||
element.removeEventListener("click", clickFired, true);
|
||||
|
||||
// We must finialize the tests
|
||||
finish();
|
||||
}
|
Loading…
Reference in New Issue
Block a user