Merge "cts: unregister softap callback after finish the test" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-20 19:39:44 +00:00
committed by Android (Google) Code Review

View File

@@ -1447,11 +1447,11 @@ public class WifiManagerTest extends AndroidTestCase {
*/
public void testSetGetSoftApConfigurationAndSoftApCapabilityCallback() throws Exception {
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
TestExecutor executor = new TestExecutor();
TestSoftApCallback callback = new TestSoftApCallback(mLock);
try {
uiAutomation.adoptShellPermissionIdentity();
turnOffWifiAndTetheredHotspotIfEnabled();
TestExecutor executor = new TestExecutor();
TestSoftApCallback callback = new TestSoftApCallback(mLock);
verifyRegisterSoftApCallback(executor, callback);
SoftApConfiguration.Builder softApConfigBuilder = new SoftApConfiguration.Builder()
@@ -1490,6 +1490,7 @@ public class WifiManagerTest extends AndroidTestCase {
verifySetGetSoftApConfig(softApConfigBuilder.build());
}
} finally {
mWifiManager.unregisterSoftApCallback(callback);
uiAutomation.dropShellPermissionIdentity();
}
}
@@ -1501,11 +1502,11 @@ public class WifiManagerTest extends AndroidTestCase {
public void testStartTetheredHotspotWithChannelConfigAndSoftApStateAndInfoCallback()
throws Exception {
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
TestExecutor executor = new TestExecutor();
TestSoftApCallback callback = new TestSoftApCallback(mLock);
try {
uiAutomation.adoptShellPermissionIdentity();
turnOffWifiAndTetheredHotspotIfEnabled();
TestExecutor executor = new TestExecutor();
TestSoftApCallback callback = new TestSoftApCallback(mLock);
verifyRegisterSoftApCallback(executor, callback);
SoftApConfiguration testSoftApConfig = new SoftApConfiguration.Builder()
@@ -1544,6 +1545,7 @@ public class WifiManagerTest extends AndroidTestCase {
0 == callback.getCurrentSoftApInfo().getFrequency();
});
} finally {
mWifiManager.unregisterSoftApCallback(callback);
uiAutomation.dropShellPermissionIdentity();
}
}