Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator" am: 028e2a048e am: c7ec0f6fc3

am: 83939e37af

Change-Id: I5f2d395705841b7da03b1552b16507466e47ef84
This commit is contained in:
Jong Wook Kim
2018-02-07 09:26:56 +00:00
committed by android-build-merger
2 changed files with 34 additions and 6 deletions

View File

@@ -172,7 +172,7 @@ public class MacAddressTest {
final int iterations = 1000;
final String expectedAndroidOui = "da:a1:19";
for (int i = 0; i < iterations; i++) {
MacAddress mac = MacAddress.createRandomUnicastAddress();
MacAddress mac = MacAddress.createRandomUnicastAddressWithGoogleBase();
String stringRepr = mac.toString();
assertTrue(stringRepr + " expected to be a locally assigned address",
@@ -195,6 +195,15 @@ public class MacAddressTest {
assertTrue(stringRepr + " expected to begin with " + expectedLocalOui,
stringRepr.startsWith(expectedLocalOui));
}
for (int i = 0; i < iterations; i++) {
MacAddress mac = MacAddress.createRandomUnicastAddress();
String stringRepr = mac.toString();
assertTrue(stringRepr + " expected to be a locally assigned address",
mac.isLocallyAssigned());
assertEquals(MacAddress.TYPE_UNICAST, mac.getAddressType());
}
}
@Test