Fix the legacy VPN tests that start racoon.
These tests do not actually work, or at least not as designed. What happens when they are run is that creating/connecting the VPN throws an exception. The call to legacyRunnerReady.block() times out after 10 seconds because the condition variable is never opened, but the doesn't notice the timeout becasue it doesn't check the return value of block(). There are two reasons for the VPN not coming up. 1. VpnConfig.getIntentForStatusPanel calls into PendingIntent and ActivityManager statics, which bypass all the mocks and fail with an appops denial. Fix this by making it a dependency. 2. The tests are broken due to the UserManager API changes tracked in b/175883995. Fixing by adding a bit of ad-hoc code into startLegacyVpn, with a TODO to delete it once the rest of the UserManager setup code is fixed. Fix these and check the return value of block(). This ensures that if any other breakage is added the test will actually fail. Also check that the throw route survives all the way to the LinkProperties sent to the agent. Bug: 173331190 Test: atest com.android.server.connectivity.VpnTest Change-Id: Ieb7f33bce283ac5ee562a912df8edb9c930ed2b0
Loading
Please register or sign in to comment