diff options
Diffstat (limited to 'tests')
6 files changed, 24 insertions, 7 deletions
diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java index 1e16fe427..f9f0a5846 100644 --- a/tests/src/com/android/dialer/CallDetailActivityTest.java +++ b/tests/src/com/android/dialer/CallDetailActivityTest.java @@ -48,7 +48,8 @@ import java.util.List; import java.util.Locale; /** - * Unit tests for the {@link CallDetailActivity}. + * Unit tests for the {@link CallDetailActivity}. NOTE: The screen needs to be on for the + * UI-related tests to pass. */ @LargeTest public class CallDetailActivityTest extends ActivityInstrumentationTestCase2<CallDetailActivity> { diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index b7f06d31c..9b3e6bcc4 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -21,6 +21,7 @@ import android.database.MatrixCursor; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.view.View; +import android.widget.LinearLayout; import com.google.common.collect.Lists; @@ -68,7 +69,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor = new MatrixCursor(CallLogQuery._PROJECTION); mCursor.moveToFirst(); // The views into which to store the data. - mView = new CallLogListItemView(getContext()); + mView = new LinearLayout(getContext()); mView.setTag(CallLogListItemViews.createForTest(getContext())); } diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index e0e111bcf..b88989d4d 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -42,6 +42,7 @@ import android.widget.FrameLayout; import com.android.contacts.common.test.FragmentTestActivity; import com.android.dialer.CallDetailActivity; import com.android.dialer.R; +import com.android.dialer.util.TestConstants; import java.util.Date; import java.util.Formatter; @@ -323,7 +324,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme IntentProvider intentProvider = (IntentProvider) views.callBackButtonView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts a call. - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); // To the entry's number. assertEquals(Uri.parse("tel:" + TEST_NUMBER), intent.getData()); } @@ -385,7 +386,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme Intent callIntent = intentProvider.getIntent(mActivity); //The intent should be to make the call - assertEquals(Intent.ACTION_CALL_PRIVILEGED, callIntent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, callIntent.getAction()); } } } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index c0347cf0f..30a84c2f3 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -22,6 +22,7 @@ import android.provider.CallLog.Calls; import android.test.AndroidTestCase; import android.view.View; +import com.android.contacts.common.CallUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; @@ -323,8 +324,13 @@ public class CallLogListItemHelperTest extends AndroidTestCase { null, Calls.FEATURES_VIDEO, null, null); CharSequence description = mHelper.getCallDescription(getContext(), details); + final boolean isVideoEnabled = CallUtil.isVideoEnabled(getContext()); assertTrue(description.toString() - .contains(this.mResources.getString(R.string.description_video_call, 2))); + .contains(this.mResources.getString( + isVideoEnabled + ? R.string.description_video_call + : R.string.description_num_calls, + 2))); } /** Asserts that the primary action view does not have a call intent. */ diff --git a/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java b/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java index 8d4b01f67..6671022ba 100644 --- a/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java +++ b/tests/src/com/android/dialer/interactions/PhoneNumberInteractionTest.java @@ -35,6 +35,7 @@ import com.android.contacts.common.test.mocks.MockContentProvider; import com.android.contacts.common.test.mocks.MockContentProvider.Query; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.interactions.PhoneNumberInteraction.PhoneItem; +import com.android.dialer.util.TestConstants; import java.util.ArrayList; import java.util.List; @@ -179,7 +180,7 @@ public class PhoneNumberInteractionTest extends InstrumentationTestCase { Intent intent = mContext.getIntentForStartActivity(); assertNotNull(intent); - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); assertEquals("tel:123", intent.getDataString()); } @@ -197,7 +198,7 @@ public class PhoneNumberInteractionTest extends InstrumentationTestCase { Intent intent = mContext.getIntentForStartActivity(); assertNotNull(intent); - assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); + assertEquals(TestConstants.CALL_INTENT_ACTION, intent.getAction()); assertEquals("sip:example%40example.com", intent.getDataString()); } diff --git a/tests/src/com/android/dialer/util/TestConstants.java b/tests/src/com/android/dialer/util/TestConstants.java new file mode 100644 index 000000000..780626a27 --- /dev/null +++ b/tests/src/com/android/dialer/util/TestConstants.java @@ -0,0 +1,7 @@ +package com.android.dialer.util; + +import android.content.Intent; + +public class TestConstants { + public static final String CALL_INTENT_ACTION = Intent.ACTION_CALL; +} |