Merge "Stop the created handler threads" into main
This commit is contained in:
@@ -367,6 +367,10 @@ public class AutomaticOnOffKeepaliveTrackerTest {
|
|||||||
@After
|
@After
|
||||||
public void teardown() throws Exception {
|
public void teardown() throws Exception {
|
||||||
TestKeepaliveInfo.closeAllSockets();
|
TestKeepaliveInfo.closeAllSockets();
|
||||||
|
if (mHandlerThread != null) {
|
||||||
|
mHandlerThread.quitSafely();
|
||||||
|
mHandlerThread.join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class AOOTestHandler extends Handler {
|
private final class AOOTestHandler extends Handler {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import com.android.testutils.DevSdkIgnoreRule;
|
|||||||
import com.android.testutils.DevSdkIgnoreRunner;
|
import com.android.testutils.DevSdkIgnoreRunner;
|
||||||
import com.android.testutils.HandlerUtils;
|
import com.android.testutils.HandlerUtils;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -240,6 +241,14 @@ public class KeepaliveStatsTrackerTest {
|
|||||||
HandlerUtils.waitForIdle(mTestHandler, TIMEOUT_MS);
|
HandlerUtils.waitForIdle(mTestHandler, TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
if (mHandlerThread != null) {
|
||||||
|
mHandlerThread.quitSafely();
|
||||||
|
mHandlerThread.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setElapsedRealtime(long time) {
|
private void setElapsedRealtime(long time) {
|
||||||
doReturn(time).when(mDependencies).getElapsedRealtime();
|
doReturn(time).when(mDependencies).getElapsedRealtime();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user