Remove use of UiThreadTestRule and migrate to UiThreadTest in chromium
Remove android.support.test.rule.UiThreadTestRule as chromium did in [1] and Replace android.support.test.annotation.UiThreadTest with org.chromium.base.test.UiThreadTest. Also remove unused uiThreadHandler from NetworkMonitorTest. [1] https://crrev.com/c/2332301 Bug: webrtc:11962 Change-Id: I8f3781d43d4d53d8158c39c81568d8b09b2bec6a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230220 Reviewed-by: Xavier Lepaul <xalep@webrtc.org> Commit-Queue: Byoungchan Lee <daniel.l@hpcnt.com> Cr-Commit-Position: refs/heads/main@{#34864}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
0d175356cb
commit
44b919c10a
@ -25,13 +25,12 @@ import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.annotation.UiThreadTest;
|
||||
import android.support.test.rule.UiThreadTestRule;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.test.filters.MediumTest;
|
||||
import androidx.test.filters.SmallTest;
|
||||
import java.util.List;
|
||||
import org.chromium.base.test.BaseJUnit4ClassRunner;
|
||||
import org.chromium.base.test.UiThreadTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@ -51,8 +50,6 @@ import org.webrtc.NetworkMonitorAutoDetect.NetworkState;
|
||||
@SuppressLint("NewApi")
|
||||
@RunWith(BaseJUnit4ClassRunner.class)
|
||||
public class NetworkMonitorTest {
|
||||
@Rule public UiThreadTestRule uiThreadTestRule = new UiThreadTestRule();
|
||||
|
||||
private static final long INVALID_NET_ID = -1;
|
||||
private NetworkChangeDetector detector;
|
||||
|
||||
@ -164,23 +161,10 @@ public class NetworkMonitorTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object lock = new Object();
|
||||
private static @Nullable Handler uiThreadHandler;
|
||||
|
||||
private NetworkMonitorAutoDetect receiver;
|
||||
private MockConnectivityManagerDelegate connectivityDelegate;
|
||||
private MockWifiManagerDelegate wifiDelegate;
|
||||
|
||||
private static Handler getUiThreadHandler() {
|
||||
synchronized (lock) {
|
||||
Handler handler = uiThreadHandler;
|
||||
if (handler != null) {
|
||||
return handler;
|
||||
}
|
||||
return uiThreadHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a network monitor and delegates for testing.
|
||||
*/
|
||||
|
||||
@ -16,22 +16,19 @@ import static org.junit.Assert.fail;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Point;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.annotation.UiThreadTest;
|
||||
import android.support.test.rule.UiThreadTestRule;
|
||||
import android.view.View.MeasureSpec;
|
||||
import androidx.test.filters.MediumTest;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.chromium.base.test.BaseJUnit4ClassRunner;
|
||||
import org.chromium.base.test.UiThreadTest;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BaseJUnit4ClassRunner.class)
|
||||
public class SurfaceViewRendererOnMeasureTest {
|
||||
@Rule public UiThreadTestRule uiThreadTestRule = new UiThreadTestRule();
|
||||
|
||||
/**
|
||||
* List with all possible scaling types.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user