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

Unified Diff: LayoutTests/fast/dom/Window/clear-interval.html

Issue 19494002: Distinguish actions registered with setTimeout() and setInterval(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/clear-interval-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/clear-interval.html
diff --git a/LayoutTests/fast/dom/Window/clear-interval.html b/LayoutTests/fast/dom/Window/clear-interval.html
new file mode 100644
index 0000000000000000000000000000000000000000..0bda3f34ab9469e895b8eff5f8872b0bc1a7e6d5
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/clear-interval.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>clearInterval test</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<link rel="stylesheet" href="../../../resources/testharness.css">
+</head>
+<body>
+<script>
+var clearIntervalTest = async_test('Actions registered with setInterval should be cleared by clearInterval.');
+
+clearIntervalTest.step(function ()
+{
+ var count = 0;
+ var intervalID;
+
+ // Fire |action| every 5ms for three times, and then clear the action.
+ function action()
+ {
+ ++count;
+ if (count == 3) {
+ window.clearInterval(intervalID);
+ // Wait for a reasonably long time (50ms here) to make sure |action| is not fired anymore.
+ window.setTimeout(clearIntervalTest.step_func(function ()
+ {
+ assert_equals(count, 3);
+ clearIntervalTest.done();
+ }, 50));
+ }
+ }
+ intervalID = window.setInterval(action, 5);
+});
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/clear-interval-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698