Permalink
Browse files

FBTest: automated test for issue 5135

  • Loading branch information...
1 parent fedc819 commit 987d8a8ae9dd8afc26bedf5f8e9ed6d8dac4b191 @janodvarko janodvarko committed Nov 12, 2012
@@ -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>
@@ -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 &lt;odvarko@gmail.com&gt;
+ </footer>
+</div>
+
+
+
+</body>
+</html>
@@ -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"));
+ });
+ });
+}
@@ -116,6 +116,7 @@
{group: "console", uri: "console/5382/issue5382.js", desc: "Console.log display bug with nested arrays", testPage: "console/5382/issue5382.html"},
{group: "console", uri: "console/3663/issue3663.js", desc: "too much recursion when logging array contains itself", testPage: "console/3663/issue3663.html"},
{group: "console", uri: "console/5655/issue5655.js", desc: "console panel width empty elements", testPage: "console/5655/issue5655.html"},
+ {group: "console", uri: "console/5135/issue5135.js", desc: " Display window.postMessage() calls in console", testPage: "console/5135/issue5135.html"},
{group: "console/spy", uri: "console/spy/2285/issue2285.js", desc: "support for content-type: multipart/x-mixed-replace", testPage: "console/spy/2285/issue2285.html" },
//{group: "console/spy", uri: "console/spy/2462/issue2462.js", desc: "The firebug console still shows the xhr in progress if you abort it (via request.abort()) ", testPage: "console/spy/2462/issue2462.html" },
{group: "console/spy", uri: "console/spy/2712/issue2712.js", desc: "Gmail has network connections that report 200 Aborted", testPage: "console/spy/2712/issue2712.html" },

0 comments on commit 987d8a8

Please sign in to comment.