Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 eventList = []; | |
| 22 var x = 100; | |
| 23 var y = 100; | |
| 24 | |
| 25 function addBlue() { | |
| 26 document.body.innerHTML += '<div id="blue"></div>'; | |
| 27 var blue = document.getElementById("blue"); | |
| 28 var events = ['mouseover', 'mousemove', 'mouseout', 'mouseenter', 'mouseleav e']; | |
| 29 events.forEach(function (event) { | |
| 30 blue.addEventListener(event, validMouseEventsResult); | |
| 31 }); | |
| 32 } | |
| 33 | |
| 34 function loaded() { | |
| 35 document.addEventListener('click', addBlue); | |
| 36 } | |
| 37 | |
| 38 function validMouseEventsResult(event) { | |
| 39 eventList.push(event.type); | |
| 40 testMouseOver.step(function () { | |
| 41 assert_equals(event.target.id, "blue"); | |
| 42 assert_equals(getComputedStyle(event.target).backgroundColor, "rgb(255, 255, 0)"); | |
| 43 }); | |
| 44 } | |
| 45 | |
| 46 function callbackValidMouseOver() { | |
| 47 testMouseOver.step(function () { | |
| 48 var result = eventList.join(); | |
| 49 assert_true(result == 'mouseover,mouseenter'); | |
| 50 }); | |
| 51 testMouseOver.done(); | |
| 52 } | |
| 53 | |
| 54 function testMouseOverAddElement() { | |
| 55 if (window.chrome && chrome.gpuBenchmarking) { | |
| 56 var pointerActions = | |
| 57 [{source: "mouse", | |
| 58 actions: [ | |
| 59 { name: "pointerDown", x: x, y: y }, | |
| 60 { name: "pointerUp" }, | |
| 61 { name: 'pause', duration: 0.1 }]}]; | |
|
dtapuska
2017/07/12 17:20:19
This duration is kind of funky. Could this lead to
lanwei
2017/07/12 19:00:23
Done.
| |
| 62 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal idMouseOver); | |
| 63 } | |
| 64 } | |
| 65 | |
| 66 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.'); | |
| 67 testMouseOverAddElement(); | |
| 68 | |
| 69 </script> | |
| 70 </body> | |
| 71 | |
| 72 | |
| OLD | NEW |