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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/mouse-cursor-change-after-image-load.html

Issue 2107043002: Schedule cursor update on URL cursor image loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eae's review Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/mouse-cursor-change-after-image-load.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/mouse-cursor-change-after-image-load.html b/third_party/WebKit/LayoutTests/fast/events/mouse-cursor-change-after-image-load.html
new file mode 100644
index 0000000000000000000000000000000000000000..031e576262a75bf35ebcd4f45783d6e2937db5df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/mouse-cursor-change-after-image-load.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Cursor: should update after image loaded even when stationary</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+#target {
+ height: 500px;
+ width: 500px;
+}
+</style>
+</head>
+<body>
+<div id="target"></div>
+<script>
+var cursorTest = async_test('Test cursor update after image loaded');
+cursorTest.step(function() {
+ assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.');
+
+ assert_equals(internals.getCurrentCursorInfo(), "type=Pointer hotSpot=0,0");
+
+ var target = document.getElementById('target');
+ var rect = target.getBoundingClientRect();
+ eventSender.mouseMoveTo(rect.left + 3, rect.top + 3);
+
+ // Wait for condition until timeout.
+ function waitForCondition(condition, completion) {
+ if (condition()) {
+ completion();
+ } else {
+ requestAnimationFrame(() => waitForCondition(condition, completion));
+ }
+ }
+
+ function testSetCursorImage(url, expectedCursorInfo, complete) {
+ const currentCursorInfo = internals.getCurrentCursorInfo();
+ target.style.cursor = `url(${url}),auto`;
+ waitForCondition(() => internals.getCurrentCursorInfo() != currentCursorInfo, cursorTest.step_func(() => {
+ assert_equals(internals.getCurrentCursorInfo(), expectedCursorInfo);
+ complete();
+ }));
+ }
+
+ testSetCursorImage('resources/greenbox.png', 'type=Custom hotSpot=0,0 image=25x25', () => {
+ testSetCursorImage('resources/abe.png', 'type=Custom hotSpot=0,0 image=76x103', () => {
+ cursorTest.done();
+ })
+ });
+});
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698