use of com.android.internal.net.VpnProfile in project android_packages_apps_Settings by LineageOS.
the class PreferenceListTest method testConnectedLegacyVpnShownExactlyOnce.
@SmallTest
public void testConnectedLegacyVpnShownExactlyOnce() {
final VpnProfile vpnProfile = new VpnProfile("test-no-duplicates");
final LegacyVpnInfo connectedLegacyVpn = new LegacyVpnInfo();
connectedLegacyVpn.key = new String(vpnProfile.key);
final VpnSettings.UpdatePreferences updater = new VpnSettings.UpdatePreferences(mSettings);
updater.legacyVpns(/* vpnProfiles */
Collections.<VpnProfile>singletonList(vpnProfile), /* connectedLegacyVpns */
new HashMap<String, LegacyVpnInfo>() {
{
put(connectedLegacyVpn.key, connectedLegacyVpn);
}
}, /* lockdownVpnKey */
null);
updater.run();
final ArgumentMatcher<VpnProfile> equalsFake = new ArgumentMatcher<VpnProfile>() {
@Override
public boolean matchesObject(final Object arg) {
if (arg == vpnProfile)
return true;
if (arg == null)
return false;
return TextUtils.equals(((VpnProfile) arg).key, vpnProfile.key);
}
};
// The VPN profile should have been used to create a preference and set up at laest once
// with update=true to fill in all the fields.
verify(mSettings, atLeast(1)).findOrCreatePreference(argThat(equalsFake), eq(true));
// ...But no other VPN profile key should ever have been passed in.
verify(mSettings, never()).findOrCreatePreference(not(argThat(equalsFake)), anyBoolean());
// And so we should still have exactly 1 preference created.
assertEquals(1, mLegacyMocks.size());
assertEquals(0, mAppMocks.size());
}
use of com.android.internal.net.VpnProfile in project android_packages_apps_Settings by omnirom.
the class VpnTests method testIpsecXauthPskConnection.
/**
* Test IPSec Xauth PSK VPN connection
*/
@LargeTest
public void testIpsecXauthPskConnection() throws Exception {
VpnInfo curVpnInfo = mVpnInfoPool.get(VpnProfile.TYPE_IPSEC_XAUTH_PSK);
VpnProfile vpnProfile = curVpnInfo.getVpnProfile();
if (DEBUG) {
printVpnProfile(vpnProfile);
}
connect(vpnProfile);
validateVpnConnection(vpnProfile, true);
}
use of com.android.internal.net.VpnProfile in project android_packages_apps_Settings by omnirom.
the class VpnTests method testIpsecXauthRsaConnection.
/**
* Test IPSec Xauth RSA VPN connection
*/
@LargeTest
public void testIpsecXauthRsaConnection() throws Exception {
mPreviousIpAddress = getIpAddress();
VpnInfo curVpnInfo = mVpnInfoPool.get(VpnProfile.TYPE_IPSEC_XAUTH_RSA);
VpnProfile vpnProfile = curVpnInfo.getVpnProfile();
if (DEBUG) {
printVpnProfile(vpnProfile);
}
String certFile = curVpnInfo.getCertificateFile();
String password = curVpnInfo.getPassword();
installCertificatesFromFile(vpnProfile, certFile, password);
connect(vpnProfile);
validateVpnConnection(vpnProfile);
}
use of com.android.internal.net.VpnProfile in project android_packages_apps_Settings by omnirom.
the class VpnTests method testIpsecHybridRsaConnection.
/**
* Test IPSec Hybrid RSA VPN connection
*/
@LargeTest
public void testIpsecHybridRsaConnection() throws Exception {
mPreviousIpAddress = getIpAddress();
VpnInfo curVpnInfo = mVpnInfoPool.get(VpnProfile.TYPE_IPSEC_HYBRID_RSA);
VpnProfile vpnProfile = curVpnInfo.getVpnProfile();
if (DEBUG) {
printVpnProfile(vpnProfile);
}
connect(vpnProfile);
validateVpnConnection(vpnProfile);
}
use of com.android.internal.net.VpnProfile in project android_packages_apps_Settings by DirtyUnicorns.
the class VpnTests method testIpsecHybridRsaConnection.
/**
* Test IPSec Hybrid RSA VPN connection
*/
@LargeTest
public void testIpsecHybridRsaConnection() throws Exception {
mPreviousIpAddress = getIpAddress();
VpnInfo curVpnInfo = mVpnInfoPool.get(VpnProfile.TYPE_IPSEC_HYBRID_RSA);
VpnProfile vpnProfile = curVpnInfo.getVpnProfile();
if (DEBUG) {
printVpnProfile(vpnProfile);
}
connect(vpnProfile);
validateVpnConnection(vpnProfile);
}
Aggregations