summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-03-16 15:13:32 -0700
committerNingyuan Wang <nywang@google.com>2017-03-18 20:15:32 +0000
commit5353a4413684083df0e8ff2fbd6f5f256731bd28 (patch)
treecae5701bd3a2b4468b214f5d6a9efcb1ed4121ab /tests
parent9b7ac0c52f2a5d6a4e409e902692c437698c52b6 (diff)
Reset to default country code when phone is out of service
Bug: 36229469 Test: compile, unit tests, manual test Change-Id: Ic6689cee5f559158cee16c3bf3072e96496f19c6
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
index fa35e8b5d..33aab60e1 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
@@ -167,4 +167,21 @@ public class WifiCountryCodeTest {
verify(mWifiNative, times(2)).setCountryCode(anyString());
assertEquals(mDefaultCountryCode, mWifiCountryCode.getCountryCodeSentToDriver());
}
+
+ /**
+ * Test if we can reset to the default country code when phone is out of service.
+ * 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
+ */
+ @Test
+ public void resetCountryCodeWhenOutOfService() throws Exception {
+ assertEquals(mDefaultCountryCode, mWifiCountryCode.getCountryCode());
+ mWifiCountryCode.setCountryCode(mTelephonyCountryCode);
+ assertEquals(mTelephonyCountryCode, mWifiCountryCode.getCountryCode());
+ // Out of service.
+ mWifiCountryCode.setCountryCode("");
+ assertEquals(mDefaultCountryCode, mWifiCountryCode.getCountryCode());
+ }
+
}