Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FBTest: automated test for issue 5135
- Loading branch information
1 parent
fedc819
commit 987d8a8
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script type="text/javascript"> | ||
function log(e) | ||
{ | ||
var node = document.createElement("div"); | ||
node.textContent = e.data; | ||
document.getElementById("content").appendChild(node); | ||
} | ||
window.addEventListener("message", log, false); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="content"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Issue 5135: Display window.postMessage() calls in console</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link href="../../_common/testcase.css" type="text/css" rel="stylesheet"/> | ||
</head> | ||
<body> | ||
<script> | ||
function postMessage() | ||
{ | ||
var iframe = document.getElementById("iframe"); | ||
var value = document.getElementById("value").value; | ||
iframe.contentWindow.postMessage(value, "*"); | ||
} | ||
</script> | ||
<header> | ||
<h1><a href="http://code.google.com/p/fbug/issues/detail?id=5135">Issue 5135</a>: | ||
Display window.postMessage() calls in console</h1> | ||
</header> | ||
<div> | ||
<section id="description"> | ||
<h3>Steps to follow</h3> | ||
<ol> | ||
<li>Open Firebug, enable the Console and Script panels and reload.</li> | ||
<li>Monitor "message" events sent to <i>iframe</i> on this page by | ||
executing this expression on the command line: | ||
<code>monitorEvents($("iframe").contentWindow, "message")</code></li> | ||
<li>You can modify a message send to the iframe:<br/> | ||
<input value="test" id="value"></li> | ||
<li>Click this button to send the message to the iframe:<br/> | ||
<button id="testButton" onclick="postMessage()">Post Message</button></li> | ||
<iframe id="iframe" src="iframe.html" style="width:450px; height: 100px"></iframe> | ||
<li>The Console panel should display an info about the message | ||
<code>message origin=http://legoas, data=test » Window iframe.html</code> | ||
</li> | ||
</ol> | ||
<br/> | ||
</section> | ||
<footer> | ||
Jan Odvarko <odvarko@gmail.com> | ||
</footer> | ||
</div> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function runTest() | ||
{ | ||
FBTest.sysout("issue5135.START"); | ||
FBTest.openNewTab(basePath + "console/5135/issue5135.html", function(win) | ||
{ | ||
FBTest.openFirebug(); | ||
FBTest.enableConsolePanel(function(win) | ||
{ | ||
FBTest.selectPanel("console"); | ||
FBTest.executeCommand("monitorEvents($('iframe').contentWindow, 'message')"); | ||
FBTest.clearConsole(); | ||
|
||
var config = {tagName: "div", classes: "logRow"}; | ||
FBTest.waitForDisplayedElement("console", config, function(row) | ||
{ | ||
var expected = "message origin=http://legoas, data=test » Window iframe.html"; | ||
FBTest.compare(expected, row.textContent, "The proper message must be displayed."); | ||
FBTest.testDone("issue5135.DONE"); | ||
}); | ||
|
||
// Execute test implemented on the test page. | ||
FBTest.click(win.document.getElementById("testButton")); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters