Added the test case for issue 5834 #36

Open
wants to merge 1 commit into
from
View
64 tests/content/cookies/5834/issue5834.js
@@ -0,0 +1,64 @@
+function runTest()
+{
+ FBTest.sysout("issue5834.START");
+
+ FBTest.openNewTab(basePath + "cookies/5834/issue5834.php", function(win)
+ {
+ FBTest.openFirebug();
+ FBTestFireCookie.enableCookiePanel(function(win)
+ {
+ FBTest.selectPanel("cookies");
+
+ var tests = [];
+ tests.push(short);
+ tests.push(shortURLEncoded);
+ tests.push(long);
+ tests.push(longURLEncoded);
+
+ FBTest.runTestSuite(tests, function()
+ {
+ FBTest.testDone("issue5834; DONE");
+ });
+ });
+ });
+}
+
+function short(callback)
+{
+ executeTest("TestCookie5834-1", /Size\s*21 B/, callback);
+}
+
+function shortURLEncoded(callback)
+{
+ executeTest("TestCookie5834-2", /Size\s*23 B\s*Raw Size\s*31 B/, callback);
+}
+
+function long(callback)
+{
+ executeTest("TestCookie5834-3", new RegExp("Size\\s*"+((1.2).toLocaleString())+" KB\\s*\\("+
+ ((1216).toLocaleString())+" B\\)"), callback);
+}
+
+function longURLEncoded(callback)
+{
+ executeTest("TestCookie5834-4", new RegExp("Size\\s*"+(166).toLocaleString()+
+ " B\\s*Raw Size\\s*"+(1.3).toLocaleString()+" KB\\s*\\("+(1366).toLocaleString()+" B\\)"),
+ callback);
+}
+
+function executeTest(cookieName, expected, callback)
+{
+ var panelNode = FBTest.getSelectedPanel().panelNode;
+ var cookie = FBTestFireCookie.getCookieByName(panelNode, cookieName);
+ var sizeCol = cookie.row.getElementsByClassName("cookieSizeCol").item(0);
+
+ var config = {tagName: "table", classes: "sizeInfoTip"};
+ FBTest.waitForDisplayedElement("cookies", config, function (infoTip)
+ {
+ FBTest.compare(expected, infoTip.textContent, "The infotip for the '"+cookieName+
+ "' cookie must contain the correct values");
+ callback();
+ });
+
+ FBTest.mouseOver(sizeCol);
+}
View
71 tests/content/cookies/5834/issue5834.php
@@ -0,0 +1,71 @@
+<?php
+ $longValue = "";
+ $longValueUTF8 = "";
+
+ for ($i=0; $i<1200; $i++)
+ $longValue .= "x";
+
+ for ($i=0; $i<150; $i++)
+ $longValueUTF8 .= "";
+
+ $time = time() + 86400;
+ $dir = dirname($_SERVER['SCRIPT_NAME']);
+
+ setcookie("TestCookie5834-1", "Value", $time, $dir);
+ setcookie("TestCookie5834-2", "Value ☺", $time, $dir);
+ setcookie("TestCookie5834-3", $longValue, $time, $dir);
+ setcookie("TestCookie5834-4", $longValueUTF8, $time, $dir);
+?>
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Issue 5834: Add infotip for cookie size</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <link href="../../_common/testcase.css" type="text/css" rel="stylesheet"/>
+ </head>
+ <body>
+ <header>
+ <h1><a href="http://code.google.com/p/fbug/issues/detail?id=5834">Issue 5834</a>: Add infotip for cookie size</h1>
+ </header>
+ <div>
+ <section id="description">
+ <h3>Steps to reproduce</h3>
+ <ol>
+ <li>Open Firebug</li>
+ <li>Enable and switch to the <em>Cookies</em> panel</li>
+ <li>
+ Reload the page<br/>
+ <span class="ok">&rArr; Four cookies should be listed (<code>TestCookie5834-1</code> to <code>TestCookie5834-4</code>)</span>
+ </li>
+ <li>Hover the size value of each cookie</li>
+ </ol>
+ <h3>Expected result</h3>
+ <ul>
+ <li>
+ An infotip should be displayed for each value:<br/>
+TestCookie5834-1:
+ <code>
+Size 21 B
+ </code><br/>
+TestCookie5834-2:
+ <code>
+Size 23 B
+Raw Size 31 B
+ </code><br/>
+TestCookie5834-3:
+ <code>
+Size 1.2 KB (1,216 B)
+ </code><br/>
+TestCookie5834-4:
+ <code>
+Size 166 B
+Raw Size 1.3 KB (1,366 B)
+ </code>
+ </li>
+ </ul>
+ </section>
+ <footer>Sebastian Zartner, sebastianzartner@gmail.com</footer>
+ </div>
+ </body>
+</html>
View
142 tests/content/cookies/5834/testcase.css
@@ -0,0 +1,142 @@
+@font-face {
+ font-family: 'TitilliumMaps';
+ src: url('http://getfirebug.com/fonts/TitilliumMaps26L001.eot');
+ src: local(''), url('http://getfirebug.com/fonts/TitilliumMaps26L001.woff') format('woff'), url('http://getfirebug.com/fonts/TitilliumMaps26L001.ttf') format('truetype');
+ font-weight: bold;
+}
+
+* {
+ position: relative;
+}
+
+html, body {
+ width: 100%;
+ min-height: -moz-calc(100% - 30px);
+ margin: 0;
+ padding-bottom: 30px;
+}
+
+body {
+ background: #FFFFFF -moz-linear-gradient(center top, #EAF1FB, #FFFFFF 450px) no-repeat;
+ font-family: "Trebuchet MS", Helvetica, sans-serif;
+ font-size: 0.9em;
+}
+
+body > div, h1 {
+ margin: auto;
+ width: 800px;
+}
+
+body > div {
+ top: 40px;
+ border-radius: 8px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
+ background-color: rgba(255, 255, 255, 0.6);
+ padding: 15px;
+}
+
+section#content {
+ background-image: -moz-linear-gradient(bottom, #E6E6E6, #F0F0F0);
+ border-radius: 8px;
+ margin-bottom: 10px;
+ padding: 10px;
+}
+
+section#output {
+ display: none;
+ background-image: -moz-linear-gradient(bottom, #F5F5F5, #FFFFFF);
+ margin: 10px 0;
+ padding: 10px;
+}
+
+pre {
+ margin: 0;
+}
+
+footer {
+ margin-top: 10px;
+ text-align: right;
+ font-size: 75%;
+ font-style: italic;
+}
+
+h1, h2 {
+ font-family: /* TitilliumMaps, */ "Trebuchet MS", Helvetica, sans-serif;
+ font-size: 130%;
+ font-weight: bold;
+}
+
+h1 {
+ top: 20px;
+}
+
+h2 {
+ margin: 0.5em 0;
+ border-bottom: 2px solid #9ACBE4;
+}
+
+h3 {
+ margin: 0.3em 0 0.2em 0;
+ font-size: 105%;
+}
+
+p, ol, ul {
+ margin: 0.2em 0;
+}
+
+p {
+ padding-left: 20px;
+}
+
+section#description p {
+ font-style: italic;
+}
+
+section#description ul {
+ list-style-type: square;
+ list-style-image: url(data:image/gif;base64,R0lGODlhBQAIAPcAAGOMnGOMnP///2OMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnGOMnP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAIALAAAAAAFAAgABwgSAAEIHEiwoEGC/xImFMCwocOAADs=);
+}
+
+section#description li.ok, section#description li span.ok {
+ color: #00B400;
+}
+
+section#description li.error, section#description li span.error {
+ color: #DC0000;
+}
+
+code {
+ white-space: pre;
+ color: #008C00;
+}
+
+code.key {
+ color: #0000DC;
+}
+
+input, button {
+ border: 1px solid #AAAAAA;
+ border-radius: 5px;
+ padding: 3px 5px;
+}
+
+input[type="button"], button {
+ background-image: -moz-linear-gradient(bottom, #A0A0A0, #C8C8C8);
+ box-shadow: 0 -2px 2px -1px rgba(0, 0, 0, 0.5) inset, 0 2px 2px -1px #FFFFFF inset;
+ text-shadow: 1px 1px rgba(255, 255, 255, 0.3);
+}
+
+input[type="button"][disabled="true"], button[disabled="true"] {
+ background-image: -moz-linear-gradient(bottom, #C8C8C8, #F0F0F0);
+}
+
+input[type="button"]:not([disabled="true"]):hover,
+button:not([disabled="true"]):hover {
+ background-image: -moz-linear-gradient(bottom, #B4B4B4, #DCDCDC);
+}
+
+input[type="button"]:not([disabled="true"]):active,
+button:not([disabled="true"]):active {
+ background-image: -moz-linear-gradient(top, #8C8C8C, #A0A0A0);
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.5) inset, 0 -2px 2px -1px #FFFFFF inset;
+}