am e0550b02: Merge "fixing non-telephony device test failures" into froyo
* commit 'e0550b02f42dfa086e9515ee0ab9909aefd68473':
fixing non-telephony device test failures
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index 6c13007..9aa9b0c 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -23,6 +23,7 @@
import android.content.ContentResolver;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Looper;
@@ -444,14 +445,26 @@
private static final String ISO_COUNTRY_CODE_PATTERN = "[a-z]{2}";
public void testGetNetworkCountryIso() {
+ PackageManager packageManager = getContext().getPackageManager();
String countryCode = mTelephonyManager.getNetworkCountryIso();
- assertTrue("Country code '" + countryCode + "' did not match " + ISO_COUNTRY_CODE_PATTERN,
- Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
+ if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ assertTrue("Country code '" + countryCode + "' did not match "
+ + ISO_COUNTRY_CODE_PATTERN,
+ Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
+ } else {
+ assertEquals("", countryCode);
+ }
}
public void testGetSimCountryIso() {
+ PackageManager packageManager = getContext().getPackageManager();
String countryCode = mTelephonyManager.getSimCountryIso();
- assertTrue("Country code '" + countryCode + "' did not match " + ISO_COUNTRY_CODE_PATTERN,
- Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
+ if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ assertTrue("Country code '" + countryCode + "' did not match "
+ + ISO_COUNTRY_CODE_PATTERN,
+ Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
+ } else {
+ assertEquals("", countryCode);
+ }
}
}