summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-04-15 21:48:11 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-04-15 21:48:11 +0000
commit021255a7c135ae7ee1680e9c72301dfc55151fd7 (patch)
tree7c12404d8a26186564182ace60fc69b89b49057e /tests
parent0418b114b37e5d64899c09d25e79d1affd305573 (diff)
parentb487bcbf34468767097220ad63dcd387766fe2ac (diff)
WifiApConfigStore: create temp sharing AP config am: 1e5c1abdeb am: 7fa3919c94
am: b487bcbf34 Change-Id: I08cc4612344d7539ad47ac755cec5b8bec512858
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
index 42161fa54..d4a3ff549 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
@@ -49,6 +49,7 @@ public class WifiApConfigStoreTest {
private static final String TEST_DEFAULT_2G_CHANNEL_LIST = "1,2,3,4,5,6";
private static final String TEST_DEFAULT_AP_SSID = "TestAP";
private static final String TEST_CONFIGURED_AP_SSID = "ConfiguredAP";
+ private static final String TEST_DEFAULT_HOTSPOT_SSID = "TestShare";
private static final int RAND_SSID_INT_MIN = 1000;
private static final int RAND_SSID_INT_MAX = 9999;
@@ -69,6 +70,8 @@ public class WifiApConfigStoreTest {
TEST_DEFAULT_2G_CHANNEL_LIST);
resources.setString(R.string.wifi_tether_configure_ssid_default,
TEST_DEFAULT_AP_SSID);
+ resources.setString(R.string.wifi_localhotspot_configure_ssid_default,
+ TEST_DEFAULT_HOTSPOT_SSID);
when(mContext.getResources()).thenReturn(resources);
}
@@ -107,10 +110,10 @@ public class WifiApConfigStoreTest {
assertEquals(config1.apChannel, config2.apChannel);
}
- private void verifyDefaultApConfig(WifiConfiguration config) {
+ private void verifyDefaultApConfig(WifiConfiguration config, String expectedSsid) {
String[] splitSsid = config.SSID.split("_");
assertEquals(2, splitSsid.length);
- assertEquals(TEST_DEFAULT_AP_SSID, splitSsid[0]);
+ assertEquals(expectedSsid, splitSsid[0]);
int randomPortion = Integer.parseInt(splitSsid[1]);
assertTrue(randomPortion >= RAND_SSID_INT_MIN && randomPortion <= RAND_SSID_INT_MAX);
assertTrue(config.allowedKeyManagement.get(KeyMgmt.WPA2_PSK));
@@ -124,7 +127,7 @@ public class WifiApConfigStoreTest {
public void initWithDefaultConfiguration() throws Exception {
WifiApConfigStore store = new WifiApConfigStore(
mContext, mBackupManagerProxy, mApConfigFile.getPath());
- verifyDefaultApConfig(store.getApConfiguration());
+ verifyDefaultApConfig(store.getApConfiguration(), TEST_DEFAULT_AP_SSID);
}
/**
@@ -165,7 +168,7 @@ public class WifiApConfigStoreTest {
verifyApConfig(expectedConfig, store.getApConfiguration());
store.setApConfiguration(null);
- verifyDefaultApConfig(store.getApConfiguration());
+ verifyDefaultApConfig(store.getApConfiguration(), TEST_DEFAULT_AP_SSID);
verify(mBackupManagerProxy).notifyDataChanged();
}
@@ -177,7 +180,7 @@ public class WifiApConfigStoreTest {
/* Initialize WifiApConfigStore with default configuration. */
WifiApConfigStore store = new WifiApConfigStore(
mContext, mBackupManagerProxy, mApConfigFile.getPath());
- verifyDefaultApConfig(store.getApConfiguration());
+ verifyDefaultApConfig(store.getApConfiguration(), TEST_DEFAULT_AP_SSID);
/* Update with a valid configuration. */
WifiConfiguration expectedConfig = setupApConfig(
@@ -190,4 +193,14 @@ public class WifiApConfigStoreTest {
verifyApConfig(expectedConfig, store.getApConfiguration());
verify(mBackupManagerProxy).notifyDataChanged();
}
+
+ /**
+ * Verify a proper local only hotspot config is generated when called properly with the valid
+ * context.
+ */
+ @Test
+ public void generateLocalOnlyHotspotConfigIsValid() {
+ WifiConfiguration config = WifiApConfigStore.generateLocalOnlyHotspotConfig(mContext);
+ verifyDefaultApConfig(config, TEST_DEFAULT_HOTSPOT_SSID);
+ }
}