Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: webkit/data/test_shell/js/timers.html

Issue 401923005: webkit: Remove all files from test_shell/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/data/test_shell/index.html ('k') | webkit/data/test_shell/sort/sort.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script language="javascript">
4 var last = new Date(); // The last time we sampled the timer
5 var total_value = 0; // The sum of the intervals measured
6 var total_count = 0; // The count of the intervals measured
7 var last_interval = 1;
8 function fire() {
9
10 var current = new Date();
11 var ms = current - last;
12
13 total_value += ms;
14 total_count++;
15
16 // Display the interval output.
17 var output = document.getElementById('output');
18 output.innerHTML = ms + "ms";
19
20 // Display the average output.
21 var average = document.getElementById('average');
22 average.innerHTML = total_value / total_count + "ms";
23
24 // Get the new interval from the input.
25 var input = document.getElementById('input');
26
27 // If the interval has changed, reset our averages.
28 if (input.value != last_interval) {
29 total_value = 0;
30 total_count = 0;
31 }
32 last_interval = input.value;
33
34 last = new Date();
35 setTimeout(fire, last_interval);
36 }
37 </script>
38 </head>
39
40 <body onload='setTimeout("fire()", 1)'>
41
42 <h1>Test JS setTimeout() speed</h1>
43
44 This page tests the frequency of setTimeout() in the browser.
45 Javascript applications use setTimeout() as a mechanism to 'yield'
46 to the browser so that the browser can repaint. Most browsers
47 implement a 15ms setTimeout() minimum. Use this to page to measure
48 setTimeout() lag and discover your browser's minimum interval.<P>
49
50 <hr>
51
52 Desired ms to delay: <input id="input" type="text" value="1"><P>
53
54 Measured delay:<br>
55 <ul>
56 instance: <div id="output"></div>
57 average: <div id="average"></div>
58 </ul>
59
60 </body>
61 </html>
OLDNEW
« no previous file with comments | « webkit/data/test_shell/index.html ('k') | webkit/data/test_shell/sort/sort.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698