Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added the test case to issue 5834

  • Loading branch information...
commit d121cc5afc9c50aff838e9eb69fc932a5e03c5b7 1 parent e60a084
Bharath authored September 11, 2012
64  tests/content/cookies/5834/issue5834.js
... ...
@@ -0,0 +1,64 @@
  1
+function runTest()
  2
+{
  3
+    FBTest.sysout("issue5834.START");
  4
+
  5
+    FBTest.openNewTab(basePath + "cookies/5834/issue5834.php", function(win)
  6
+    {
  7
+        FBTest.openFirebug();
  8
+        FBTestFireCookie.enableCookiePanel(function(win)
  9
+        {
  10
+            FBTest.selectPanel("cookies");
  11
+
  12
+            var tests = [];
  13
+            tests.push(short);
  14
+            tests.push(shortURLEncoded);
  15
+            tests.push(long);
  16
+            tests.push(longURLEncoded);
  17
+
  18
+            FBTest.runTestSuite(tests, function()
  19
+            {
  20
+                FBTest.testDone("issue5834; DONE");
  21
+            });
  22
+        });
  23
+    });
  24
+}
  25
+
  26
+function short(callback)
  27
+{
  28
+    executeTest("TestCookie5834-1", /Size\s*21 B/, callback);
  29
+}
  30
+
  31
+function shortURLEncoded(callback)
  32
+{
  33
+    executeTest("TestCookie5834-2", /Size\s*23 B\s*Raw Size\s*31 B/, callback);
  34
+}
  35
+
  36
+function long(callback)
  37
+{
  38
+    executeTest("TestCookie5834-3", new RegExp("Size\\s*"+((1.2).toLocaleString())+" KB\\s*\\("+
  39
+        ((1216).toLocaleString())+" B\\)"), callback);
  40
+}
  41
+
  42
+function longURLEncoded(callback)
  43
+{
  44
+    executeTest("TestCookie5834-4", new RegExp("Size\\s*"+(166).toLocaleString()+
  45
+        " B\\s*Raw Size\\s*"+(1.3).toLocaleString()+" KB\\s*\\("+(1366).toLocaleString()+" B\\)"),
  46
+        callback);
  47
+}
  48
+
  49
+function executeTest(cookieName, expected, callback)
  50
+{
  51
+    var panelNode = FBTest.getSelectedPanel().panelNode;
  52
+    var cookie = FBTestFireCookie.getCookieByName(panelNode, cookieName);
  53
+    var sizeCol = cookie.row.getElementsByClassName("cookieSizeCol").item(0);
  54
+
  55
+    var config = {tagName: "table", classes: "sizeInfoTip"};
  56
+    FBTest.waitForDisplayedElement("cookies", config, function (infoTip)
  57
+    {
  58
+        FBTest.compare(expected, infoTip.textContent, "The infotip for the '"+cookieName+
  59
+            "' cookie must contain the correct values");
  60
+        callback();
  61
+    });
  62
+
  63
+    FBTest.mouseOver(sizeCol);
  64
+}
71  tests/content/cookies/5834/issue5834.php
... ...
@@ -0,0 +1,71 @@
  1
+<?php
  2
+    $longValue = "";
  3
+    $longValueUTF8 = "";
  4
+
  5
+    for ($i=0; $i<1200; $i++)
  6
+      $longValue .= "x";
  7
+
  8
+    for ($i=0; $i<150; $i++)
  9
+      $longValueUTF8 .= "☺";
  10
+
  11
+    $time = time() + 86400;
  12
+    $dir = dirname($_SERVER['SCRIPT_NAME']);
  13
+
  14
+    setcookie("TestCookie5834-1", "Value", $time, $dir);
  15
+    setcookie("TestCookie5834-2", "Value ☺", $time, $dir);
  16
+    setcookie("TestCookie5834-3", $longValue, $time, $dir);
  17
+    setcookie("TestCookie5834-4", $longValueUTF8, $time, $dir);
  18
+?>
  19
+
  20
+<!DOCTYPE html>
  21
+<html>
  22
+    <head>
  23
+        <title>Issue 5834: Add infotip for cookie size</title>
  24
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  25
+        <link href="../../_common/testcase.css" type="text/css" rel="stylesheet"/>
  26
+    </head>
  27
+    <body>
  28
+        <header>
  29
+            <h1><a href="http://code.google.com/p/fbug/issues/detail?id=5834">Issue 5834</a>: Add infotip for cookie size</h1>
  30
+        </header>
  31
+        <div>
  32
+            <section id="description">
  33
+                <h3>Steps to reproduce</h3>
  34
+                <ol>
  35
+                    <li>Open Firebug</li>
  36
+                    <li>Enable and switch to the <em>Cookies</em> panel</li>
  37
+                    <li>
  38
+                        Reload the page<br/>
  39
+                        <span class="ok">&rArr; Four cookies should be listed (<code>TestCookie5834-1</code> to <code>TestCookie5834-4</code>)</span>
  40
+                    </li>
  41
+                    <li>Hover the size value of each cookie</li>
  42
+                </ol>
  43
+                <h3>Expected result</h3>
  44
+                <ul>
  45
+                    <li>
  46
+                        An infotip should be displayed for each value:<br/>
  47
+TestCookie5834-1:
  48
+                        <code>
  49
+Size 21 B
  50
+                        </code><br/>
  51
+TestCookie5834-2:
  52
+                        <code>
  53
+Size 23 B
  54
+Raw Size 31 B
  55
+                        </code><br/>
  56
+TestCookie5834-3:
  57
+                        <code>
  58
+Size 1.2 KB (1,216 B)
  59
+                        </code><br/>
  60
+TestCookie5834-4:
  61
+                        <code>
  62
+Size 166 B
  63
+Raw Size 1.3 KB (1,366 B)
  64
+                        </code>
  65
+                    </li>
  66
+                </ul>
  67
+            </section>
  68
+            <footer>Sebastian Zartner, sebastianzartner@gmail.com</footer>
  69
+        </div>
  70
+    </body>
  71
+</html>
1  tests/content/firebug.html
@@ -334,6 +334,7 @@
334 334
     {group: "cookies",            uri: "cookies/54/issue54.js",                   desc: "urlencoding of cookies value", testPage: "cookies/54/issue54.php" },
335 335
     {group: "cookies",            uri: "cookies/60/issue60.js",                   desc: "'[' and ']' characters get badly encoded on cookie name upon editing", testPage: "cookies/60/issue60.php" },
336 336
     {group: "cookies",            uri: "cookies/5560/issue5560.js",               desc: "Add column for raw value", testPage: "cookies/5560/issue5560.php" }
  337
+    {group: "cookies",            uri: "cookies/5834/issue5834.js",               desc: "Add infotip for cookie size", testpage: "cookies/5834/issue5834.php" }
337 338
 ];
338 339
 </script>
339 340
 

0 notes on commit d121cc5

Please sign in to comment.
Something went wrong with that request. Please try again.