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

Side by Side Diff: webkit/data/layout_tests/chrome/fast/dom/extensions/interval.html

Issue 28201: Changes to the interval timer:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | « no previous file | webkit/data/layout_tests/chrome/fast/dom/extensions/interval-expected.txt » ('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 <body onload="test()">
3 <div id="result">
4 <p>
5 This tests that the chromium.Interval functionality works correctly.
6 </p>
7 </div>
8 <script>
9 if (window.layoutTestController) {
10 layoutTestController.dumpAsText();
11 }
12
13 var resultDiv = document.getElementById("result");
14
15 function check(name, passed) {
16 if (passed) {
17 resultDiv.innerHTML += "PASS - " + name + "<br>";
18 } else {
19 resultDiv.innerHTML += "FAIL - " + name + "<br>";
20 }
21 }
22
23 // Spin loop for a short time
24 function pause(millisecs) {
25 var start = new Date();
26 while ((new Date() - start) < millisecs);
27 }
28
29
30 function test() {
31 var interval = new chromium.Interval();
32
33 // Verify initialization.
34 check("initial zero", interval.microseconds() == 0);
35
36 // Verify that starting the timer works.
37 interval.start();
38 pause(500);
39 check("start", interval.microseconds() >= 500000);
40
41 // Verify that restarting the interval should reset the beginning time
42 interval.start();
43 pause(1);
44 check("restart", interval.microseconds() > 0 && interval.microseconds() < 5000 00);
45
46 // Verify that calling stop() before start() has no effect.
47 var interval = new chromium.Interval();
48 interval.stop();
49 check("initial stop", interval.microseconds() == 0);
50
51 // Verify a start/stop sequence.
52 interval.start();
53 pause(50);
54 interval.stop();
55 var ms = interval.microseconds();
56 check("stop", ms > 0 && ms < 1000000);
57
58 // Verify that the timer is really stopped.
59 check("stopped", ms == interval.microseconds());
60
61 // Verify that re-stopping the timer works.
62 interval.stop();
63 check("re-stopped", interval.microseconds() > ms);
64 }
65 </script>
66 </body>
67 </html>
OLDNEW
« no previous file with comments | « no previous file | webkit/data/layout_tests/chrome/fast/dom/extensions/interval-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698