OLD | NEW |
1 window.jsTestIsAsync = true; | 1 window.jsTestIsAsync = true; |
2 | 2 |
3 var iframe; | 3 var iframe; |
4 var testInput; | 4 var testInput; |
5 | 5 |
6 function getSpinButton(input) | 6 function getSpinButton(input) |
7 { | 7 { |
8 if (!window.internals) | 8 if (!window.internals) |
9 return null; | 9 return null; |
10 return getElementByPseudoId(internals.oldestShadowRoot(input), "-webkit-inne
r-spin-button"); | 10 return getElementByPseudoId(internals.oldestShadowRoot(input), "-webkit-inne
r-spin-button"); |
(...skipping 13 matching lines...) Expand all Loading... |
24 return; | 24 return; |
25 eventSender.mouseMoveTo(x, y); | 25 eventSender.mouseMoveTo(x, y); |
26 } | 26 } |
27 | 27 |
28 function runIFrameLoaded(config) | 28 function runIFrameLoaded(config) |
29 { | 29 { |
30 testInput = iframe.contentDocument.getElementById('test'); | 30 testInput = iframe.contentDocument.getElementById('test'); |
31 testInput.focus(); | 31 testInput.focus(); |
32 var spinButton = getSpinButton(testInput); | 32 var spinButton = getSpinButton(testInput); |
33 if (spinButton) { | 33 if (spinButton) { |
| 34 var rect = spinButton.getBoundingClientRect(); |
34 mouseMoveTo( | 35 mouseMoveTo( |
35 iframe.offsetLeft + spinButton.offsetLeft + spinButton.offsetWidth /
2, | 36 iframe.offsetLeft + rect.left + rect.width / 2, |
36 iframe.offsetTop + spinButton.offsetTop + spinButton.offsetHeight /
4); | 37 iframe.offsetTop + rect.top + rect.height / 4); |
37 } | 38 } |
38 mouseClick(); | 39 mouseClick(); |
39 shouldBeEqualToString('testInput.value', config['expectedValue']); | 40 shouldBeEqualToString('testInput.value', config['expectedValue']); |
40 iframe.parentNode.removeChild(iframe); | 41 iframe.parentNode.removeChild(iframe); |
41 finishJSTest(); | 42 finishJSTest(); |
42 } | 43 } |
43 | 44 |
44 function testClickSpinButtonInIFrame(config) | 45 function testClickSpinButtonInIFrame(config) |
45 { | 46 { |
46 description('Checks mouse click on spin button in iframe.'); | 47 description('Checks mouse click on spin button in iframe.'); |
47 if (!window.eventSender) | 48 if (!window.eventSender) |
48 debug('Please run in DumpRenderTree'); | 49 debug('Please run in DumpRenderTree'); |
49 | 50 |
50 iframe = document.createElement('iframe'); | 51 iframe = document.createElement('iframe'); |
51 iframe.addEventListener('load', function () { runIFrameLoaded(config) }); | 52 iframe.addEventListener('load', function () { runIFrameLoaded(config) }); |
52 iframe.srcdoc = '<input id=test type=' + config['inputType'] + ' value="' +
config['initialValue'] + '">'; | 53 iframe.srcdoc = '<input id=test type=' + config['inputType'] + ' value="' +
config['initialValue'] + '">'; |
53 document.body.appendChild(iframe); | 54 document.body.appendChild(iframe); |
54 } | 55 } |
OLD | NEW |