summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-07-10 21:07:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-10 00:38:28 +0000
commit0ccacf209b08eb0058c86512db5a43c313a4bab8 (patch)
treec2db1ae968eac595a8deee83f5329595a4a074d4 /tests
parent659d2f22f093b9549a3d5f7722f6151932c9e93f (diff)
parent8b0e858d5b4c50813dbe2b5c244e7013814b23ec (diff)
Merge "Adding support for video call icon and data usage in call log."
Diffstat (limited to 'tests')
-rw-r--r--tests/res/layout/fill_call_log_test.xml53
-rw-r--r--tests/res/values/donottranslate_strings.xml1
-rw-r--r--tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java16
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java45
-rw-r--r--tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java13
-rw-r--r--tests/src/com/android/dialer/util/DialerUtilsTest.java78
6 files changed, 163 insertions, 43 deletions
diff --git a/tests/res/layout/fill_call_log_test.xml b/tests/res/layout/fill_call_log_test.xml
index 7651b0827..2359f2cde 100644
--- a/tests/res/layout/fill_call_log_test.xml
+++ b/tests/res/layout/fill_call_log_test.xml
@@ -58,26 +58,43 @@
android:layout_height="wrap_content"
android:text="@string/add_custom_entry"
/>
- <RadioGroup
+ <LinearLayout
+ android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
- <RadioButton
- android:id="@+id/call_type_incoming"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/call_type_incoming" />
- <RadioButton
- android:id="@+id/call_type_missed"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/call_type_missed" />
- <RadioButton
- android:id="@+id/call_type_outgoing"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/call_type_outgoing" />
- </RadioGroup>
+ android:gravity="left"
+ >
+ <RadioGroup
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <RadioButton
+ android:id="@+id/call_type_incoming"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/call_type_incoming"
+ android:textSize="9sp" />
+ <RadioButton
+ android:id="@+id/call_type_missed"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/call_type_missed"
+ android:textSize="9sp" />
+ <RadioButton
+ android:id="@+id/call_type_outgoing"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/call_type_outgoing"
+ android:textSize="9sp" />
+ </RadioGroup>
+ <CheckBox
+ android:id="@+id/call_type_video"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/call_type_video"
+ android:textSize="9sp"
+ />
+ </LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 553b3c0a6..d4b48a6cd 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -41,6 +41,7 @@
<string name="call_type_incoming">Incoming</string>
<string name="call_type_missed">Missed</string>
<string name="call_type_outgoing">Outgoing</string>
+ <string name="call_type_video">Video</string>
<string name="call_date">Call date</string>
<string name="call_time">Call time</string>
<string name="edit">Edit</string>
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index ae4759668..147201bcb 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -290,7 +290,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, presentation, formattedNumber,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null)
+ new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null)
);
}
@@ -300,7 +301,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, Calls.PRESENTATION_ALLOWED,
formattedNumber, TEST_COUNTRY_ISO, geocodedLocation,
- new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null)
+ new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null)
);
}
@@ -309,7 +311,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION, null)
+ new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null)
);
}
@@ -318,7 +321,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- callTypes, TEST_DATE, TEST_DURATION, null)
+ callTypes, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE, null)
);
}
@@ -326,7 +329,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
mHelper.setCallDetailsHeader(mNameView,
new PhoneCallDetails(number, presentation,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null));
+ new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null));
}
private void setCallDetailsHeader(String name) {
@@ -334,6 +338,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION,
- name, 0, "", null, null, 0, null));
+ name, 0, "", null, null, 0, null, Calls.FEATURES_NONE, null));
}
}
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index ae76157f3..8fbda1596 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -128,7 +128,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescriptionID_UnknownAnswered() {
PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "",
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null);
assertEquals(R.string.description_incoming_answered_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -140,7 +141,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescriptionID_UnknownMissed() {
PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "",
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null);
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -152,7 +154,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescriptionID_UnknownVoicemail() {
PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "",
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null);
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -165,7 +168,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null);
assertEquals(R.string.description_incoming_answered_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -178,7 +182,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null);
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -191,7 +196,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null);
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -205,7 +211,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null);
assertEquals(R.string.description_outgoing_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -219,7 +226,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null);
assertEquals(R.string.description_outgoing_call,
mHelper.getCallDescriptionStringID(details));
}
@@ -233,7 +241,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION,
- null);
+ null, Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -248,7 +256,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION,
- null);
+ null, Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -262,7 +270,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.MISSED_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.MISSED_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -277,7 +286,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION,
- null);
+ null, Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -291,7 +300,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null);
+ new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION, null,
+ Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
// Rather than hard coding the "X calls" string message, we'll generate it with an empty
@@ -311,7 +321,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
TEST_FORMATTED_NUMBER,
TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION,
- null);
+ null, Calls.FEATURES_NONE, null);
CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_num_calls, 2)));
@@ -337,7 +347,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, presentation, formattedNumber,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ callType }, TEST_DATE, TEST_DURATION, null)
+ new int[]{ callType }, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE,
+ null)
);
}
@@ -346,7 +357,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- types, TEST_DATE, TEST_DURATION, null)
+ types, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE, null)
);
}
@@ -355,7 +366,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- types, TEST_DATE, TEST_DURATION, null)
+ types, TEST_DATE, TEST_DURATION, null, Calls.FEATURES_NONE, null)
);
}
}
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index e495ca742..ea3485338 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -72,6 +72,7 @@ public class FillCallLogTestActivity extends Activity {
private RadioButton mCallTypeIncoming;
private RadioButton mCallTypeMissed;
private RadioButton mCallTypeOutgoing;
+ private CheckBox mCallTypeVideo;
private RadioButton mPresentationAllowed;
private RadioButton mPresentationRestricted;
private RadioButton mPresentationUnknown;
@@ -124,6 +125,7 @@ public class FillCallLogTestActivity extends Activity {
mCallTypeIncoming = (RadioButton) findViewById(R.id.call_type_incoming);
mCallTypeMissed = (RadioButton) findViewById(R.id.call_type_missed);
mCallTypeOutgoing = (RadioButton) findViewById(R.id.call_type_outgoing);
+ mCallTypeVideo = (CheckBox) findViewById(R.id.call_type_video);
mPresentationAllowed = (RadioButton) findViewById(R.id.presentation_allowed);
mPresentationPayphone = (RadioButton) findViewById(R.id.presentation_payphone);
mPresentationUnknown = (RadioButton) findViewById(R.id.presentation_unknown);
@@ -488,9 +490,16 @@ public class FillCallLogTestActivity extends Activity {
Calendar dateTime = Calendar.getInstance();
dateTime.set(mCallDateYear, mCallDateMonth, mCallDateDay, mCallTimeHour, mCallTimeMinute);
+ int features = mCallTypeVideo.isChecked() ? Calls.FEATURES_VIDEO : Calls.FEATURES_NONE;
+ Long dataUsage = null;
+ if (mCallTypeVideo.isChecked()) {
+ // Some random data usage up to 50MB.
+ dataUsage = (long) RNG.nextInt(52428800);
+ }
+
Calls.addCall(null, this, mPhoneNumber.getText().toString(), getManualPresentation(),
- getManualCallType(), getManualAccount(), dateTime.getTimeInMillis(),
- RNG.nextInt(60 * 60));
+ getManualCallType(), features, getManualAccount(),
+ dateTime.getTimeInMillis(), RNG.nextInt(60 * 60), dataUsage);
// Subtract offset from the call date/time and store as new date/time
int offset = Integer.parseInt(mOffset.getText().toString());
diff --git a/tests/src/com/android/dialer/util/DialerUtilsTest.java b/tests/src/com/android/dialer/util/DialerUtilsTest.java
new file mode 100644
index 000000000..fdd02c10c
--- /dev/null
+++ b/tests/src/com/android/dialer/util/DialerUtilsTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.dialer.util;
+
+import com.android.dialer.PhoneCallDetailsHelper;
+import com.google.common.collect.Lists;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import java.util.ArrayList;
+
+/**
+ * Performs tests of the DialerUtils class.
+ */
+@SmallTest
+public class DialerUtilsTest extends AndroidTestCase {
+
+ private Resources mResources;
+
+ /**
+ * List of items to be concatenated together for CharSequence join tests.
+ */
+ private ArrayList<CharSequence> mItems = Lists.newArrayList();
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ Context context = getContext();
+ mResources = context.getResources();
+ }
+
+ /**
+ * Tests joining an empty list of {@link CharSequence}.
+ */
+ public void testJoinEmpty() {
+ mItems.clear();
+ CharSequence joined = DialerUtils.join(mResources, mItems);
+ assertEquals("", joined);
+ }
+
+ /**
+ * Tests joining a list of {@link CharSequence} with a single entry.
+ */
+ public void testJoinOne() {
+ mItems.clear();
+ mItems.add("Hello");
+ CharSequence joined = DialerUtils.join(mResources, mItems);
+ assertEquals("Hello", joined);
+ }
+
+ /**
+ * Tests joining a list of {@link CharSequence} with a multiple entries.
+ */
+ public void testJoinTwo() {
+ mItems.clear();
+ mItems.add("Hello");
+ mItems.add("there");
+ CharSequence joined = DialerUtils.join(mResources, mItems);
+ assertEquals("Hello, there", joined);
+ }
+}