diff options
| author | 2020-02-19 18:23:49 +0900 | |
|---|---|---|
| committer | 2020-02-19 19:43:23 +0900 | |
| commit | c77639ef5462fac7e7690fd39c86d4d8df57937a (patch) | |
| tree | cde0200f38c1eca178709a095c6bdc7e065c8128 | |
| parent | 195fc891555b9cd5a13e9abf539da258ded92149 (diff) | |
Minimal support for IPv6 upstreams in IpServer tests.
This makes the IpServer tests a bit more realistic. It is needed
by an upcoming change that adds new functionality, and is in its
own commit because it modifies the behaviour of all the existing
tests.
Test: atest TetheringTests
Change-Id: I8c3267bea983d1453c010b7b6b85548b9481a153
| -rw-r--r-- | packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java index acedfab3b7ab..65041955975f 100644 --- a/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java +++ b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java @@ -158,7 +158,9 @@ public class IpServerTest { initStateMachine(interfaceType, usingLegacyDhcp); dispatchCommand(IpServer.CMD_TETHER_REQUESTED, STATE_TETHERED); if (upstreamIface != null) { - dispatchTetherConnectionChanged(upstreamIface); + LinkProperties lp = new LinkProperties(); + lp.setInterfaceName(upstreamIface); + dispatchTetherConnectionChanged(upstreamIface, lp); } reset(mNetd, mCallback); } @@ -508,13 +510,21 @@ public class IpServerTest { * * @see #dispatchCommand(int) * @param upstreamIface String name of upstream interface (or null) + * @param v6lp IPv6 LinkProperties of the upstream interface, or null for an IPv4-only upstream. */ - private void dispatchTetherConnectionChanged(String upstreamIface) { + private void dispatchTetherConnectionChanged(String upstreamIface, LinkProperties v6lp) { mIpServer.sendMessage(IpServer.CMD_TETHER_CONNECTION_CHANGED, new InterfaceSet(upstreamIface)); + if (v6lp != null) { + mIpServer.sendMessage(IpServer.CMD_IPV6_TETHER_UPDATE, v6lp); + } mLooper.dispatchAll(); } + private void dispatchTetherConnectionChanged(String upstreamIface) { + dispatchTetherConnectionChanged(upstreamIface, null); + } + private void assertIPv4AddressAndDirectlyConnectedRoute(LinkProperties lp) { // Find the first IPv4 LinkAddress. LinkAddress addr4 = null; |