Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / cookieSpeedTest.html
blob8633557e3f362bd788c99b07ade9faf6858922dd
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);
20 document.write("<br><br>avg R(millis):" + totalR/numLoops);
21 document.write("<br>avg W(millis):" + totalW/numLoops);
24 </script>
25 </head>
26 <body onload="javascript:cookieTest();setTimeout(cookieTest(), 1000);">
27 </body>
28 </html>