Add CTS test for ConnectivityManager#tether exception after V

Current test was mistakenly added to the unit test version of
ConnectivityManagerTest instead of the CTS test. Move this to the CTS
test instead.

Bug: 392986269
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: Id64d21929fb6b6c42f46a821a3cd28bbcaf77cda
This commit is contained in:
Quang Anh Luong 2025-02-07 12:33:30 +09:00
commit 6c478ee215

View file

@ -44,7 +44,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
@ -66,7 +65,6 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.ConnectivityManager.NetworkCallback;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
@ -671,12 +669,4 @@ public class ConnectivityManagerTest {
// No callbacks overridden -> do not use the optimization
eq(~0));
}
@Test
public void testLegacyTetherApisThrowUnsupportedOperationExceptionAfterV() {
assumeTrue(Build.VERSION.SDK_INT > Build.VERSION_CODES.VANILLA_ICE_CREAM);
final ConnectivityManager manager = new ConnectivityManager(mCtx, mService);
assertThrows(UnsupportedOperationException.class, () -> manager.tether("iface"));
assertThrows(UnsupportedOperationException.class, () -> manager.untether("iface"));
}
}