cmsdk: Provide quick manual functional telephony api tests.

Change-Id: Idda7db6a4961d45f038176e478418123d8758073
This commit is contained in:
Adnan Begovic 2015-08-06 20:22:10 -07:00
parent 7f50335f2b
commit 4c28bc5463
2 changed files with 110 additions and 0 deletions

View File

@ -12,6 +12,8 @@
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="cyanogenmod.alarmclock.permission.MANAGE_ALARMS" />
<uses-permission android:name="cyanogenmod.alarmclock.permission.READ_ALARMS" />
<uses-permission android:name="cyanogenmod.permission.MODIFY_MSIM_PHONE_STATE" />
<uses-permission android:name="cyanogenmod.permission.READ_MSIM_PHONE_STATE" />
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<uses-library android:name="android.test.runner" />
@ -36,6 +38,13 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".telephony.CMTelephonyTest"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".profiles.ProfileTest"
android:label="@string/app_name">
<intent-filter>

View File

@ -0,0 +1,101 @@
package org.cyanogenmod.tests.telephony;
import android.telephony.SubscriptionManager;
import android.widget.Toast;
import org.cyanogenmod.tests.TestActivity;
import cyanogenmod.app.CMTelephonyManager;
/**
* Created by adnan on 8/6/15.
*/
public class CMTelephonyTest extends TestActivity {
@Override
protected String tag() {
return null;
}
@Override
protected Test[] tests() {
return mTests;
}
private Test[] mTests = new Test[] {
new Test("test retreive list of subscription information") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test retrieve info "
+ cmTelephonyManager.getSubInformation().toString(),
Toast.LENGTH_SHORT).show();
}
},
new Test("test is default subscription active") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test default sub active "
+ cmTelephonyManager.isSubActive(
SubscriptionManager.getDefaultSubId()),
Toast.LENGTH_SHORT).show();
}
},
new Test("test setSubState on default subscription") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setSubState(SubscriptionManager.getDefaultSubId(), true);
}
},
new Test("test is data enabled on default sub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test default sub data "
+ cmTelephonyManager.isDataConnectionSelectedOnSub(
SubscriptionManager.getDefaultSubId()),
Toast.LENGTH_SHORT).show();
}
},
new Test("test is data enabled") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test data enabled "
+ cmTelephonyManager.isDataConnectionEnabled(),
Toast.LENGTH_SHORT).show();
}
},
new Test("test setDataConnectionState") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDataConnectionState(true);
}
},
new Test("test setDataConnectionSelectedOnSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDataConnectionSelectedOnSub(
SubscriptionManager.getDefaultSubId());
}
},
new Test("test setDefaultPhoneSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDefaultPhoneSub(
SubscriptionManager.getDefaultSubId());
}
},
new Test("test setDefaultSmsSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDefaultSmsSub(
SubscriptionManager.getDefaultSubId());
}
},
};
}