Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Wait until any mouse cursor update has completed, then verify the cursor info | 1 // Wait until any mouse cursor update has completed, then verify the cursor info |
| 2 // is what's expected and call the provided continuation. | 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. | 3 // We need to poll to ensure EventHandler's cursor update timer has had a chance to fire. |
| 4 function expectCursorUpdate(expectedInfo, completion) { | 4 function expectCursorUpdate(expectedInfo, completion) { |
| 5 // Need to give style application a chance to take effect first. | 5 // Need to give style application a chance to take effect first. |
| 6 requestAnimationFrame(function() { | 6 requestAnimationFrame(function() { |
| 7 // Note that cursorUpdatePending should (almost?) always be true at this | 7 // Note that cursorUpdatePending should (almost?) always be true at this |
| 8 // point, but we probably shouldn't depend on that in case scheduler cha nges | 8 // point, but we probably shouldn't depend on that in case scheduler cha nges |
| 9 // result in rAF not firing until after the cursor update timer as alrea dy | 9 // result in rAF not firing until after the cursor update timer as alrea dy |
| 10 // fired. | 10 // fired. |
| 11 var onFrame = function() { | 11 var onFrame = function() { |
| 12 if (internals.cursorUpdatePending) { | 12 if (internals.cursorUpdatePending) { |
| 13 requestAnimationFrame(onFrame); | 13 requestAnimationFrame(onFrame); |
| 14 } else { | 14 } else { |
| 15 shouldBeEqualToString('internals.getCurrentCursorInfo()', expect edInfo); | 15 shouldBeEqualToString('internals.getCurrentCursorInfo()', expect edInfo); |
| 16 completion(); | 16 completion(); |
| 17 } | 17 } |
| 18 } | 18 } |
| 19 requestAnimationFrame(onFrame); | 19 requestAnimationFrame(onFrame); |
| 20 }); | 20 }); |
| 21 } | 21 } |
| 22 | |
| 23 function expectSendFakeMouseMove(expectedInfo, completion) { | |
| 24 // Need to give style application a chance to take effect first. | |
| 25 requestAnimationFrame(function() { | |
| 26 // Note that fakeMouseMovePending should (almost?) always be true at thi s | |
| 27 // point, but we probably shouldn't depend on that in case scheduler cha nges | |
| 28 // result in rAF not firing until after the fake_mouse_move_event_timer_ as | |
| 29 // already fired. | |
| 30 var onFrame = function() { | |
| 31 if (internals.fakeMouseMovePending) { | |
|
Navid Zolghadr
2017/07/05 17:37:33
Is there any reason we don't wait for cursorUpdate
lanwei
2017/07/06 03:04:34
Yes, they are different. When we sent fake mouse m
| |
| 32 requestAnimationFrame(onFrame); | |
| 33 } else { | |
| 34 shouldBeEqualToString('internals.getCurrentCursorInfo()', expect edInfo); | |
| 35 completion(); | |
| 36 } | |
| 37 } | |
| 38 requestAnimationFrame(onFrame); | |
| 39 }); | |
| 40 } | |
| OLD | NEW |