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

Side by Side Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/idle-callback/basic.html

Issue 2964563002: Removing --disable/enable-threaded-compositing cmdline switches.
Patch Set: Created 3 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>window.requestIdleCallback exists</title>
3 <link rel="author" title="Ross McIlroy" href="mailto:rmcilroy@chromium.org" />
4 <link rel="help" href="http://www.w3.org/TR/requestidlecallback/"/>
5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script>
7 <link rel="stylesheet" href="../../resources/testharness.css" />
8 <script>
9 test(function() {
10 assert_equals(typeof window.requestIdleCallback, "function");
11 }, "window.requestIdleCallback is defined", {assert: "The window.requestIdleCall back function is used to request callbacks during browser-defined idle time."});
12
13 test(function() {
14 assert_equals(typeof window.cancelIdleCallback, "function");
15 }, "window.cancelIdleCallback is defined", {assert: "The window.cancelIdleCallba ck function is used to cancel callbacks scheduled via requestIdleCallback."});
16
17 test(function() {
18 assert_equals(typeof window.requestIdleCallback(function() {}), "number");
19 }, "window.requestIdleCallback() returns a number", {assert: "The requestIdleCal lback method MUST return a long"});
20
21 test(function() {
22 assert_equals(typeof window.cancelIdleCallback(1), "undefined");
23 }, "window.cancelIdleCallback() returns undefined", {assert: "The cancelIdleCall back method MUST return void"});
24
25 test(function() {
26 assert_equals(typeof window.cancelIdleCallback(-1), "undefined");
27 assert_equals(typeof window.cancelIdleCallback(0), "undefined");
28 }, "window.cancelIdleCallback() returns undefined for unmapped IDs", {assert: "T he cancelIdleCallback method MUST return void"});
29
30 async_test(function() {
31 // Check whether requestIdleCallback schedules a callback which gets executed
32 // and the deadline argument is passed correctly.
33 requestIdleCallback(this.step_func(function(deadline) {
34 assert_equals(typeof deadline, "object", "IdleDeadline MUST be passed to cal lback.");
35 assert_equals(typeof deadline.timeRemaining, "function", "IdleDeadline.timeR emaining MUST be a function which returns the time remaining in milliseconds");
36 assert_equals(typeof deadline.timeRemaining(), "number", "IdleDeadline.timeR emaining MUST return a double of the time remaining in milliseconds");
37 assert_true(deadline.timeRemaining() <= 50, "IdleDeadline.timeRemaining() MU ST be less than or equal to 50ms in the future.");
38 assert_equals(typeof deadline.didTimeout, "boolean", "IdleDeadline.didTimeou t MUST be a boolean");
39 assert_false(deadline.didTimeout, "IdleDeadline.didTimeout MUST be false if requestIdleCallback wasn't scheduled due to a timeout");
40 this.done();
41 }));
42 }, 'requestIdleCallback schedules callbacks');
43
44 async_test(function() {
45 // Check whether requestIdleCallback schedules a callback which gets executed
46 // and the deadline argument is passed correctly.
47 var handle = requestIdleCallback(this.step_func(function(deadline) {
48 assert_unreached("callback should not be called if canceled with cancelIdleC allback");
49 }));
50 cancelIdleCallback(handle);
51 setTimeout(this.step_func(function() {
52 this.done();
53 }), 200);
54 }, 'cancelIdleCallback cancels callbacks');
55
56 </script>
57 <h1>Description</h1>
58 <p>This test validates that window.requestIdleCallback and window.cancelIdleCall back exist and are a functions.</p>
59 <div id="log"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698