Merge "Fix null DadProxy failure in R Tethering unit test"
This commit is contained in:
@@ -125,6 +125,7 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.net.wifi.p2p.WifiP2pGroup;
|
import android.net.wifi.p2p.WifiP2pGroup;
|
||||||
import android.net.wifi.p2p.WifiP2pInfo;
|
import android.net.wifi.p2p.WifiP2pInfo;
|
||||||
import android.net.wifi.p2p.WifiP2pManager;
|
import android.net.wifi.p2p.WifiP2pManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -844,6 +845,14 @@ public class TetheringTest {
|
|||||||
mLooper.dispatchAll();
|
mLooper.dispatchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertSetIfaceToDadProxy(final int numOfCalls, final String ifaceName) {
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R || "S".equals(Build.VERSION.CODENAME)
|
||||||
|
|| "T".equals(Build.VERSION.CODENAME)) {
|
||||||
|
verify(mDadProxy, times(numOfCalls)).setUpstreamIface(
|
||||||
|
argThat(ifaceParams -> ifaceName.equals(ifaceParams.name)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void workingMobileUsbTethering_IPv4() throws Exception {
|
public void workingMobileUsbTethering_IPv4() throws Exception {
|
||||||
UpstreamNetworkState upstreamState = buildMobileIPv4UpstreamState();
|
UpstreamNetworkState upstreamState = buildMobileIPv4UpstreamState();
|
||||||
@@ -853,7 +862,7 @@ public class TetheringTest {
|
|||||||
verify(mNetd, times(1)).ipfwdAddInterfaceForward(TEST_USB_IFNAME, TEST_MOBILE_IFNAME);
|
verify(mNetd, times(1)).ipfwdAddInterfaceForward(TEST_USB_IFNAME, TEST_MOBILE_IFNAME);
|
||||||
|
|
||||||
sendIPv6TetherUpdates(upstreamState);
|
sendIPv6TetherUpdates(upstreamState);
|
||||||
verify(mDadProxy, never()).setUpstreamIface(notNull());
|
assertSetIfaceToDadProxy(0 /* numOfCalls */, "" /* ifaceName */);
|
||||||
verify(mRouterAdvertisementDaemon, never()).buildNewRa(any(), notNull());
|
verify(mRouterAdvertisementDaemon, never()).buildNewRa(any(), notNull());
|
||||||
verify(mDhcpServer, timeout(DHCPSERVER_START_TIMEOUT_MS).times(1)).startWithCallbacks(
|
verify(mDhcpServer, timeout(DHCPSERVER_START_TIMEOUT_MS).times(1)).startWithCallbacks(
|
||||||
any(), any());
|
any(), any());
|
||||||
@@ -881,7 +890,7 @@ public class TetheringTest {
|
|||||||
|
|
||||||
sendIPv6TetherUpdates(upstreamState);
|
sendIPv6TetherUpdates(upstreamState);
|
||||||
// TODO: add interfaceParams to compare in verify.
|
// TODO: add interfaceParams to compare in verify.
|
||||||
verify(mDadProxy, times(1)).setUpstreamIface(notNull());
|
assertSetIfaceToDadProxy(1 /* numOfCalls */, TEST_MOBILE_IFNAME /* ifaceName */);
|
||||||
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
||||||
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
||||||
}
|
}
|
||||||
@@ -898,7 +907,7 @@ public class TetheringTest {
|
|||||||
any(), any());
|
any(), any());
|
||||||
|
|
||||||
sendIPv6TetherUpdates(upstreamState);
|
sendIPv6TetherUpdates(upstreamState);
|
||||||
verify(mDadProxy, times(1)).setUpstreamIface(notNull());
|
assertSetIfaceToDadProxy(1 /* numOfCalls */, TEST_MOBILE_IFNAME /* ifaceName */);
|
||||||
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
||||||
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
||||||
}
|
}
|
||||||
@@ -916,7 +925,7 @@ public class TetheringTest {
|
|||||||
verify(mNetd, times(1)).ipfwdAddInterfaceForward(TEST_USB_IFNAME, TEST_MOBILE_IFNAME);
|
verify(mNetd, times(1)).ipfwdAddInterfaceForward(TEST_USB_IFNAME, TEST_MOBILE_IFNAME);
|
||||||
|
|
||||||
sendIPv6TetherUpdates(upstreamState);
|
sendIPv6TetherUpdates(upstreamState);
|
||||||
verify(mDadProxy, times(1)).setUpstreamIface(notNull());
|
assertSetIfaceToDadProxy(1 /* numOfCalls */, TEST_MOBILE_IFNAME /* ifaceName */);
|
||||||
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
verify(mRouterAdvertisementDaemon, times(1)).buildNewRa(any(), notNull());
|
||||||
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
verify(mNetd, times(1)).tetherApplyDnsInterfaces();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user