summaryrefslogtreecommitdiff
path: root/tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java')
-rw-r--r--tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java b/tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java
index 726833f..e256add 100644
--- a/tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java
+++ b/tests/java/com/android/server/ethernet/EthernetNetworkFactoryTest.java
@@ -279,19 +279,13 @@ public class EthernetNetworkFactoryTest {
// creates an unprovisioned interface
private void createUnprovisionedInterface(String iface) throws Exception {
- // the only way to create an unprovisioned interface is by calling needNetworkFor
- // followed by releaseNetworkFor which will stop the NetworkAgent and IpClient. When
- // EthernetNetworkFactory#updateInterfaceLinkState(iface, true) is called, the interface
- // is automatically provisioned even if nobody has ever called needNetworkFor
+ // To create an unprovisioned interface, provision and then "stop" it, i.e. stop its
+ // NetworkAgent and IpClient. One way this can be done is by provisioning an interface and
+ // then calling onNetworkUnwanted.
createAndVerifyProvisionedInterface(iface);
- // Interface is already provisioned, so startProvisioning / register should not be called
- // again
- mNetFactory.needNetworkFor(createDefaultRequest());
- verify(mIpClient, never()).startProvisioning(any());
- verify(mNetworkAgent, never()).register();
-
- mNetFactory.releaseNetworkFor(createDefaultRequest());
+ mNetworkAgent.getCallbacks().onNetworkUnwanted();
+ mLooper.dispatchAll();
verifyStop();
clearInvocations(mIpClient);