Loading tests/integration/src/android/net/ip/IpClientIntegrationTest.java +7 −11 Original line number Diff line number Diff line Loading @@ -188,6 +188,9 @@ public class IpClientIntegrationTest { private static final String TEST_GROUPHINT = "some grouphint"; private static final int TEST_LEASE_DURATION_S = 3_600; // 1 hour // TODO: move to NetlinkConstants, NetworkStackConstants, or OsConstants. private static final int IFA_F_STABLE_PRIVACY = 0x800; @Rule public final DevSdkIgnoreRule mIgnoreRule = new DevSdkIgnoreRule(); Loading Loading @@ -1385,9 +1388,9 @@ public class IpClientIntegrationTest { } private boolean isStablePrivacyAddress(LinkAddress addr) { // TODO: this is incorrect. Fix netd to report IFA_F_STABLE_PRIVACY on R onwards, and then // move away from getting addresses from netd altogether. return addr.isGlobalPreferred(); // TODO: move away from getting address updates from netd and make this work on Q as well. final int flag = ShimUtils.isAtLeastR() ? IFA_F_STABLE_PRIVACY : 0; return addr.isGlobalPreferred() && hasFlag(addr, flag); } private LinkProperties doIpv6OnlyProvisioning(InOrder inOrder, ByteBuffer ra) throws Exception { Loading Loading @@ -1503,20 +1506,13 @@ public class IpClientIntegrationTest { ByteBuffer pref64 = new StructNdOptPref64(prefix, 600).toByteBuffer(); ByteBuffer ra = buildRaPacket(pio, rdnss, pref64); waitForRouterSolicitation(); mPacketReader.sendResponse(ra); // The NAT64 prefix might be detected before or after provisioning success. // Don't test order between these two events. ArgumentCaptor<LinkProperties> captor = ArgumentCaptor.forClass(LinkProperties.class); verifyWithTimeout(null /*inOrder*/, mCb).onProvisioningSuccess(captor.capture()); LinkProperties lp = doIpv6OnlyProvisioning(null /*inOrder*/, ra); expectAlarmSet(null /*inOrder*/, "PREF64", 600); reset(mCb, mAlarm); // From now on expect events in order. InOrder inOrder = inOrder(mCb, mAlarm); LinkProperties lp = captor.getValue(); if (lp.getNat64Prefix() != null) { assertEquals(prefix, lp.getNat64Prefix()); } else { Loading Loading
tests/integration/src/android/net/ip/IpClientIntegrationTest.java +7 −11 Original line number Diff line number Diff line Loading @@ -188,6 +188,9 @@ public class IpClientIntegrationTest { private static final String TEST_GROUPHINT = "some grouphint"; private static final int TEST_LEASE_DURATION_S = 3_600; // 1 hour // TODO: move to NetlinkConstants, NetworkStackConstants, or OsConstants. private static final int IFA_F_STABLE_PRIVACY = 0x800; @Rule public final DevSdkIgnoreRule mIgnoreRule = new DevSdkIgnoreRule(); Loading Loading @@ -1385,9 +1388,9 @@ public class IpClientIntegrationTest { } private boolean isStablePrivacyAddress(LinkAddress addr) { // TODO: this is incorrect. Fix netd to report IFA_F_STABLE_PRIVACY on R onwards, and then // move away from getting addresses from netd altogether. return addr.isGlobalPreferred(); // TODO: move away from getting address updates from netd and make this work on Q as well. final int flag = ShimUtils.isAtLeastR() ? IFA_F_STABLE_PRIVACY : 0; return addr.isGlobalPreferred() && hasFlag(addr, flag); } private LinkProperties doIpv6OnlyProvisioning(InOrder inOrder, ByteBuffer ra) throws Exception { Loading Loading @@ -1503,20 +1506,13 @@ public class IpClientIntegrationTest { ByteBuffer pref64 = new StructNdOptPref64(prefix, 600).toByteBuffer(); ByteBuffer ra = buildRaPacket(pio, rdnss, pref64); waitForRouterSolicitation(); mPacketReader.sendResponse(ra); // The NAT64 prefix might be detected before or after provisioning success. // Don't test order between these two events. ArgumentCaptor<LinkProperties> captor = ArgumentCaptor.forClass(LinkProperties.class); verifyWithTimeout(null /*inOrder*/, mCb).onProvisioningSuccess(captor.capture()); LinkProperties lp = doIpv6OnlyProvisioning(null /*inOrder*/, ra); expectAlarmSet(null /*inOrder*/, "PREF64", 600); reset(mCb, mAlarm); // From now on expect events in order. InOrder inOrder = inOrder(mCb, mAlarm); LinkProperties lp = captor.getValue(); if (lp.getNat64Prefix() != null) { assertEquals(prefix, lp.getNat64Prefix()); } else { Loading