diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-02-07 12:07:23 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-07 12:07:23 -0800 |
commit | d36ad9b1ff99675dd0eca6a3fda1f52353f451a4 (patch) | |
tree | d68f9eabc083d382fbda52fa9c1c0bca890c46c4 /core/tests | |
parent | e7171effdf9ef0700782520187c0a292b0a74759 (diff) | |
parent | b765db590ff824fb5827fb773b14ac4286ae2774 (diff) | |
download | frameworks_base-d36ad9b1ff99675dd0eca6a3fda1f52353f451a4.zip frameworks_base-d36ad9b1ff99675dd0eca6a3fda1f52353f451a4.tar.gz frameworks_base-d36ad9b1ff99675dd0eca6a3fda1f52353f451a4.tar.bz2 |
Merge "Adding a method for retching the root node in UiTestAutomationBridge"
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java b/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java index fa48093..2fb4237 100644 --- a/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java +++ b/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java @@ -430,4 +430,35 @@ public class InterrogationActivityTest } } } + + @LargeTest + public void testGetRootAccessibilityNodeInfoInActiveWindow() throws Exception { + final long startTimeMillis = SystemClock.uptimeMillis(); + try { + // get the root via the designated API + AccessibilityNodeInfo fetched = mUiTestAutomationBridge + .getRootAccessibilityNodeInfoInActiveWindow(); + assertNotNull(fetched); + + // get the root via traversal + AccessibilityNodeInfo expected = mUiTestAutomationBridge + .findAccessibilityNodeInfoByViewIdInActiveWindow(R.id.root); + while (true) { + AccessibilityNodeInfo parent = expected.getParent(); + if (parent == null) { + break; + } + expected = parent; + } + assertNotNull(expected); + + assertEquals("The node with id \"root\" should be the root.", expected, fetched); + } finally { + if (DEBUG) { + final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis; + Log.i(LOG_TAG, "testGetRootAccessibilityNodeInfoInActiveWindow: " + + elapsedTimeMillis + "ms"); + } + } + } } |