Loading tests/net/java/android/net/ip/IpManagerTest.java +11 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public class IpManagerTest { @Mock private AlarmManager mAlarm; private MockContentResolver mContentResolver; @Before public void setUp() throws Exception { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); when(mContext.getSystemService(eq(Context.ALARM_SERVICE))).thenReturn(mAlarm); Loading @@ -88,6 +89,13 @@ public class IpManagerTest { when(mContext.getContentResolver()).thenReturn(mContentResolver); } private IpManager makeIpManager(String ifname) throws Exception { final IpManager ipm = new IpManager(mContext, ifname, mCb, mNMService); verify(mNMService, timeout(100).times(1)).disableIpv6(ifname); verify(mNMService, timeout(100).times(1)).clearInterfaceAddresses(ifname); return ipm; } @Test public void testNullCallbackDoesNotThrow() throws Exception { final IpManager ipm = new IpManager(mContext, "lo", null, mNMService); Loading @@ -101,7 +109,8 @@ public class IpManagerTest { @Test public void testDefaultProvisioningConfiguration() throws Exception { final String iface = "test_wlan0"; final IpManager ipm = new IpManager(mContext, iface, mCb, mNMService); final IpManager ipm = makeIpManager(iface); ProvisioningConfiguration config = new ProvisioningConfiguration.Builder() .withoutIPv4() // TODO: mock IpReachabilityMonitor's dependencies (NetworkInterface, PowerManager) Loading Loading
tests/net/java/android/net/ip/IpManagerTest.java +11 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public class IpManagerTest { @Mock private AlarmManager mAlarm; private MockContentResolver mContentResolver; @Before public void setUp() throws Exception { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); when(mContext.getSystemService(eq(Context.ALARM_SERVICE))).thenReturn(mAlarm); Loading @@ -88,6 +89,13 @@ public class IpManagerTest { when(mContext.getContentResolver()).thenReturn(mContentResolver); } private IpManager makeIpManager(String ifname) throws Exception { final IpManager ipm = new IpManager(mContext, ifname, mCb, mNMService); verify(mNMService, timeout(100).times(1)).disableIpv6(ifname); verify(mNMService, timeout(100).times(1)).clearInterfaceAddresses(ifname); return ipm; } @Test public void testNullCallbackDoesNotThrow() throws Exception { final IpManager ipm = new IpManager(mContext, "lo", null, mNMService); Loading @@ -101,7 +109,8 @@ public class IpManagerTest { @Test public void testDefaultProvisioningConfiguration() throws Exception { final String iface = "test_wlan0"; final IpManager ipm = new IpManager(mContext, iface, mCb, mNMService); final IpManager ipm = makeIpManager(iface); ProvisioningConfiguration config = new ProvisioningConfiguration.Builder() .withoutIPv4() // TODO: mock IpReachabilityMonitor's dependencies (NetworkInterface, PowerManager) Loading