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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/html/webappapis/idle-callbacks/cancel-invoked.html

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title>cancelling idle requests</title> 3 <title>cancelling idle requests</title>
4 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script> 5 <script src=/resources/testharnessreport.js></script>
6 <div id="log"></div> 6 <div id="log"></div>
7 <script> 7 <script>
8 test(function (t) { 8 test(function (t) {
9 window.cancelIdleCallback(42); 9 window.cancelIdleCallback(42);
10 assert_true(true); 10 assert_true(true);
11 }, "cancelIdleCallback does nothing if there is no callback with the given han dle"); 11 }, "cancelIdleCallback does nothing if there is no callback with the given han dle");
12 12
13 async_test(function (t) { 13 async_test(function (t) {
14 assert_false(document.hidden, "document.hidden must exist and be false to ru n this test properly"); 14 assert_false(document.hidden, "document.hidden must exist and be false to ru n this test properly");
15 var neverCalled = true; 15 var neverCalled = true;
16 var handle = window.requestIdleCallback(function () { 16 var handle = window.requestIdleCallback(function () {
17 neverCalled = false; 17 neverCalled = false;
18 }); 18 });
19 window.cancelIdleCallback(handle); 19 window.cancelIdleCallback(handle);
20 20
21 t.step_timeout(function() { 21 t.step_timeout(function() {
22 assert_true(neverCalled); 22 assert_true(neverCalled);
23 t.done(); 23 t.done();
24 }, 2000); 24 }, 2000);
25 }, "A cancelled callback is never invoked"); 25 }, "A cancelled callback is never invoked");
26
27 async_test(function (t) {
28 var handle = requestIdleCallback(t.step_func_done(function () {
29 cancelIdleCallback(handle);
30 }));
31 }, "Cancelling the currently executing idle callback should be allowed");
26 </script> 32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698