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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/layout-change-should-fire-mouseover.html

Issue 2956023004: Add a flag to update hover effect when a layout is changed (Closed)
Patch Set: add hover flag Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../../resources/testharness.js'></script>
3 <script src='../../resources/testharnessreport.js'></script>
4 <style type="text/css">
5 #blue {
6 background-color: rgb(0, 0, 255);
7 position: absolute;
8 left: 75px;
9 top: 75px;
10 height: 100px;
11 width: 100px;
12 }
13 #blue:hover {
14 background-color: rgb(255, 255, 0);
15 }
16 </style>
17
18 <body onload="loaded();">
19
20 <script type="text/javascript">
21 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.
22 var mousemove = false;
23 var x = 100;
24 var y = 100;
25
26 function addBlue() {
27 document.body.innerHTML += '<div id="blue"></div>';
28 var blue = document.getElementById("blue");
29 blue.addEventListener('mouseover', validMouseOverResult);
30 blue.addEventListener('mousemove', validMouseMoveResult);
31 }
32
33 function loaded() {
34 document.addEventListener('click', addBlue);
35 }
36
37 function validMouseOverResult(event) {
38 mouseover = true;
39 testMouseOver.step(function () {
40 assert_equals(event.target.id, "blue");
41 assert_equals(getComputedStyle(event.target).backgroundColor, "rgb(255, 255, 0)");
42 });
43 }
44
45 function validMouseMoveResult(event) {
46 mousemove = true;
47 testMouseOver.step(function () {
48 assert_equals(event.target.id, "blue");
49 });
50 }
51
52 function callbackValidMouseOver() {
53 testMouseOver.step(function () {
54 assert_true(mouseover);
55 assert_false(mousemove);
56 });
57 testMouseOver.done();
58 }
59
60 function testMouseOverAddElement() {
61 if (window.chrome && chrome.gpuBenchmarking) {
62 var pointerActions =
63 [{source: "mouse",
64 actions: [
65 { name: "pointerDown", x: x, y: y },
66 { name: "pointerUp" },
67 { name: 'pause', duration: 0.1 }]}];
68 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal idMouseOver);
69 }
70 }
71
72 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 chang ed.');
73 testMouseOverAddElement();
74
75 </script>
76 </body>
77
78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698