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 --- src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java | 6 ++++++ src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'src/com') diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java index 133da363d..14c5473ae 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java @@ -42,6 +42,7 @@ import com.android.dialer.PhoneCallDetails; import com.android.dialer.R; import com.android.dialer.calllog.CallLogAsyncTaskUtil; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import java.util.concurrent.TimeUnit; @@ -411,4 +412,9 @@ public class VoicemailPlaybackLayout extends LinearLayout } return String.format("%02d:%02d", minutes, seconds); } + + @VisibleForTesting + public String getStateText() { + return mStateText.getText().toString(); + } } diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java index 62da9423e..95622bfa2 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java @@ -781,4 +781,9 @@ public class VoicemailPlaybackPresenter implements MediaPlayer.OnPreparedListene public boolean isSpeakerphoneOn() { return mIsSpeakerphoneOn; } + + @VisibleForTesting + public void clearInstance() { + sInstance = null; + } } -- cgit v1.2.3