summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-09-14 18:15:32 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2011-09-14 19:40:33 -0700
commitea515aeafa01de6f50c854ee381b972ef2478284 (patch)
tree562c20eaf3945857bdc38eeac726d15005b95fb5 /core/tests
parentb07f6e09eac568b1a0f2dd460034971e6e6323ff (diff)
downloadframeworks_base-ea515aeafa01de6f50c854ee381b972ef2478284.zip
frameworks_base-ea515aeafa01de6f50c854ee381b972ef2478284.tar.gz
frameworks_base-ea515aeafa01de6f50c854ee381b972ef2478284.tar.bz2
Update the public APIs for finding views by text to optionally use content description.
1. Added flags to the search method to specify whether to match text or content description or both. 2. Added test case for the seach by content description. 3. Updated the code in AccessibilityManager service to reflect the latest changes there so test automation service works - this is the fake service used for UI automation. Change-Id: I14a6779a920ff0430e78947ea5aaf876c2e66076
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/coretests/res/layout/interrogation_activity.xml1
-rw-r--r--core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java23
2 files changed, 24 insertions, 0 deletions
diff --git a/core/tests/coretests/res/layout/interrogation_activity.xml b/core/tests/coretests/res/layout/interrogation_activity.xml
index 44ed75c..64af321 100644
--- a/core/tests/coretests/res/layout/interrogation_activity.xml
+++ b/core/tests/coretests/res/layout/interrogation_activity.xml
@@ -70,6 +70,7 @@
android:layout_width="160px"
android:layout_height="100px"
android:text="@string/button6"
+ android:contentDescription="contentDescription"
/>
</LinearLayout>
diff --git a/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java b/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java
index a542a1b..cd8dcb9 100644
--- a/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java
+++ b/core/tests/coretests/src/android/accessibilityservice/InterrogationActivityTest.java
@@ -148,6 +148,29 @@ public class InterrogationActivityTest
}
@LargeTest
+ public void testFindAccessibilityNodeInfoByViewTextContentDescription() throws Exception {
+ beforeClassIfNeeded();
+ final long startTimeMillis = SystemClock.uptimeMillis();
+ try {
+ // bring up the activity
+ getActivity();
+
+ // find a view by text
+ List<AccessibilityNodeInfo> buttons = AccessibilityInteractionClient.getInstance()
+ .findAccessibilityNodeInfosByViewTextInActiveWindow(getConnection(),
+ "contentDescription");
+ assertEquals(1, buttons.size());
+ } finally {
+ afterClassIfNeeded();
+ if (DEBUG) {
+ final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
+ Log.i(LOG_TAG, "testFindAccessibilityNodeInfoByViewTextContentDescription: "
+ + elapsedTimeMillis + "ms");
+ }
+ }
+ }
+
+ @LargeTest
public void testTraverseAllViews() throws Exception {
beforeClassIfNeeded();
final long startTimeMillis = SystemClock.uptimeMillis();