Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / resources / expect-cursor-update.js
blobab01bbb715175b4c3ac8e1e41a0310345f067e9f
1 // Wait until any mouse cursor update has completed, then verify the cursor info
2 // is what's expected and call the provided continuation.
3 // We need to poll to ensure EventHandler's cursor update timer has had a chance to fire.
4 function expectCursorUpdate(expectedInfo, completion) {
5 // Need to give style application a chance to take effect first.
6 requestAnimationFrame(function() {
7 // Note that cursorUpdatePending should (almost?) always be true at this
8 // point, but we probably shouldn't depend on that in case scheduler changes
9 // result in rAF not firing until after the cursor update timer as already
10 // fired.
11 var onFrame = function() {
12 if (internals.cursorUpdatePending) {
13 requestAnimationFrame(onFrame);
14 } else {
15 shouldBeEqualToString('internals.getCurrentCursorInfo()', expectedInfo);
16 completion();
19 requestAnimationFrame(onFrame);
20 });