diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-08 17:55:07 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-06-08 17:57:05 -0700 |
commit | 16350340d9275327a0318a25ae6fb9e393917918 (patch) | |
tree | 8c6fe2fe205f0926c7bd739222fb89e6a41e27a5 /TestCommon/src/com/android/contacts/common | |
parent | 518b4aceba6222238efb36da0089448747daf6ba (diff) | |
download | packages_apps_ContactsCommon-16350340d9275327a0318a25ae6fb9e393917918.tar.gz packages_apps_ContactsCommon-16350340d9275327a0318a25ae6fb9e393917918.tar.bz2 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/src/com/android/contacts/common')
-rw-r--r-- | TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java | 11 |
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); } |