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

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: Address comments 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
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..c30ed980a4fb85b9cf21c0aca1a7a4c907725d93
--- /dev/null
+++ b/LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js
@@ -0,0 +1,26 @@
+function isBoxOfColor(givenColor)
+{
+ return function(e, quiet)
+ {
+ var color = window.getComputedStyle(e).backgroundColor;
+ if (color == givenColor)
+ return true;
+ if (!quiet)
+ testFailed('Box had backgroundColor: ' + color);
Rick Byers 2014/03/14 17:01:02 seems like it would be a lot more understandable i
+ return false;
+ }
+}
+
+function elementCenter(e)
+{
+ return {
+ x: e.offsetLeft + e.offsetWidth / 2,
+ y: e.offsetTop + e.offsetHeight / 2
+ }
+}
+
+// Generate methods
+window.isBoxDefault = isBoxOfColor("rgb(0, 0, 255)");
+window.isBoxHovered = isBoxOfColor("rgb(255, 0, 0)");
Rick Byers 2014/03/14 17:01:02 the name of this function and that below is a litt
+window.isBoxActive = isBoxOfColor("rgb(0, 255, 0)");
+window.isBoxHoveredAndActive = isBoxOfColor("rgb(255, 255, 0)");

Powered by Google App Engine
This is Rietveld 408576698