Home | History | Annotate | Download | only in ManualTests
      1 <html><head><title>Cookie Test</title>
      2 <script>
      3 function cookieTest(){
      4     var totalW = 0.0;
      5     var totalR = 0.0;
      6     var numLoops = 100;
      7     for(var i=0; i < numLoops; i++){
      8         var randomNumber=Math.floor(Math.random()*11);
      9         var time = new Date();
     10         time.setTime(time.getTime() + 1000);
     11         var cookieString = "cookie" + randomNumber + "=true; expires=" + time.toGMTString();
     12         var preW = new Date().getTime();
     13         document.cookie = cookieString;
     14         var postW = new Date().getTime();
     15         if(document.cookie.indexOf(("cookie" + randomNumber)> 0));
     16         var postR = new Date().getTime();
     17         totalW += (postW - preW);
     18         totalR += (postR - postW);
     19     }
     20     document.write("<br><br>avg R(millis):" + totalR/numLoops);
     21     document.write("<br>avg W(millis):" + totalW/numLoops);
     22 }
     23 
     24 </script>
     25 </head>
     26 <body onload="javascript:cookieTest();setTimeout(cookieTest(), 1000);">
     27 </body>
     28 </html>
     29