summaryrefslogtreecommitdiffstats
path: root/TestCommon
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-08 17:55:07 -0700
committerAndrew Lee <anwlee@google.com>2015-06-08 17:57:05 -0700
commit16350340d9275327a0318a25ae6fb9e393917918 (patch)
tree8c6fe2fe205f0926c7bd739222fb89e6a41e27a5 /TestCommon
parent518b4aceba6222238efb36da0089448747daf6ba (diff)
downloadandroid_packages_apps_ContactsCommon-16350340d9275327a0318a25ae6fb9e393917918.tar.gz
android_packages_apps_ContactsCommon-16350340d9275327a0318a25ae6fb9e393917918.tar.bz2
android_packages_apps_ContactsCommon-16350340d9275327a0318a25ae6fb9e393917918.zip
Overload getTextViewWithStrings to take a View.
This allows us to use this functionality for testing where there may be a View but not an Activity. Bug: 21471763 Change-Id: I9918ea77a72b52c5b8ff4eadb2b19d9fe91e12b8
Diffstat (limited to 'TestCommon')
-rw-r--r--TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java b/TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java
index 060edd15..5457128d 100644
--- a/TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java
+++ b/TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java
@@ -140,11 +140,20 @@ public class IntegrationTestUtils {
*/
public List<TextView> getTextViewsWithString(final Activity activity, final String text)
throws Throwable {
+ return getTextViewsWithString(getRootView(activity), text);
+ }
+
+ /**
+ * Gets all {@link TextView} objects whose {@link TextView#getText()} contains the given text as
+ * a substring for the given root view.
+ */
+ public List<TextView> getTextViewsWithString(final View rootView, final String text)
+ throws Throwable {
return runOnUiThreadAndGetTheResult(new Callable<List<TextView>>() {
@Override
public List<TextView> call() throws Exception {
List<TextView> matchingViews = new ArrayList<TextView>();
- for (TextView textView : getAllViews(TextView.class, getRootView(activity))) {
+ for (TextView textView : getAllViews(TextView.class, rootView)) {
if (textView.getText().toString().contains(text)) {
matchingViews.add(textView);
}