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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/clear-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 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>clearInterval test</title>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 <link rel="stylesheet" href="../../../resources/testharness.css">
8 </head>
9 <body>
10 <script>
11 var clearIntervalTest = async_test('Actions registered with setInterval should b e cleared by clearInterval.');
12
13 clearIntervalTest.step(function ()
14 {
15 var count = 0;
16 var intervalID;
17
18 // Fire |action| every 5ms for three times, and then clear the action.
19 function action()
20 {
21 ++count;
22 if (count == 3) {
23 window.clearInterval(intervalID);
24 // Wait for a reasonably long time (50ms here) to make sure |action| is not fired anymore.
25 window.setTimeout(clearIntervalTest.step_func(function ()
26 {
27 assert_equals(count, 3);
28 clearIntervalTest.done();
29 }, 50));
30 }
31 }
32 intervalID = window.setInterval(action, 5);
33 });
34 </script>
35 </body>
36 </html>
OLDNEW
« 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