Move TestAccessPointBuilder.

This is necessary to make it accessible to other test packages, such as
WifiSettingsUiTest.java in packages/apps/Settings.

Bug: 37558394
Test: runtest --path
packages/apps/Settings/tests/unit/src/com/android/settings/wifi/WifiSettingsUiTest.java

Change-Id: Ic1e4185639b2947433d6371e74448097d6adb962
This commit is contained in:
Sundeep Ghuman
2017-06-19 16:56:41 -07:00
parent aa481d695d
commit ce6b0b2539

View File

@@ -26,9 +26,9 @@ import android.os.Bundle;
/**
* Build and return a valid AccessPoint.
*
* Only intended for testing the AccessPoint class;
* AccessPoints were designed to only be populated
* by the mechanisms of scan results and wifi configurations.
* Only intended for testing the AccessPoint class or creating Access points to be used in testing
* applications. AccessPoints were designed to only be populated by the mechanisms of scan results
* and wifi configurations.
*/
public class TestAccessPointBuilder {
// match the private values in WifiManager
@@ -42,6 +42,7 @@ public class TestAccessPointBuilder {
private NetworkInfo mNetworkInfo = null;
private String mFqdn = null;
private String mProviderFriendlyName = null;
private int mSecurity = AccessPoint.SECURITY_NONE;
private WifiConfiguration mWifiConfig;
private WifiInfo mWifiInfo;
@@ -67,6 +68,8 @@ public class TestAccessPointBuilder {
if (mProviderFriendlyName != null) {
bundle.putString(AccessPoint.KEY_PROVIDER_FRIENDLY_NAME, mProviderFriendlyName);
}
bundle.putInt(AccessPoint.KEY_SECURITY, mSecurity);
AccessPoint ap = new AccessPoint(mContext, bundle);
ap.setRssi(mRssi);
return ap;
@@ -141,6 +144,11 @@ public class TestAccessPointBuilder {
return this;
}
public TestAccessPointBuilder setSecurity(int security) {
mSecurity = security;
return this;
}
public TestAccessPointBuilder setSsid(String newSsid) {
ssid = newSsid;
return this;