Chromium Code Reviews| 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..8718a22dc1907ed58cb7374188427a06af9906b5 |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js |
| @@ -0,0 +1,35 @@ |
| +function getElement(e) |
| +{ |
| + if (typeof e == "string") |
| + e = document.getElementById(e); |
| + return e; |
| +} |
| + |
| +function isBoxOfColor(givenColor) |
| +{ |
| + return function(e, quiet) |
| + { |
| + e = getElement(e); |
| + var color = window.getComputedStyle(e).backgroundColor; |
| + if (color == givenColor) |
| + return true; |
| + if (!quiet) |
| + testFailed('Box had backgroundColor: ' + color); |
| + return false; |
| + } |
| +} |
| + |
| +function elementCenter(e) |
|
tdresser
2014/03/14 14:24:51
Where is this used?
Zeeshan Qureshi
2014/03/14 14:52:21
Oh I was using this in another CL and decided to s
|
| +{ |
| + e = getElement(e); |
| + return { |
| + x: e.offsetLeft + e.offsetWidth / 2, |
| + y: e.offsetTop + e.offsetHeight / 2 |
| + } |
| +} |
| + |
| +// Generate methods |
|
tdresser
2014/03/14 14:24:51
Could switch to "boxShouldBeOfColor," which would
Zeeshan Qureshi
2014/03/14 14:52:21
I'm not quite following this, wouldn't the test ou
|
| +window.isBoxDefault = isBoxOfColor("rgb(0, 0, 255)"); |
| +window.isBoxHovered = isBoxOfColor("rgb(255, 0, 0)"); |
| +window.isBoxActive = isBoxOfColor("rgb(0, 255, 0)"); |
| +window.isBoxHoverActive = isBoxOfColor("rgb(255, 255, 0)"); |
|
tdresser
2014/03/14 14:24:51
How about "isBoxHoveredAndActive"?
Zeeshan Qureshi
2014/03/14 14:52:21
That sounds better.
|