summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
index 33aab60e1..fb4e71ef5 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
@@ -169,7 +169,8 @@ public class WifiCountryCodeTest {
}
/**
- * Test if we can reset to the default country code when phone is out of service.
+ * Test if we can reset to the default country code when phone is out of service, when
+ * |config_wifi_revert_country_code_on_cellular_loss| is set to true;
* Telephony service calls |setCountryCode| with an empty string when phone is out of service.
* In this case we should fall back to the default country code.
* @throws Exception
@@ -184,4 +185,28 @@ public class WifiCountryCodeTest {
assertEquals(mDefaultCountryCode, mWifiCountryCode.getCountryCode());
}
+ /**
+ * Test if we can keep using the last known country code when phone is out of service, when
+ * |config_wifi_revert_country_code_on_cellular_loss| is set to false;
+ * Telephony service calls |setCountryCode| with an empty string when phone is out of service.
+ * In this case we should keep using the last known country code.
+ * @throws Exception
+ */
+ @Test
+ public void doNotResetCountryCodeWhenOutOfService() throws Exception {
+ // Refresh mWifiCountryCode with |config_wifi_revert_country_code_on_cellular_loss|
+ // setting to false.
+ mWifiCountryCode = new WifiCountryCode(
+ mWifiNative,
+ mDefaultCountryCode,
+ false /* config_wifi_revert_country_code_on_cellular_loss */);
+
+ assertEquals(mDefaultCountryCode, mWifiCountryCode.getCountryCode());
+ mWifiCountryCode.setCountryCode(mTelephonyCountryCode);
+ assertEquals(mTelephonyCountryCode, mWifiCountryCode.getCountryCode());
+ // Out of service.
+ mWifiCountryCode.setCountryCode("");
+ assertEquals(mTelephonyCountryCode, mWifiCountryCode.getCountryCode());
+ }
+
}