OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser.test.util; | 5 package org.chromium.content.browser.test.util; |
6 | 6 |
7 import android.graphics.Rect; | 7 import android.graphics.Rect; |
8 import android.test.ActivityInstrumentationTestCase2; | 8 import android.test.ActivityInstrumentationTestCase2; |
9 import android.util.JsonReader; | 9 import android.util.JsonReader; |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 /** | 246 /** |
247 * Returns click targets for a given DOM node. | 247 * Returns click targets for a given DOM node. |
248 */ | 248 */ |
249 private static int[] getClickTargetForNode(ContentViewCore viewCore, String
nodeName) | 249 private static int[] getClickTargetForNode(ContentViewCore viewCore, String
nodeName) |
250 throws InterruptedException, TimeoutException { | 250 throws InterruptedException, TimeoutException { |
251 Rect bounds = getNodeBounds(viewCore, nodeName); | 251 Rect bounds = getNodeBounds(viewCore, nodeName); |
252 Assert.assertNotNull("Failed to get DOM element bounds of '" + nodeName
+ "'.", bounds); | 252 Assert.assertNotNull("Failed to get DOM element bounds of '" + nodeName
+ "'.", bounds); |
253 | 253 |
254 int clickX = (int) viewCore.getRenderCoordinates().fromLocalCssToPix(bou
nds.exactCenterX()) | 254 int clickX = (int) viewCore.getRenderCoordinates().fromLocalCssToPix(bou
nds.exactCenterX()); |
255 + viewCore.getViewportSizeOffsetWidthPix(); | |
256 int clickY = (int) viewCore.getRenderCoordinates().fromLocalCssToPix(bou
nds.exactCenterY()) | 255 int clickY = (int) viewCore.getRenderCoordinates().fromLocalCssToPix(bou
nds.exactCenterY()) |
257 + viewCore.getViewportSizeOffsetHeightPix(); | 256 + viewCore.getTopControlsLayoutHeightPix(); |
258 return new int[] { clickX, clickY }; | 257 return new int[] { clickX, clickY }; |
259 } | 258 } |
260 } | 259 } |
OLD | NEW |