Merge "Add a common test library."

This commit is contained in:
Chalard Jean
2019-05-29 12:16:08 +00:00
committed by Gerrit Code Review
5 changed files with 17 additions and 30 deletions

View File

@@ -16,8 +16,6 @@
package android.net.nsd;
import static com.android.internal.util.TestUtils.waitForIdleHandler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -40,6 +38,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.util.AsyncChannel;
import com.android.testutils.HandlerUtilsKt;
import org.junit.After;
import org.junit.Before;
@@ -74,7 +73,7 @@ public class NsdManagerTest {
@After
public void tearDown() throws Exception {
mServiceHandler.waitForIdle(mTimeoutMs);
HandlerUtilsKt.waitForIdle(mServiceHandler, mTimeoutMs);
mServiceHandler.chan.disconnect();
mServiceHandler.stop();
if (mManager != null) {
@@ -334,7 +333,7 @@ public class NsdManagerTest {
}
int verifyRequest(int expectedMessageType) {
mServiceHandler.waitForIdle(mTimeoutMs);
HandlerUtilsKt.waitForIdle(mServiceHandler, mTimeoutMs);
verify(mServiceHandler, timeout(mTimeoutMs)).handleMessage(any());
reset(mServiceHandler);
Message received = mServiceHandler.getLastMessage();
@@ -366,10 +365,6 @@ public class NsdManagerTest {
lastMessage.copyFrom(msg);
}
void waitForIdle(long timeoutMs) {
waitForIdleHandler(this, timeoutMs);
}
@Override
public void handleMessage(Message msg) {
setLastMessage(msg);