From c19f4b7ec72dfe75c99c53cdac19c9932c8e5519 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 15 Sep 2015 16:50:36 -0700 Subject: Fix VoicemailPlaybackTests. There appears to be two issues which were borking this, although I'm not sure why there was the change (maybe it's been around a long time). A single instance of presenter is retained over time, which is no good for our case where we're creating different FakeAsyncTaskExecutors each time, so added a method for testing where we can clear the instance. Secondly, the method checking the text views didn't work anymore. Not sure why, but I added a hook into the state text so the tests can continue to check for that. Bug: 23640774 Change-Id: Ie729627f3bb4ee08476d5ad0198e43cfea72ce5c --- .../dialer/voicemail/VoicemailPlaybackTest.java | 76 ++++++++++++++-------- 1 file changed, 50 insertions(+), 26 deletions(-) (limited to 'tests/src') diff --git a/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java b/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java index 6c7cf77c2..420a17cfd 100644 --- a/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java +++ b/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java @@ -17,6 +17,7 @@ package com.android.dialer.voicemail; import static com.android.dialer.voicemail.VoicemailPlaybackPresenter.Tasks.CHECK_FOR_CONTENT; +import static com.android.dialer.voicemail.VoicemailPlaybackPresenter.Tasks.CHECK_CONTENT_AFTER_CHANGE; import android.app.Activity; import android.content.ContentResolver; @@ -31,7 +32,6 @@ import android.test.suitebuilder.annotation.LargeTest; import android.view.View; import android.widget.TextView; -import com.android.contacts.common.test.IntegrationTestUtils; import com.android.dialer.R; import com.android.dialer.calllog.CallLogActivity; import com.android.dialer.util.AsyncTaskExecutors; @@ -61,7 +61,6 @@ public class VoicemailPlaybackTest extends ActivityInstrumentationTestCase2 views = mTestUtils.getTextViewsWithString(mLayout, text); - assertEquals("There should have been one TextView with text '" + text + "' but found " - + views, 1, views.size()); + assertTrue(mLayout.getStateText().contains(text)); } - private void assertHasZeroTextViewsContaining(String text) throws Throwable { + private void assertStateTextNotContains(String text) throws Throwable { assertNotNull(mLayout); - List views = mTestUtils.getTextViewsWithString(mLayout, text); - assertEquals("There should have been no TextViews with text '" + text + "' but found " - + views, 0, views.size()); + assertFalse(mLayout.getStateText().contains(text)); } private ContentResolver getContentResolver() { -- cgit v1.2.3