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 assertTrue = chrome.test.assertTrue; |
| 6 |
| 7 var EventType = chrome.automation.EventType; |
| 8 |
| 9 var allTests = [ |
| 10 function testLocationInWebView() { |
| 11 rootNode.addEventListener(EventType.LOAD_COMPLETE, function() { |
| 12 var outerButton = rootNode.find({ attributes: { name: 'Outer' } }); |
| 13 var innerButton = rootNode.find({ attributes: { name: 'Inner' } }); |
| 14 if (outerButton && innerButton) { |
| 15 var outerRect = outerButton.location; |
| 16 var innerRect = innerButton.location; |
| 17 |
| 18 // The outer button should be at (50, 150). Allow one pixel off |
| 19 // for rounding errors. |
| 20 assertTrue(Math.abs(outerRect.left - 50) <= 1); |
| 21 assertTrue(Math.abs(outerRect.top - 150) <= 1); |
| 22 |
| 23 // The inner button should be exactly 100 x 200 pixels offset from |
| 24 // the outer button. |
| 25 assertTrue(Math.abs(innerRect.left - outerRect.left - 100) <= 1); |
| 26 assertTrue(Math.abs(innerRect.top - outerRect.top - 200) <= 1); |
| 27 chrome.test.succeed(); |
| 28 } |
| 29 }, false); |
| 30 |
| 31 chrome.app.window.create('webview_frame.html', { |
| 32 'innerBounds': { |
| 33 'left': 50, |
| 34 'top': 150, |
| 35 'width': 400, |
| 36 'height': 400 |
| 37 } |
| 38 }); |
| 39 } |
| 40 ]; |
| 41 |
| 42 chrome.automation.getDesktop(function(rootNodeArg) { |
| 43 window.rootNode = rootNodeArg; |
| 44 chrome.test.runTests(allTests); |
| 45 }); |
OLD | NEW |