Index: third_party/WebKit/LayoutTests/fast/events/layout-change-should-fire-mouseover.html |
diff --git a/third_party/WebKit/LayoutTests/fast/events/layout-change-should-fire-mouseover.html b/third_party/WebKit/LayoutTests/fast/events/layout-change-should-fire-mouseover.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7975113a33a15b5fe999c97fe15a9cf7b3768c3e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/events/layout-change-should-fire-mouseover.html |
@@ -0,0 +1,78 @@ |
+<!DOCTYPE html> |
+<script src='../../resources/testharness.js'></script> |
+<script src='../../resources/testharnessreport.js'></script> |
+<style type="text/css"> |
+#blue { |
+ background-color: rgb(0, 0, 255); |
+ position: absolute; |
+ left: 75px; |
+ top: 75px; |
+ height: 100px; |
+ width: 100px; |
+} |
+#blue:hover { |
+ background-color: rgb(255, 255, 0); |
+} |
+</style> |
+ |
+<body onload="loaded();"> |
+ |
+<script type="text/javascript"> |
+var mouseover = false; |
Navid Zolghadr
2017/07/05 17:37:33
Can we make this test a little more comprehensive?
lanwei
2017/07/06 03:04:34
Done.
|
+var mousemove = false; |
+var x = 100; |
+var y = 100; |
+ |
+function addBlue() { |
+ document.body.innerHTML += '<div id="blue"></div>'; |
+ var blue = document.getElementById("blue"); |
+ blue.addEventListener('mouseover', validMouseOverResult); |
+ blue.addEventListener('mousemove', validMouseMoveResult); |
+} |
+ |
+function loaded() { |
+ document.addEventListener('click', addBlue); |
+} |
+ |
+function validMouseOverResult(event) { |
+ mouseover = true; |
+ testMouseOver.step(function () { |
+ assert_equals(event.target.id, "blue"); |
+ assert_equals(getComputedStyle(event.target).backgroundColor, "rgb(255, 255, 0)"); |
+ }); |
+} |
+ |
+function validMouseMoveResult(event) { |
+ mousemove = true; |
+ testMouseOver.step(function () { |
+ assert_equals(event.target.id, "blue"); |
+ }); |
+} |
+ |
+function callbackValidMouseOver() { |
+ testMouseOver.step(function () { |
+ assert_true(mouseover); |
+ assert_false(mousemove); |
+ }); |
+ testMouseOver.done(); |
+} |
+ |
+function testMouseOverAddElement() { |
+ if (window.chrome && chrome.gpuBenchmarking) { |
+ var pointerActions = |
+ [{source: "mouse", |
+ actions: [ |
+ { name: "pointerDown", x: x, y: y }, |
+ { name: "pointerUp" }, |
+ { name: 'pause', duration: 0.1 }]}]; |
+ chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackValidMouseOver); |
+ } |
+} |
+ |
+var testMouseOver = async_test('Tests that the mouseover event is fired and the element has a hover effect when the element underneath the mouse cursor is changed.'); |
+testMouseOverAddElement(); |
+ |
+</script> |
+</body> |
+ |
+ |