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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/data/layout_tests/chrome/fast/dom/extensions/interval.html
===================================================================
--- webkit/data/layout_tests/chrome/fast/dom/extensions/interval.html (revision 0)
+++ webkit/data/layout_tests/chrome/fast/dom/extensions/interval.html (revision 0)
@@ -0,0 +1,67 @@
+<html>
+<body onload="test()">
+<div id="result">
+<p>
+This tests that the chromium.Interval functionality works correctly.
+</p>
+</div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+}
+
+var resultDiv = document.getElementById("result");
+
+function check(name, passed) {
+ if (passed) {
+ resultDiv.innerHTML += "PASS - " + name + "<br>";
+ } else {
+ resultDiv.innerHTML += "FAIL - " + name + "<br>";
+ }
+}
+
+// Spin loop for a short time
+function pause(millisecs) {
+ var start = new Date();
+ while ((new Date() - start) < millisecs);
+}
+
+
+function test() {
+ var interval = new chromium.Interval();
+
+ // Verify initialization.
+ check("initial zero", interval.microseconds() == 0);
+
+ // Verify that starting the timer works.
+ interval.start();
+ pause(500);
+ check("start", interval.microseconds() >= 500000);
+
+ // Verify that restarting the interval should reset the beginning time
+ interval.start();
+ pause(1);
+ check("restart", interval.microseconds() > 0 && interval.microseconds() < 500000);
+
+ // Verify that calling stop() before start() has no effect.
+ var interval = new chromium.Interval();
+ interval.stop();
+ check("initial stop", interval.microseconds() == 0);
+
+ // Verify a start/stop sequence.
+ interval.start();
+ pause(50);
+ interval.stop();
+ var ms = interval.microseconds();
+ check("stop", ms > 0 && ms < 1000000);
+
+ // Verify that the timer is really stopped.
+ check("stopped", ms == interval.microseconds());
+
+ // Verify that re-stopping the timer works.
+ interval.stop();
+ check("re-stopped", interval.microseconds() > ms);
+}
+</script>
+</body>
+</html>
« 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