- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / read_cookies.html
1 <html>
2 <body>
3 <pre>
4 <script>
5
6 // This script tests the performance of reading cookies.  It sets a cookie and
7 // then reads cookies N times.  Finally, it outputs the average time taken to
8 // read the cookie.
9
10 document.cookie =
11   'one_heck_of_a_crazy_cookie_name=1234567890.1234567890.1234567890.1234567890';
12
13 var ok = true;
14
15 var num_iters = document.location.search.substring(1) - 0;
16 if (num_iters == 0)
17   num_iters = 10000;
18 document.writeln("num_iters: " + num_iters);
19
20 var ts = (new Date()).getTime();
21
22 // read the cookie num_iters times
23 for (var i = 0; i < num_iters; ++i) {
24   var d = document.cookie;
25 }
26
27 var te = (new Date()).getTime();
28
29 var time_per_read = (te - ts) / num_iters;
30 document.writeln("time per read: " + time_per_read.toFixed(3) + " msec");
31
32 </script>
33 </pre>
34 </body>
35 </html>