diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-04 20:49:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-04 20:49:31 +0000 |
commit | 16249d19754ae21bc31b1187dc42e51d86bdbff6 (patch) | |
tree | b30920b00254c3d2e840e6646166897e686f87ff /tests/src/com | |
parent | 11412dc1a83fdc4133385c173e44175dc15e5b86 (diff) | |
parent | 267e9ebd056ec4973c4b37c38f949e863de4f24c (diff) |
Merge "Move VM playback from details to call log." into mnc-dev
Diffstat (limited to 'tests/src/com')
3 files changed, 18 insertions, 25 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 5f09cb74b..14e0aaf9e 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -204,7 +204,7 @@ public class CallLogAdapterTest extends AndroidTestCase { private static final class TestCallLogAdapter extends CallLogAdapter { public TestCallLogAdapter(Context context, CallFetcher callFetcher, ContactInfoHelper contactInfoHelper) { - super(context, callFetcher, contactInfoHelper, false, null); + super(context, callFetcher, contactInfoHelper, null, false, null); mContactInfoCache = new TestContactInfoCache( contactInfoHelper, mOnContactInfoChangedListener); } diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index 0c19799cc..71554d6e1 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -335,28 +335,15 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme } @MediumTest - public void testBindView_PlayButton() { + public void testBindView_VoicemailUri() { mCursor.moveToFirst(); insertVoicemail(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0); CallLogListItemViewHolder viewHolder = (CallLogListItemViewHolder) mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); bindViewForTest(viewHolder); - IntentProvider intentProvider = (IntentProvider) viewHolder.voicemailButtonView.getTag(); - Intent intent = intentProvider.getIntent(mActivity); - // Starts the call detail activity. - assertEquals(new ComponentName(mActivity, CallDetailActivity.class), - intent.getComponent()); - // With the given entry. - assertEquals(ContentUris.withAppendedId(Calls.CONTENT_URI_WITH_VOICEMAIL, 1), - intent.getData()); - // With the URI of the voicemail. - assertEquals( - ContentUris.withAppendedId(VoicemailContract.Voicemails.CONTENT_URI, 1), - intent.getParcelableExtra(CallDetailActivity.EXTRA_VOICEMAIL_URI)); - // And starts playback. - assertTrue( - intent.getBooleanExtra(CallDetailActivity.EXTRA_VOICEMAIL_START_PLAYBACK, false)); + assertEquals(Uri.parse(viewHolder.voicemailUri), + ContentUris.withAppendedId(VoicemailContract.Voicemails.CONTENT_URI, 1)); } /** Returns the label associated with a given phone type. */ @@ -453,11 +440,17 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme * unit tests can access the buttons contained within. * * @param view The current call log row. - * @param position The position of hte item. + * @param position The position of the item. */ - private void bindViewForTest(CallLogListItemViewHolder viewHolder, int position) { + private void bindViewForTest(final CallLogListItemViewHolder viewHolder, int position) { mAdapter.onBindViewHolder(viewHolder, position); - viewHolder.inflateActionViewStub(null); + getInstrumentation().runOnMainSync(new Runnable() { + @Override + public void run() { + viewHolder.inflateActionViewStub(null); + } + }); + getInstrumentation().waitForIdleSync(); viewHolder.updateCallButton(); } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 085ec9bb6..a7d9b9967 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -99,23 +99,23 @@ public class CallLogListItemHelperTest extends AndroidTestCase { public void testSetPhoneCallDetails_VoicemailNumber() { setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_VOICEMAIL_NUMBER); - assertEquals(View.VISIBLE, mViewHolder.voicemailButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } public void testSetPhoneCallDetails_ReadVoicemail() { setPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViewHolder.voicemailButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } public void testSetPhoneCallDetails_UnreadVoicemail() { setUnreadPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViewHolder.voicemailButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } public void testSetPhoneCallDetails_VoicemailFromUnknown() { setPhoneCallDetailsWithNumberAndType("", Calls.PRESENTATION_UNKNOWN, "", Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViewHolder.voicemailButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } /** @@ -470,7 +470,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { /** Sets the details of a phone call using the specified call type. */ private void setPhoneCallDetailsWithTypes(int... types) { - mHelper.setPhoneCallDetails(getContext() ,mViewHolder, + mHelper.setPhoneCallDetails(getContext(), mViewHolder, new PhoneCallDetails( mContext, TEST_NUMBER, |