OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var allTests = [ |
| 6 function testHitTest() { |
| 7 var buttons = rootNode.findAll({ role: RoleType.BUTTON }); |
| 8 var button1 = buttons[0]; |
| 9 assertEq(button1.name, 'Hit Test 1'); |
| 10 var x = button1.location.left + button1.location.width / 2; |
| 11 var y = button1.location.top + button1.location.height / 2; |
| 12 var button2 = buttons[1]; |
| 13 assertEq(button2.name, 'Hit Test 2'); |
| 14 var webArea = button1.parent; |
| 15 while (webArea.role != RoleType.ROOT_WEB_AREA) |
| 16 webArea = webArea.parent; |
| 17 button1.addEventListener(EventType.HOVER, function() { |
| 18 x = button2.location.left + button2.location.width / 2; |
| 19 y = button2.location.top + button2.location.height / 2; |
| 20 button2.addEventListener(EventType.ALERT, function() { |
| 21 chrome.test.succeed(); |
| 22 }, true); |
| 23 webArea.hitTest(x, y, EventType.ALERT); |
| 24 }, true); |
| 25 webArea.hitTest(x, y, EventType.HOVER); |
| 26 } |
| 27 ]; |
| 28 |
| 29 setUpAndRunTests(allTests, 'hit_test.html'); |
OLD | NEW |