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

Unified Diff: LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js

Issue 197923006: Refactor touch hit-testing hover/active tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use states instead of colors Created 6 years, 9 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 | « LayoutTests/fast/events/touch/resources/touch-hover-active-tests.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js
diff --git a/LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js b/LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..324adc75012fc2187b12170bf9b1d0101ce95e54
--- /dev/null
+++ b/LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js
@@ -0,0 +1,28 @@
+function getHoverActiveState(e)
+{
+ var states = {
+ "rgb(0, 0, 255)": "default",
+ "rgb(0, 255, 0)": "active",
+ "rgb(255, 0, 0)": "hovered",
+ "rgb(255, 255, 0)": "hoveredAndActive"
+ };
+
+ var color = window.getComputedStyle(e).backgroundColor;
+ var result = states[color];
+ if (!result)
+ result = "unknown: " + color;
+ return result;
+}
+
+function elementCenter(e)
+{
+ return {
+ x: e.offsetLeft + e.offsetWidth / 2,
+ y: e.offsetTop + e.offsetHeight / 2
+ }
+}
+
+function shouldBeDefault(e) { shouldBeEqualToString(e, "default"); }
+function shouldBeOnlyActive(e) { shouldBeEqualToString(e, "active"); }
+function shouldBeOnlyHovered(e) { shouldBeEqualToString(e, "hovered"); }
+function shouldBeHoveredAndActive(e) { shouldBeEqualToString(e, "hoveredAndActive"); }
« no previous file with comments | « LayoutTests/fast/events/touch/resources/touch-hover-active-tests.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698