Initial import of ADIF API reverse-engineering toolkit

This commit is contained in:
2025-12-16 08:37:56 +01:00
commit 60388529c1
11486 changed files with 1086536 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u00012\u00020\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\b\u0010\u0007\u001a\u00020\bH\u0016R\u0018\u0010\u0004\u001a\u0006\u0012\u0002\b\u00030\u00018VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, d2 = {"Lkotlinx/coroutines/test/BackgroundWork;", "Lkotlin/coroutines/CoroutineContext$Key;", "Lkotlin/coroutines/CoroutineContext$Element;", "()V", "key", "getKey", "()Lkotlin/coroutines/CoroutineContext$Key;", "toString", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class BackgroundWork implements CoroutineContext.Key<BackgroundWork>, CoroutineContext.Element {
public static final BackgroundWork INSTANCE = new BackgroundWork();
private BackgroundWork() {
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <R> R fold(R r4, Function2<? super R, ? super CoroutineContext.Element, ? extends R> function2) {
return (R) CoroutineContext.Element.DefaultImpls.fold(this, r4, function2);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key<E> key) {
return (E) CoroutineContext.Element.DefaultImpls.get(this, key);
}
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key<?> getKey() {
return this;
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key<?> key) {
return CoroutineContext.Element.DefaultImpls.minusKey(this, key);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return CoroutineContext.Element.DefaultImpls.plus(this, coroutineContext);
}
public String toString() {
return "BackgroundWork";
}
}

View File

@@ -0,0 +1,30 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmField;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0002\u0018\u00002\u00060\u0001j\u0002`\u0002B\u001b\u0012\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\b\u0010\t\u001a\u00020\u0005H\u0016R\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lkotlinx/coroutines/test/CancellableContinuationRunnable;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "", "dispatcher", "Lkotlinx/coroutines/CoroutineDispatcher;", "(Lkotlinx/coroutines/CancellableContinuation;Lkotlinx/coroutines/CoroutineDispatcher;)V", "run", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestDispatcher.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestDispatcher.kt\nkotlinx/coroutines/test/CancellableContinuationRunnable\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,69:1\n1#2:70\n*E\n"})
/* loaded from: classes3.dex */
public final class CancellableContinuationRunnable implements Runnable {
@JvmField
public final CancellableContinuation<Unit> continuation;
private final CoroutineDispatcher dispatcher;
/* JADX WARN: Multi-variable type inference failed */
public CancellableContinuationRunnable(CancellableContinuation<? super Unit> cancellableContinuation, CoroutineDispatcher coroutineDispatcher) {
this.continuation = cancellableContinuation;
this.dispatcher = coroutineDispatcher;
}
@Override // java.lang.Runnable
public void run() {
this.continuation.resumeUndispatched(this.dispatcher, Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,47 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Deprecated(level = DeprecationLevel.ERROR, message = "Use `TestCoroutineScheduler` to control virtual time.")
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\t\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\bg\u0018\u00002\u00020\u0001J\u0010\u0010\b\u001a\u00020\u00032\u0006\u0010\t\u001a\u00020\u0003H'J\b\u0010\n\u001a\u00020\u0003H'J\b\u0010\u000b\u001a\u00020\fH'J\b\u0010\r\u001a\u00020\fH'J,\u0010\r\u001a\u00020\f2\u001c\u0010\u000e\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\f0\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u00010\u000fH§@¢\u0006\u0002\u0010\u0011J\b\u0010\u0012\u001a\u00020\fH'J\b\u0010\u0013\u001a\u00020\fH'R\u001a\u0010\u0002\u001a\u00020\u00038&X§\u0004¢\u0006\f\u0012\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0014"}, d2 = {"Lkotlinx/coroutines/test/DelayController;", "", "currentTime", "", "getCurrentTime$annotations", "()V", "getCurrentTime", "()J", "advanceTimeBy", "delayTimeMillis", "advanceUntilIdle", "cleanupTestCoroutines", "", "pauseDispatcher", "block", "Lkotlin/Function1;", "Lkotlin/coroutines/Continuation;", "(Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "resumeDispatcher", "runCurrent", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@ExperimentalCoroutinesApi
/* loaded from: classes3.dex */
public interface DelayController {
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DefaultImpls {
@ExperimentalCoroutinesApi
public static /* synthetic */ void getCurrentTime$annotations() {
}
}
@ExperimentalCoroutinesApi
long advanceTimeBy(long delayTimeMillis);
@ExperimentalCoroutinesApi
long advanceUntilIdle();
@ExperimentalCoroutinesApi
void cleanupTestCoroutines() throws AssertionError;
long getCurrentTime();
@Deprecated(level = DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
Object pauseDispatcher(Function1<? super Continuation<? super Unit>, ? extends Object> function1, Continuation<? super Unit> continuation);
@Deprecated(level = DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
void pauseDispatcher();
@Deprecated(level = DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
void resumeDispatcher();
@ExperimentalCoroutinesApi
void runCurrent();
}

View File

@@ -0,0 +1,43 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u00012\u00020\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\b\u0010\u0007\u001a\u00020\bH\u0016R\u0018\u0010\u0004\u001a\u0006\u0012\u0002\b\u00030\u00018VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, d2 = {"Lkotlinx/coroutines/test/RunningInRunTest;", "Lkotlin/coroutines/CoroutineContext$Key;", "Lkotlin/coroutines/CoroutineContext$Element;", "()V", "key", "getKey", "()Lkotlin/coroutines/CoroutineContext$Key;", "toString", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class RunningInRunTest implements CoroutineContext.Key<RunningInRunTest>, CoroutineContext.Element {
public static final RunningInRunTest INSTANCE = new RunningInRunTest();
private RunningInRunTest() {
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <R> R fold(R r4, Function2<? super R, ? super CoroutineContext.Element, ? extends R> function2) {
return (R) CoroutineContext.Element.DefaultImpls.fold(this, r4, function2);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key<E> key) {
return (E) CoroutineContext.Element.DefaultImpls.get(this, key);
}
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key<?> getKey() {
return this;
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key<?> key) {
return CoroutineContext.Element.DefaultImpls.minusKey(this, key);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return CoroutineContext.Element.DefaultImpls.plus(this, coroutineContext);
}
public String toString() {
return "RunningInRunTest";
}
}

View File

@@ -0,0 +1,73 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0002\b`\u0018\u00002\u00020\u0001J\u0010\u0010\f\u001a\u00020\u00032\u0006\u0010\r\u001a\u00020\u0003H\u0017J\b\u0010\u000e\u001a\u00020\u0003H\u0017J\b\u0010\u000f\u001a\u00020\u0010H\u0017J\b\u0010\u0011\u001a\u00020\u0010H\u0017R\u001a\u0010\u0002\u001a\u00020\u00038VX\u0097\u0004¢\u0006\f\u0012\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007R\u0012\u0010\b\u001a\u00020\tX¦\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000b¨\u0006\u0012"}, d2 = {"Lkotlinx/coroutines/test/SchedulerAsDelayController;", "Lkotlinx/coroutines/test/DelayController;", "currentTime", "", "getCurrentTime$annotations", "()V", "getCurrentTime", "()J", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "advanceTimeBy", "delayTimeMillis", "advanceUntilIdle", "cleanupTestCoroutines", "", "runCurrent", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public interface SchedulerAsDelayController extends DelayController {
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DefaultImpls {
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.apply { advanceTimeBy(delayTimeMillis); runCurrent() }", imports = {}))
public static long advanceTimeBy(SchedulerAsDelayController schedulerAsDelayController, long j4) {
long currentTime = schedulerAsDelayController.getScheduler().getCurrentTime();
schedulerAsDelayController.getScheduler().advanceTimeBy(j4);
schedulerAsDelayController.getScheduler().runCurrent();
return schedulerAsDelayController.getScheduler().getCurrentTime() - currentTime;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.advanceUntilIdle()", imports = {}))
public static long advanceUntilIdle(SchedulerAsDelayController schedulerAsDelayController) {
long currentTime = schedulerAsDelayController.getScheduler().getCurrentTime();
schedulerAsDelayController.getScheduler().advanceUntilIdle();
return schedulerAsDelayController.getScheduler().getCurrentTime() - currentTime;
}
@ExperimentalCoroutinesApi
public static void cleanupTestCoroutines(SchedulerAsDelayController schedulerAsDelayController) {
schedulerAsDelayController.getScheduler().runCurrent();
if (!schedulerAsDelayController.getScheduler().isIdle$kotlinx_coroutines_test(false)) {
throw new UncompletedCoroutinesError("Unfinished coroutines during tear-down. Ensure all coroutines are completed or cancelled by your test.");
}
}
public static long getCurrentTime(SchedulerAsDelayController schedulerAsDelayController) {
return schedulerAsDelayController.getScheduler().getCurrentTime();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "This property delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.currentTime", imports = {}))
public static /* synthetic */ void getCurrentTime$annotations() {
}
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.runCurrent()", imports = {}))
public static void runCurrent(SchedulerAsDelayController schedulerAsDelayController) {
schedulerAsDelayController.getScheduler().runCurrent();
}
}
@Override // kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.apply { advanceTimeBy(delayTimeMillis); runCurrent() }", imports = {}))
long advanceTimeBy(long delayTimeMillis);
@Override // kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.advanceUntilIdle()", imports = {}))
long advanceUntilIdle();
@Override // kotlinx.coroutines.test.DelayController
@ExperimentalCoroutinesApi
void cleanupTestCoroutines();
@Override // kotlinx.coroutines.test.DelayController
long getCurrentTime();
TestCoroutineScheduler getScheduler();
@Override // kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.runCurrent()", imports = {}))
void runCurrent();
}

View File

@@ -0,0 +1,58 @@
package kotlinx.coroutines.test;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u001b\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u001c\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\n\u0010\r\u001a\u00060\u000ej\u0002`\u000fH\u0016J\b\u0010\u0010\u001a\u00020\u0005H\u0016R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0002\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\\u0006\u0011"}, d2 = {"Lkotlinx/coroutines/test/StandardTestDispatcherImpl;", "Lkotlinx/coroutines/test/TestDispatcher;", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "(Lkotlinx/coroutines/test/TestCoroutineScheduler;Ljava/lang/String;)V", "getScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "toString", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
final class StandardTestDispatcherImpl extends TestDispatcher {
private final String name;
private final TestCoroutineScheduler scheduler;
/* JADX WARN: Multi-variable type inference failed */
public StandardTestDispatcherImpl() {
this(null, 0 == true ? 1 : 0, 3, 0 == true ? 1 : 0);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo1685dispatch(CoroutineContext context, Runnable block) {
getScheduler().registerEvent$kotlinx_coroutines_test(this, 0L, block, context, new Function1<Runnable, Boolean>() { // from class: kotlinx.coroutines.test.StandardTestDispatcherImpl$dispatch$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Runnable runnable) {
return Boolean.FALSE;
}
});
}
@Override // kotlinx.coroutines.test.TestDispatcher
public TestCoroutineScheduler getScheduler() {
return this.scheduler;
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public String toString() {
StringBuilder sb = new StringBuilder();
String str = this.name;
if (str == null) {
str = "StandardTestDispatcher";
}
sb.append(str);
sb.append("[scheduler=");
sb.append(getScheduler());
sb.append(']');
return sb.toString();
}
public /* synthetic */ StandardTestDispatcherImpl(TestCoroutineScheduler testCoroutineScheduler, String str, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? new TestCoroutineScheduler() : testCoroutineScheduler, (i & 2) != 0 ? null : str);
}
public StandardTestDispatcherImpl(TestCoroutineScheduler testCoroutineScheduler, String str) {
this.scheduler = testCoroutineScheduler;
this.name = str;
}
}

View File

@@ -0,0 +1,40 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlinx.coroutines.AbstractCoroutine;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0001\n\u0000\n\u0002\u0010\u0003\n\u0000\b\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B\r\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u0006\u0010\n\u001a\u00020\u0002J\b\u0010\u000b\u001a\u00020\fH\u0017J\b\u0010\r\u001a\u0004\u0018\u00010\u000eR\u0014\u0010\u0006\u001a\u00020\u00078VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\tR\u000e\u0010\u0004\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000f"}, d2 = {"Lkotlinx/coroutines/test/TestBodyCoroutine;", "Lkotlinx/coroutines/AbstractCoroutine;", "", "Lkotlinx/coroutines/test/TestCoroutineScope;", "testScope", "(Lkotlinx/coroutines/test/TestCoroutineScope;)V", "testScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getTestScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "cleanup", "cleanupTestCoroutines", "", "tryGetCompletionCause", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestBodyCoroutine extends AbstractCoroutine<Unit> implements TestCoroutineScope {
private final TestCoroutineScope testScope;
public TestBodyCoroutine(TestCoroutineScope testCoroutineScope) {
super(testCoroutineScope.getCoroutineContext(), true, true);
this.testScope = testCoroutineScope;
}
public final void cleanup() {
this.testScope.mo1698cleanupTestCoroutines();
}
@Override // kotlinx.coroutines.test.TestCoroutineScope
public TestCoroutineScheduler getTestScheduler() {
return this.testScope.getTestScheduler();
}
public final Throwable tryGetCompletionCause() {
return getCompletionCause();
}
@Override // kotlinx.coroutines.test.TestCoroutineScope
@Deprecated(level = DeprecationLevel.ERROR, message = "This deprecation is to prevent accidentally calling `cleanupTestCoroutines` in our own code.", replaceWith = @ReplaceWith(expression = "this.cleanup()", imports = {}))
/* renamed from: cleanupTestCoroutines, reason: merged with bridge method [inline-methods] */
public Void mo1698cleanupTestCoroutines() {
throw new UnsupportedOperationException("Calling `cleanupTestCoroutines` inside `runTest` is prohibited: it will be called at the end of the test in any case.");
}
}

View File

@@ -0,0 +1,60 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersJvmKt$createTestResult$1", f = "TestBuildersJvm.kt", i = {}, l = {14}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersJvmKt$createTestResult$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ Function2<CoroutineScope, Continuation<? super Unit>, Object> $testProcedure;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersJvmKt$createTestResult$1(Function2<? super CoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2, Continuation<? super TestBuildersJvmKt$createTestResult$1> continuation) {
super(2, continuation);
this.$testProcedure = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersJvmKt$createTestResult$1 testBuildersJvmKt$createTestResult$1 = new TestBuildersJvmKt$createTestResult$1(this.$testProcedure, continuation);
testBuildersJvmKt$createTestResult$1.L$0 = obj;
return testBuildersJvmKt$createTestResult$1;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
Function2<CoroutineScope, Continuation<? super Unit>, Object> function2 = this.$testProcedure;
this.label = 1;
if (function2.invoke(coroutineScope, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersJvmKt$createTestResult$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,44 @@
package kotlinx.coroutines.test;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.BuildersKt__BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.debug.internal.DebugProbesImpl;
@Metadata(d1 = {"\u0000(\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\u001a6\u0010\u0000\u001a\u00020\u00012'\u0010\u0002\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0004\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0005\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0003¢\u0006\u0002\b\u0007H\u0000¢\u0006\u0002\u0010\b\u001a\b\u0010\t\u001a\u00020\u0001H\u0000\u001a\u0012\u0010\n\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\f\u001a\u00020\u000bH\u0000*\n\u0010\r\"\u00020\u00012\u00020\u0001¨\u0006\u000e"}, d2 = {"createTestResult", "", "testProcedure", "Lkotlin/Function2;", "Lkotlinx/coroutines/CoroutineScope;", "Lkotlin/coroutines/Continuation;", "", "Lkotlin/ExtensionFunctionType;", "(Lkotlin/jvm/functions/Function2;)V", "dumpCoroutines", "systemPropertyImpl", "", AppMeasurementSdk.ConditionalUserProperty.NAME, "TestResult", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestBuildersJvmKt {
public static /* synthetic */ void TestResult$annotations() {
}
public static final void createTestResult(Function2<? super CoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
BuildersKt__BuildersKt.runBlocking$default(null, new TestBuildersJvmKt$createTestResult$1(function2, null), 1, null);
}
public static final void dumpCoroutines() {
DebugProbesImpl debugProbesImpl = DebugProbesImpl.INSTANCE;
if (debugProbesImpl.isInstalled$kotlinx_coroutines_debug()) {
debugProbesImpl.install$kotlinx_coroutines_core();
try {
debugProbesImpl.dumpCoroutines(System.err);
System.err.flush();
debugProbesImpl.uninstall$kotlinx_coroutines_core();
} catch (Throwable th) {
DebugProbesImpl.INSTANCE.uninstall$kotlinx_coroutines_core();
throw th;
}
}
}
public static final String systemPropertyImpl(String str) {
try {
return System.getProperty(str);
} catch (SecurityException unused) {
return null;
}
}
}

View File

@@ -0,0 +1,89 @@
package kotlinx.coroutines.test;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.AbstractCoroutine;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Metadata(d1 = {"kotlinx/coroutines/test/TestBuildersKt__TestBuildersDeprecatedKt", "kotlinx/coroutines/test/TestBuildersKt__TestBuildersKt"}, k = 4, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestBuildersKt {
public static final long DEFAULT_DISPATCH_TIMEOUT_MS = 60000;
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(CoroutineContext coroutineContext, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(coroutineContext, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers.")
public static final void runBlockingTestOnTestScope(CoroutineContext coroutineContext, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTestOnTestScope(coroutineContext, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Define a total timeout for the whole test instead of using dispatchTimeoutMs. Warning: the proposed replacement is not identical as it uses 'dispatchTimeoutMs' as the timeout for the whole test!", replaceWith = @ReplaceWith(expression = "runTest(context, timeout = dispatchTimeoutMs.milliseconds, testBody)", imports = {"kotlin.time.Duration.Companion.milliseconds"}))
public static final void runTest(CoroutineContext coroutineContext, long j4, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersKt.runTest(coroutineContext, j4, function2);
}
/* renamed from: runTest-8Mi8wO0, reason: not valid java name */
public static final void m1699runTest8Mi8wO0(CoroutineContext coroutineContext, long j4, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersKt.m1705runTest8Mi8wO0(coroutineContext, j4, function2);
}
@Deprecated(message = "Used for support of legacy behavior")
/* renamed from: runTestCoroutineLegacy-SYHnMyU, reason: not valid java name */
public static final <T extends AbstractCoroutine<? super Unit>> Object m1703runTestCoroutineLegacySYHnMyU(CoroutineScope coroutineScope, T t2, long j4, Function1<? super T, ? extends Throwable> function1, Function2<? super T, ? super Continuation<? super Unit>, ? extends Object> function2, Function0<? extends List<? extends Throwable>> function0, Continuation<? super Unit> continuation) {
return TestBuildersKt__TestBuildersKt.m1709runTestCoroutineLegacySYHnMyU(coroutineScope, t2, j4, function1, function2, function0, continuation);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead.")
@ExperimentalCoroutinesApi
public static final void runTestWithLegacyScope(CoroutineContext coroutineContext, long j4, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runTestWithLegacyScope(coroutineContext, j4, function2);
}
public static final void throwAll(Throwable th, List<? extends Throwable> list) {
TestBuildersKt__TestBuildersKt.throwAll(th, list);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(TestCoroutineDispatcher testCoroutineDispatcher, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(testCoroutineDispatcher, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `TestScope.runTest` instead.")
@ExperimentalCoroutinesApi
public static final void runTest(TestCoroutineScope testCoroutineScope, long j4, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runTest(testCoroutineScope, j4, function2);
}
/* renamed from: runTest-8Mi8wO0, reason: not valid java name */
public static final void m1700runTest8Mi8wO0(TestScope testScope, long j4, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersKt.m1706runTest8Mi8wO0(testScope, j4, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(TestCoroutineScope testCoroutineScope, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(testCoroutineScope, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Define a total timeout for the whole test instead of using dispatchTimeoutMs. Warning: the proposed replacement is not identical as it uses 'dispatchTimeoutMs' as the timeout for the whole test!", replaceWith = @ReplaceWith(expression = "this.runTest(timeout = dispatchTimeoutMs.milliseconds, testBody)", imports = {"kotlin.time.Duration.Companion.milliseconds"}))
public static final void runTest(TestScope testScope, long j4, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersKt.runTest(testScope, j4, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers.")
public static final void runBlockingTest(TestScope testScope, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(testScope, function2);
}
}

View File

@@ -0,0 +1,59 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1", f = "TestBuildersDeprecated.kt", i = {}, l = {67}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ TestCoroutineScope $scope;
final /* synthetic */ Function2<TestCoroutineScope, Continuation<? super Unit>, Object> $testBody;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1(Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2, TestCoroutineScope testCoroutineScope, Continuation<? super TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1> continuation) {
super(2, continuation);
this.$testBody = function2;
this.$scope = testCoroutineScope;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1(this.$testBody, this.$scope, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Function2<TestCoroutineScope, Continuation<? super Unit>, Object> function2 = this.$testBody;
TestCoroutineScope testCoroutineScope = this.$scope;
this.label = 1;
if (function2.invoke(testCoroutineScope, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,58 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/test/TestScopeImpl;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1", f = "TestBuildersDeprecated.kt", i = {}, l = {90}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1 extends SuspendLambda implements Function2<TestScopeImpl, Continuation<? super Unit>, Object> {
final /* synthetic */ TestScopeImpl $scope;
final /* synthetic */ Function2<TestScope, Continuation<? super Unit>, Object> $testBody;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1(Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2, TestScopeImpl testScopeImpl, Continuation<? super TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1> continuation) {
super(2, continuation);
this.$testBody = function2;
this.$scope = testScopeImpl;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1(this.$testBody, this.$scope, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Function2<TestScope, Continuation<? super Unit>, Object> function2 = this.$testBody;
TestScopeImpl testScopeImpl = this.$scope;
this.label = 1;
if (function2.invoke(testScopeImpl, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(TestScopeImpl testScopeImpl, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1) create(testScopeImpl, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,110 @@
package kotlinx.coroutines.test;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.CoroutineScope;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1", f = "TestBuildersDeprecated.kt", i = {}, l = {174}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ long $dispatchTimeoutMs;
final /* synthetic */ Function2<TestCoroutineScope, Continuation<? super Unit>, Object> $testBody;
final /* synthetic */ TestBodyCoroutine $testScope;
private /* synthetic */ Object L$0;
int label;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* renamed from: kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1$1, reason: invalid class name */
/* loaded from: classes3.dex */
public /* synthetic */ class AnonymousClass1 extends FunctionReferenceImpl implements Function1<TestBodyCoroutine, Throwable> {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public AnonymousClass1() {
super(1, TestBodyCoroutine.class, "tryGetCompletionCause", "tryGetCompletionCause()Ljava/lang/Throwable;", 0);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(TestBodyCoroutine testBodyCoroutine) {
return testBodyCoroutine.tryGetCompletionCause();
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1(TestBodyCoroutine testBodyCoroutine, long j4, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2, Continuation<? super TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1> continuation) {
super(2, continuation);
this.$testScope = testBodyCoroutine;
this.$dispatchTimeoutMs = j4;
this.$testBody = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1 testBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1 = new TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1(this.$testScope, this.$dispatchTimeoutMs, this.$testBody, continuation);
testBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1.L$0 = obj;
return testBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
TestBodyCoroutine testBodyCoroutine = this.$testScope;
Duration.Companion companion = Duration.INSTANCE;
long duration = DurationKt.toDuration(this.$dispatchTimeoutMs, DurationUnit.MILLISECONDS);
AnonymousClass1 anonymousClass1 = AnonymousClass1.INSTANCE;
Function2<TestCoroutineScope, Continuation<? super Unit>, Object> function2 = this.$testBody;
final TestBodyCoroutine testBodyCoroutine2 = this.$testScope;
Function0<List<? extends Throwable>> function0 = new Function0<List<? extends Throwable>>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1.2
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends Throwable> invoke() {
try {
TestBodyCoroutine.this.cleanup();
return CollectionsKt.emptyList();
} catch (UncompletedCoroutinesError e4) {
throw e4;
} catch (Throwable th) {
return CollectionsKt.listOf(th);
}
}
};
this.label = 1;
if (TestBuildersKt.m1703runTestCoroutineLegacySYHnMyU(coroutineScope, testBodyCoroutine, duration, anonymousClass1, function2, function0, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,144 @@
package kotlinx.coroutines.test;
import java.util.List;
import java.util.Set;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.SetsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Deferred;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.SupervisorKt;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000D\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a@\u0010\u0000\u001a\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u00032'\u0010\u0004\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\n\u001a@\u0010\u000b\u001a\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u00032'\u0010\u0004\u001a#\b\u0001\u0012\u0004\u0012\u00020\f\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\n\u001aJ\u0010\r\u001a\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u000e\u001a\u00020\u000f2'\u0010\u0004\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\u0010\u001a:\u0010\u0000\u001a\u00020\u0001*\u00020\u00112'\u0010\u0012\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\u0013\u001a:\u0010\u0000\u001a\u00020\u0001*\u00020\u00062'\u0010\u0012\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\u0014\u001a:\u0010\u0000\u001a\u00020\u0001*\u00020\f2'\u0010\u0012\u001a#\b\u0001\u0012\u0004\u0012\u00020\f\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\u0015\u001aH\u0010\u0016\u001a\u00060\u0001j\u0002`\u0017*\u00020\u00062\b\b\u0002\u0010\u000e\u001a\u00020\u000f2'\u0010\u0012\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0005¢\u0006\u0002\b\tH\u0007¢\u0006\u0002\u0010\u0018¨\u0006\u0019"}, d2 = {"runBlockingTest", "", "context", "Lkotlin/coroutines/CoroutineContext;", "testBody", "Lkotlin/Function2;", "Lkotlinx/coroutines/test/TestCoroutineScope;", "Lkotlin/coroutines/Continuation;", "", "Lkotlin/ExtensionFunctionType;", "(Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;)V", "runBlockingTestOnTestScope", "Lkotlinx/coroutines/test/TestScope;", "runTestWithLegacyScope", "dispatchTimeoutMs", "", "(Lkotlin/coroutines/CoroutineContext;JLkotlin/jvm/functions/Function2;)V", "Lkotlinx/coroutines/test/TestCoroutineDispatcher;", "block", "(Lkotlinx/coroutines/test/TestCoroutineDispatcher;Lkotlin/jvm/functions/Function2;)V", "(Lkotlinx/coroutines/test/TestCoroutineScope;Lkotlin/jvm/functions/Function2;)V", "(Lkotlinx/coroutines/test/TestScope;Lkotlin/jvm/functions/Function2;)V", "runTest", "Lkotlinx/coroutines/test/TestResult;", "(Lkotlinx/coroutines/test/TestCoroutineScope;JLkotlin/jvm/functions/Function2;)V", "kotlinx-coroutines-test"}, k = 5, mv = {1, 9, 0}, xi = 48, xs = "kotlinx/coroutines/test/TestBuildersKt")
/* loaded from: classes3.dex */
public final /* synthetic */ class TestBuildersKt__TestBuildersDeprecatedKt {
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(CoroutineContext coroutineContext, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
Deferred async$default;
TestCoroutineScope createTestCoroutineScope = TestCoroutineScopeKt.createTestCoroutineScope(new TestCoroutineDispatcher(null, 1, null).plus(SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null)).plus(coroutineContext));
TestCoroutineScheduler testScheduler = createTestCoroutineScope.getTestScheduler();
async$default = BuildersKt__Builders_commonKt.async$default(createTestCoroutineScope, null, null, new TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTest$deferred$1(function2, createTestCoroutineScope, null), 3, null);
testScheduler.advanceUntilIdle();
Throwable completionExceptionOrNull = async$default.getCompletionExceptionOrNull();
if (completionExceptionOrNull == null) {
createTestCoroutineScope.mo1698cleanupTestCoroutines();
return;
}
throw completionExceptionOrNull;
}
public static /* synthetic */ void runBlockingTest$default(CoroutineContext coroutineContext, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
TestBuildersKt.runBlockingTest(coroutineContext, (Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object>) function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers.")
public static final void runBlockingTestOnTestScope(CoroutineContext coroutineContext, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
Throwable th;
List<Throwable> emptyList;
CoroutineContext plus = new TestCoroutineDispatcher(null, 1, null).plus(SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null)).plus(coroutineContext);
Set<Job> activeJobs = TestCoroutineScopeKt.activeJobs(plus);
TestScopeImpl asSpecificImplementation = TestScopeKt.asSpecificImplementation(TestScopeKt.TestScope(plus));
asSpecificImplementation.enter();
asSpecificImplementation.start(CoroutineStart.UNDISPATCHED, asSpecificImplementation, new TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$1(function2, asSpecificImplementation, null));
asSpecificImplementation.getTestScheduler().advanceUntilIdle();
try {
th = asSpecificImplementation.getCompletionExceptionOrNull();
} catch (IllegalStateException unused) {
th = null;
}
CoroutineScopeKt.cancel$default(asSpecificImplementation.getBackgroundScope(), null, 1, null);
asSpecificImplementation.getTestScheduler().advanceUntilIdleOr$kotlinx_coroutines_test(new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt$runBlockingTestOnTestScope$2
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
return Boolean.FALSE;
}
});
if (th != null) {
try {
emptyList = asSpecificImplementation.legacyLeave();
} catch (UncompletedCoroutinesError unused2) {
emptyList = CollectionsKt.emptyList();
}
TestBuildersKt.throwAll(th, emptyList);
} else {
TestBuildersKt.throwAll(null, asSpecificImplementation.legacyLeave());
Set minus = SetsKt.minus((Set) TestCoroutineScopeKt.activeJobs(plus), (Iterable) activeJobs);
if (minus.isEmpty()) {
return;
}
throw new UncompletedCoroutinesError("Some jobs were not completed at the end of the test: " + minus);
}
}
public static /* synthetic */ void runBlockingTestOnTestScope$default(CoroutineContext coroutineContext, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
TestBuildersKt.runBlockingTestOnTestScope(coroutineContext, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `TestScope.runTest` instead.")
@ExperimentalCoroutinesApi
public static final void runTest(TestCoroutineScope testCoroutineScope, long j4, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt.runTestWithLegacyScope(testCoroutineScope.getCoroutineContext(), j4, function2);
}
public static /* synthetic */ void runTest$default(TestCoroutineScope testCoroutineScope, long j4, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
j4 = TestBuildersKt.DEFAULT_DISPATCH_TIMEOUT_MS;
}
TestBuildersKt.runTest(testCoroutineScope, j4, (Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object>) function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead.")
@ExperimentalCoroutinesApi
public static final void runTestWithLegacyScope(CoroutineContext coroutineContext, long j4, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
RunningInRunTest runningInRunTest = RunningInRunTest.INSTANCE;
if (coroutineContext.get(runningInRunTest) != null) {
throw new IllegalStateException("Calls to `runTest` can't be nested. Please read the docs on `TestResult` for details.");
}
TestBuildersJvmKt.createTestResult(new TestBuildersKt__TestBuildersDeprecatedKt$runTestWithLegacyScope$1(new TestBodyCoroutine(TestCoroutineScopeKt.createTestCoroutineScope(coroutineContext.plus(runningInRunTest))), j4, function2, null));
}
public static /* synthetic */ void runTestWithLegacyScope$default(CoroutineContext coroutineContext, long j4, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
if ((i & 2) != 0) {
j4 = TestBuildersKt.DEFAULT_DISPATCH_TIMEOUT_MS;
}
TestBuildersKt.runTestWithLegacyScope(coroutineContext, j4, function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(TestCoroutineScope testCoroutineScope, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt.runBlockingTest(testCoroutineScope.getCoroutineContext(), function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers.")
public static final void runBlockingTest(TestScope testScope, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt.runBlockingTestOnTestScope(testScope.getCoroutineContext(), function2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `runTest` instead to support completing from other dispatchers. Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
public static final void runBlockingTest(TestCoroutineDispatcher testCoroutineDispatcher, Function2<? super TestCoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
TestBuildersKt.runBlockingTest((CoroutineContext) testCoroutineDispatcher, function2);
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.time.Duration;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class TestBuildersKt__TestBuildersKt$DEFAULT_TIMEOUT$1$1 extends FunctionReferenceImpl implements Function1<String, Duration> {
public TestBuildersKt__TestBuildersKt$DEFAULT_TIMEOUT$1$1(Object obj) {
super(1, obj, Duration.Companion.class, "parse", "parse-UwyO8pc(Ljava/lang/String;)J", 0);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Duration invoke(String str) {
return Duration.m1453boximpl(m1710invoke5sfh64U(str));
}
/* renamed from: invoke-5sfh64U, reason: not valid java name */
public final long m1710invoke5sfh64U(String str) {
return ((Duration.Companion) this.receiver).m1574parseUwyO8pc(str);
}
}

View File

@@ -0,0 +1,23 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.Job;
@Metadata(d1 = {"\u0000\u001a\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00040\u00032\u0006\u0010\u0005\u001a\u00020\u0006H\\u0006\u0004\b\u0007\u0010\b"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;", "", "it", "Lkotlinx/coroutines/Job;", "invoke", "(Lkotlinx/coroutines/Job;)Ljava/lang/Boolean;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestBuilders.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestBuilders.kt\nkotlinx/coroutines/test/TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1\n*L\n1#1,609:1\n*E\n"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1 extends Lambda implements Function1<Job, Boolean> {
public static final TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1 INSTANCE = new TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1();
public TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1() {
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Job job) {
return Boolean.valueOf(job.isActive());
}
}

View File

@@ -0,0 +1,85 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.YieldKt;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1", f = "TestBuilders.kt", i = {0, 1}, l = {329, 332}, m = "invokeSuspend", n = {"$this$launch", "$this$launch"}, s = {"L$0", "L$0"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ TestScope $this_runTest;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1(TestScope testScope, Continuation<? super TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1> continuation) {
super(2, continuation);
this.$this_runTest = testScope;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1 testBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1 = new TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1(this.$this_runTest, continuation);
testBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1.L$0 = obj;
return testBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
final CoroutineScope coroutineScope;
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
coroutineScope = (CoroutineScope) this.L$0;
} else {
if (i != 1 && i != 2) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
coroutineScope = (CoroutineScope) this.L$0;
ResultKt.throwOnFailure(obj);
}
while (true) {
if (this.$this_runTest.getTestScheduler().tryRunNextTaskUnless$kotlinx_coroutines_test(new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1$executedSomething$1
{
super(0);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
return Boolean.valueOf(!CoroutineScopeKt.isActive(CoroutineScope.this));
}
})) {
this.L$0 = coroutineScope;
this.label = 1;
if (YieldKt.yield(this) == coroutine_suspended) {
break;
}
} else {
TestCoroutineScheduler testScheduler = this.$this_runTest.getTestScheduler();
this.L$0 = coroutineScope;
this.label = 2;
if (testScheduler.receiveDispatchEvent$kotlinx_coroutines_test(this) == coroutine_suspended) {
break;
}
}
}
return coroutine_suspended;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,296 @@
package kotlinx.coroutines.test;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Ref;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1", f = "TestBuilders.kt", i = {0, 0, 0, 1, 1, 1, 2}, l = {337, 363, 368}, m = "invokeSuspend", n = {"timeoutError", "cancellationException", "workRunner", "timeoutError", "cancellationException", "workRunner", "timeoutError"}, s = {"L$0", "L$1", "L$2", "L$0", "L$1", "L$2", "L$0"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTest$2$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ TestScopeImpl $scope;
final /* synthetic */ Function2<TestScope, Continuation<? super Unit>, Object> $testBody;
final /* synthetic */ TestScope $this_runTest;
final /* synthetic */ long $timeout;
private /* synthetic */ Object L$0;
Object L$1;
Object L$2;
int label;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/test/TestScopeImpl;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$1", f = "TestBuilders.kt", i = {0}, l = {318, 319}, m = "invokeSuspend", n = {"$this$start"}, s = {"L$0"})
/* renamed from: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$1, reason: invalid class name */
/* loaded from: classes3.dex */
public static final class AnonymousClass1 extends SuspendLambda implements Function2<TestScopeImpl, Continuation<? super Unit>, Object> {
final /* synthetic */ Function2<TestScope, Continuation<? super Unit>, Object> $testBody;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public AnonymousClass1(Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2, Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
this.$testBody = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
AnonymousClass1 anonymousClass1 = new AnonymousClass1(this.$testBody, continuation);
anonymousClass1.L$0 = obj;
return anonymousClass1;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0040, code lost:
if (r5.invoke(r1, r4) == r0) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0042, code lost:
return r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0032, code lost:
if (kotlinx.coroutines.YieldKt.yield(r4) == r0) goto L15;
*/
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object invokeSuspend(java.lang.Object r5) {
/*
r4 = this;
java.lang.Object r0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r1 = r4.label
r2 = 2
r3 = 1
if (r1 == 0) goto L22
if (r1 == r3) goto L1a
if (r1 != r2) goto L12
kotlin.ResultKt.throwOnFailure(r5)
goto L43
L12:
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
java.lang.String r5 = "call to 'resume' before 'invoke' with coroutine"
r4.<init>(r5)
throw r4
L1a:
java.lang.Object r1 = r4.L$0
kotlinx.coroutines.test.TestScopeImpl r1 = (kotlinx.coroutines.test.TestScopeImpl) r1
kotlin.ResultKt.throwOnFailure(r5)
goto L35
L22:
kotlin.ResultKt.throwOnFailure(r5)
java.lang.Object r5 = r4.L$0
r1 = r5
kotlinx.coroutines.test.TestScopeImpl r1 = (kotlinx.coroutines.test.TestScopeImpl) r1
r4.L$0 = r1
r4.label = r3
java.lang.Object r5 = kotlinx.coroutines.YieldKt.yield(r4)
if (r5 != r0) goto L35
goto L42
L35:
kotlin.jvm.functions.Function2<kotlinx.coroutines.test.TestScope, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> r5 = r4.$testBody
r3 = 0
r4.L$0 = r3
r4.label = r2
java.lang.Object r4 = r5.invoke(r1, r4)
if (r4 != r0) goto L43
L42:
return r0
L43:
kotlin.Unit r4 = kotlin.Unit.INSTANCE
return r4
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1.AnonymousClass1.invokeSuspend(java.lang.Object):java.lang.Object");
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(TestScopeImpl testScopeImpl, Continuation<? super Unit> continuation) {
return ((AnonymousClass1) create(testScopeImpl, continuation)).invokeSuspend(Unit.INSTANCE);
}
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$2", f = "TestBuilders.kt", i = {}, l = {359, 360}, m = "invokeSuspend", n = {}, s = {})
/* renamed from: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$2, reason: invalid class name */
/* loaded from: classes3.dex */
public static final class AnonymousClass2 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ Ref.ObjectRef<CancellationException> $cancellationException;
final /* synthetic */ TestScopeImpl $scope;
final /* synthetic */ long $timeout;
final /* synthetic */ Ref.ObjectRef<Throwable> $timeoutError;
final /* synthetic */ Job $workRunner;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public AnonymousClass2(TestScopeImpl testScopeImpl, Job job, long j4, Ref.ObjectRef<Throwable> objectRef, Ref.ObjectRef<CancellationException> objectRef2, Continuation<? super AnonymousClass2> continuation) {
super(2, continuation);
this.$scope = testScopeImpl;
this.$workRunner = job;
this.$timeout = j4;
this.$timeoutError = objectRef;
this.$cancellationException = objectRef2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
AnonymousClass2 anonymousClass2 = new AnonymousClass2(this.$scope, this.$workRunner, this.$timeout, this.$timeoutError, this.$cancellationException, continuation);
anonymousClass2.L$0 = obj;
return anonymousClass2;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0055, code lost:
if (kotlinx.coroutines.JobKt.cancelAndJoin(r12, r11) == r0) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0057, code lost:
return r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x004a, code lost:
if (r12.join(r11) == r0) goto L15;
*/
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object invokeSuspend(java.lang.Object r12) {
/*
r11 = this;
java.lang.Object r0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r1 = r11.label
r2 = 2
r3 = 1
if (r1 == 0) goto L1e
if (r1 == r3) goto L1a
if (r1 != r2) goto L12
kotlin.ResultKt.throwOnFailure(r12)
goto L58
L12:
java.lang.IllegalStateException r11 = new java.lang.IllegalStateException
java.lang.String r12 = "call to 'resume' before 'invoke' with coroutine"
r11.<init>(r12)
throw r11
L1a:
kotlin.ResultKt.throwOnFailure(r12)
goto L4d
L1e:
kotlin.ResultKt.throwOnFailure(r12)
java.lang.Object r12 = r11.L$0
kotlinx.coroutines.CoroutineScope r12 = (kotlinx.coroutines.CoroutineScope) r12
kotlin.coroutines.CoroutineContext r12 = r12.getCoroutineContext()
kotlinx.coroutines.Job r4 = kotlinx.coroutines.JobKt.getJob(r12)
kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$2$1 r5 = new kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$2$1
kotlinx.coroutines.test.TestScopeImpl r6 = r11.$scope
long r7 = r11.$timeout
kotlin.jvm.internal.Ref$ObjectRef<java.lang.Throwable> r9 = r11.$timeoutError
kotlin.jvm.internal.Ref$ObjectRef<java.util.concurrent.CancellationException> r10 = r11.$cancellationException
r5.<init>()
r8 = 2
r9 = 0
r7 = r5
r5 = 1
r6 = 0
kotlinx.coroutines.Job.DefaultImpls.invokeOnCompletion$default(r4, r5, r6, r7, r8, r9)
kotlinx.coroutines.test.TestScopeImpl r12 = r11.$scope
r11.label = r3
java.lang.Object r12 = r12.join(r11)
if (r12 != r0) goto L4d
goto L57
L4d:
kotlinx.coroutines.Job r12 = r11.$workRunner
r11.label = r2
java.lang.Object r11 = kotlinx.coroutines.JobKt.cancelAndJoin(r12, r11)
if (r11 != r0) goto L58
L57:
return r0
L58:
kotlin.Unit r11 = kotlin.Unit.INSTANCE
return r11
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1.AnonymousClass2.invokeSuspend(java.lang.Object):java.lang.Object");
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((AnonymousClass2) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersKt$runTest$2$1(TestScopeImpl testScopeImpl, long j4, TestScope testScope, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2, Continuation<? super TestBuildersKt__TestBuildersKt$runTest$2$1> continuation) {
super(2, continuation);
this.$scope = testScopeImpl;
this.$timeout = j4;
this.$this_runTest = testScope;
this.$testBody = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersKt$runTest$2$1 testBuildersKt__TestBuildersKt$runTest$2$1 = new TestBuildersKt__TestBuildersKt$runTest$2$1(this.$scope, this.$timeout, this.$this_runTest, this.$testBody, continuation);
testBuildersKt__TestBuildersKt$runTest$2$1.L$0 = obj;
return testBuildersKt__TestBuildersKt$runTest$2$1;
}
/* JADX WARN: Code restructure failed: missing block: B:10:0x0133, code lost:
if (r2 == null) goto L34;
*/
/* JADX WARN: Code restructure failed: missing block: B:11:0x00d2, code lost:
kotlinx.coroutines.test.TestBuildersKt.throwAll(r2, r0);
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0138, code lost:
return kotlin.Unit.INSTANCE;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x00cc, code lost:
r2 = r19.$scope.getCompletionExceptionOrNull();
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x0112, code lost:
if (kotlinx.coroutines.JobKt.cancelAndJoin(r13, r19) != r0) goto L51;
*/
/* JADX WARN: Code restructure failed: missing block: B:42:0x00ca, code lost:
if (r2 == null) goto L34;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:47:0x00ee */
/* JADX WARN: Removed duplicated region for block: B:48:0x00ef */
/* JADX WARN: Type inference failed for: r2v0, types: [int] */
/* JADX WARN: Type inference failed for: r2v10 */
/* JADX WARN: Type inference failed for: r2v25 */
/* JADX WARN: Type inference failed for: r2v29 */
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object invokeSuspend(java.lang.Object r20) {
/*
Method dump skipped, instructions count: 355
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1.invokeSuspend(java.lang.Object):java.lang.Object");
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTest$2$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,115 @@
package kotlinx.coroutines.test;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$3$1", f = "TestBuilders.kt", i = {}, l = {401}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTest$3$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ long $dispatchTimeoutMs;
final /* synthetic */ TestScopeImpl $it;
final /* synthetic */ Function2<TestScope, Continuation<? super Unit>, Object> $testBody;
final /* synthetic */ TestScope $this_runTest;
private /* synthetic */ Object L$0;
int label;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* renamed from: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$3$1$1, reason: invalid class name */
/* loaded from: classes3.dex */
public /* synthetic */ class AnonymousClass1 extends FunctionReferenceImpl implements Function1<TestScopeImpl, Throwable> {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public AnonymousClass1() {
super(1, TestScopeImpl.class, "tryGetCompletionCause", "tryGetCompletionCause()Ljava/lang/Throwable;", 0);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(TestScopeImpl testScopeImpl) {
return testScopeImpl.tryGetCompletionCause();
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersKt$runTest$3$1(TestScopeImpl testScopeImpl, long j4, Function2<? super TestScope, ? super Continuation<? super Unit>, ? extends Object> function2, TestScope testScope, Continuation<? super TestBuildersKt__TestBuildersKt$runTest$3$1> continuation) {
super(2, continuation);
this.$it = testScopeImpl;
this.$dispatchTimeoutMs = j4;
this.$testBody = function2;
this.$this_runTest = testScope;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersKt$runTest$3$1 testBuildersKt__TestBuildersKt$runTest$3$1 = new TestBuildersKt__TestBuildersKt$runTest$3$1(this.$it, this.$dispatchTimeoutMs, this.$testBody, this.$this_runTest, continuation);
testBuildersKt__TestBuildersKt$runTest$3$1.L$0 = obj;
return testBuildersKt__TestBuildersKt$runTest$3$1;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
TestScopeImpl testScopeImpl = this.$it;
Duration.Companion companion = Duration.INSTANCE;
long duration = DurationKt.toDuration(this.$dispatchTimeoutMs, DurationUnit.MILLISECONDS);
AnonymousClass1 anonymousClass1 = AnonymousClass1.INSTANCE;
Function2<TestScope, Continuation<? super Unit>, Object> function2 = this.$testBody;
final TestScope testScope = this.$this_runTest;
final TestScopeImpl testScopeImpl2 = this.$it;
Function0<List<? extends Throwable>> function0 = new Function0<List<? extends Throwable>>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$3$1.2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends Throwable> invoke() {
CoroutineScopeKt.cancel$default(TestScope.this.getBackgroundScope(), null, 1, null);
TestScope.this.getTestScheduler().advanceUntilIdleOr$kotlinx_coroutines_test(new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest.3.1.2.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
return Boolean.FALSE;
}
});
return testScopeImpl2.legacyLeave();
}
};
this.label = 1;
if (TestBuildersKt.m1703runTestCoroutineLegacySYHnMyU(coroutineScope, testScopeImpl, duration, anonymousClass1, function2, function0, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTest$3$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,36 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.jvm.internal.IntCompanionObject;
import kotlinx.coroutines.AbstractCoroutine;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt", f = "TestBuilders.kt", i = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, l = {617, 521, 521}, m = "runTestCoroutineLegacy-SYHnMyU", n = {"$this$runTestCoroutineLegacy_u2dSYHnMyU", "coroutine", "tryGetCompletionCause", "cleanup", "scheduler", "completed", "backgroundWorkRunner", "dispatchTimeout", "$this$runTestCoroutineLegacy_u2dSYHnMyU", "coroutine", "tryGetCompletionCause", "cleanup", "scheduler", "completed", "dispatchTimeout"}, s = {"L$0", "L$1", "L$2", "L$3", "L$4", "L$5", "L$6", "J$0", "L$0", "L$1", "L$2", "L$3", "L$4", "L$5", "J$0"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$1<T extends AbstractCoroutine<? super Unit>> extends ContinuationImpl {
long J$0;
Object L$0;
Object L$1;
Object L$2;
Object L$3;
Object L$4;
Object L$5;
Object L$6;
int label;
/* synthetic */ Object result;
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$1(Continuation<? super TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$1> continuation) {
super(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= IntCompanionObject.MIN_VALUE;
return TestBuildersKt.m1703runTestCoroutineLegacySYHnMyU(null, null, 0L, null, null, null, this);
}
}

View File

@@ -0,0 +1,66 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.AbstractCoroutine;
/* JADX INFO: Add missing generic type declarations: [T] */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00010\u0003*\u0002H\u0002H\u008a@"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2", f = "TestBuilders.kt", i = {}, l = {459}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2<T> extends SuspendLambda implements Function2<T, Continuation<? super Unit>, Object> {
final /* synthetic */ Function2<T, Continuation<? super Unit>, Object> $testBody;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2(Function2<? super T, ? super Continuation<? super Unit>, ? extends Object> function2, Continuation<? super TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2> continuation) {
super(2, continuation);
this.$testBody = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2 testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2 = new TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2(this.$testBody, continuation);
testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2.L$0 = obj;
return testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2;
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Object invoke(Object obj, Continuation<? super Unit> continuation) {
return invoke((AbstractCoroutine) obj, (Continuation) continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
AbstractCoroutine abstractCoroutine = (AbstractCoroutine) this.L$0;
Function2<T, Continuation<? super Unit>, Object> function2 = this.$testBody;
this.label = 1;
if (function2.invoke(abstractCoroutine, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
/* JADX WARN: Incorrect types in method signature: (TT;Lkotlin/coroutines/Continuation<-Lkotlin/Unit;>;)Ljava/lang/Object; */
public final Object invoke(AbstractCoroutine abstractCoroutine, Continuation continuation) {
return ((TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$2) create(abstractCoroutine, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,46 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Ref;
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00010\u0003H\u008a@"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1", f = "TestBuilders.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1 extends SuspendLambda implements Function1<Continuation<? super Unit>, Object> {
final /* synthetic */ Ref.BooleanRef $completed;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1(Ref.BooleanRef booleanRef, Continuation<? super TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1> continuation) {
super(1, continuation);
this.$completed = booleanRef;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Continuation<?> continuation) {
return new TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1(this.$completed, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (this.label != 0) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
this.$completed.element = true;
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function1
public final Object invoke(Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$1) create(continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,41 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
@Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00010\u00032\u0006\u0010\u0004\u001a\u00020\u0001H\u008a@"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;", "it"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2", f = "TestBuilders.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2 extends SuspendLambda implements Function2<Unit, Continuation<? super Unit>, Object> {
int label;
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2(Continuation<? super TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2> continuation) {
super(2, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (this.label != 0) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
return Unit.INSTANCE;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(Unit unit, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$2) create(unit, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,95 @@
package kotlinx.coroutines.test;
import C.w;
import java.util.Iterator;
import java.util.List;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.sequences.SequencesKt;
import kotlin.time.Duration;
import kotlinx.coroutines.AbstractCoroutine;
import u.AbstractC0629f;
/* JADX WARN: Incorrect field signature: TT; */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00010\u0003H\u008a@"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3", f = "TestBuilders.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
@SourceDebugExtension({"SMAP\nTestBuilders.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestBuilders.kt\nkotlinx/coroutines/test/TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3\n+ 2 TestBuilders.kt\nkotlinx/coroutines/test/TestBuildersKt__TestBuildersKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,609:1\n545#2,21:610\n566#2:632\n567#2:635\n1#3:631\n1855#4,2:633\n*S KotlinDebug\n*F\n+ 1 TestBuilders.kt\nkotlinx/coroutines/test/TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3\n*L\n517#1:610,21\n517#1:632\n517#1:635\n517#1:631\n517#1:633,2\n*E\n"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3 extends SuspendLambda implements Function1<Continuation<? super Unit>, Object> {
final /* synthetic */ Function0<List<Throwable>> $cleanup;
final /* synthetic */ AbstractCoroutine $coroutine;
final /* synthetic */ long $dispatchTimeout;
final /* synthetic */ Function1<T, Throwable> $tryGetCompletionCause;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Incorrect types in method signature: (TT;JLkotlin/jvm/functions/Function1<-TT;+Ljava/lang/Throwable;>;Lkotlin/jvm/functions/Function0<+Ljava/util/List<+Ljava/lang/Throwable;>;>;Lkotlin/coroutines/Continuation<-Lkotlinx/coroutines/test/TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3;>;)V */
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3(AbstractCoroutine abstractCoroutine, long j4, Function1 function1, Function0 function0, Continuation continuation) {
super(1, continuation);
this.$coroutine = abstractCoroutine;
this.$dispatchTimeout = j4;
this.$tryGetCompletionCause = function1;
this.$cleanup = function0;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Continuation<?> continuation) {
return new TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3(this.$coroutine, this.$dispatchTimeout, this.$tryGetCompletionCause, this.$cleanup, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
List<Throwable> emptyList;
IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (this.label != 0) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
AbstractCoroutine abstractCoroutine = this.$coroutine;
long j4 = this.$dispatchTimeout;
Function1<T, Throwable> function1 = this.$tryGetCompletionCause;
try {
emptyList = this.$cleanup.invoke();
} catch (UncompletedCoroutinesError unused) {
emptyList = CollectionsKt.emptyList();
}
List list = SequencesKt.toList(SequencesKt.filter(abstractCoroutine.getChildren(), TestBuildersKt__TestBuildersKt$handleTimeout$activeChildren$1.INSTANCE));
Throwable invoke = abstractCoroutine.isCancelled() ? function1.invoke(abstractCoroutine) : null;
String str = "After waiting for " + ((Object) Duration.m1504toStringimpl(j4));
if (invoke == null) {
str = w.n(str, ", the test coroutine is not completing");
}
if (!list.isEmpty()) {
str = str + ", there were active child jobs: " + list;
}
if (invoke != null && list.isEmpty()) {
StringBuilder a2 = AbstractC0629f.a(str);
a2.append(abstractCoroutine.isCompleted() ? ", the test coroutine completed" : ", the test coroutine was not completed");
str = a2.toString();
}
UncompletedCoroutinesError uncompletedCoroutinesError = new UncompletedCoroutinesError(str);
if (invoke != null) {
ExceptionsKt.addSuppressed(uncompletedCoroutinesError, invoke);
}
Iterator<T> it = emptyList.iterator();
while (it.hasNext()) {
ExceptionsKt.addSuppressed(uncompletedCoroutinesError, (Throwable) it.next());
}
throw uncompletedCoroutinesError;
}
@Override // kotlin.jvm.functions.Function1
public final Object invoke(Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$3$3) create(continuation)).invokeSuspend(Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,85 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.YieldKt;
@Metadata(d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u000e\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u00020\u00010\u0003*\u00020\u0004H\u008a@"}, d2 = {"<anonymous>", "", "T", "Lkotlinx/coroutines/AbstractCoroutine;", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1", f = "TestBuilders.kt", i = {0, 1}, l = {499, 503}, m = "invokeSuspend", n = {"$this$launch", "$this$launch"}, s = {"L$0", "L$0"})
/* loaded from: classes3.dex */
public final class TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ TestCoroutineScheduler $scheduler;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1(TestCoroutineScheduler testCoroutineScheduler, Continuation<? super TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1> continuation) {
super(2, continuation);
this.$scheduler = testCoroutineScheduler;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1 testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1 = new TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1(this.$scheduler, continuation);
testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1.L$0 = obj;
return testBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
final CoroutineScope coroutineScope;
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
coroutineScope = (CoroutineScope) this.L$0;
} else {
if (i != 1 && i != 2) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
coroutineScope = (CoroutineScope) this.L$0;
ResultKt.throwOnFailure(obj);
}
while (true) {
if (this.$scheduler.tryRunNextTaskUnless$kotlinx_coroutines_test(new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1$executedSomething$1
{
super(0);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
return Boolean.valueOf(!CoroutineScopeKt.isActive(CoroutineScope.this));
}
})) {
this.L$0 = coroutineScope;
this.label = 1;
if (YieldKt.yield(this) == coroutine_suspended) {
break;
}
} else {
TestCoroutineScheduler testCoroutineScheduler = this.$scheduler;
this.L$0 = coroutineScope;
this.label = 2;
if (testCoroutineScheduler.receiveDispatchEvent$kotlinx_coroutines_test(this) == coroutine_suspended) {
break;
}
}
}
return coroutine_suspended;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((TestBuildersKt__TestBuildersKt$runTestCoroutineLegacy$backgroundWorkRunner$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.jvm.internal.IntCompanionObject;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
@DebugMetadata(c = "kotlinx.coroutines.test.TestCoroutineDispatcher", f = "TestCoroutineDispatcher.kt", i = {0, 0}, l = {72}, m = "pauseDispatcher", n = {"this", "previous"}, s = {"L$0", "Z$0"})
/* loaded from: classes3.dex */
public final class TestCoroutineDispatcher$pauseDispatcher$1 extends ContinuationImpl {
Object L$0;
boolean Z$0;
int label;
/* synthetic */ Object result;
final /* synthetic */ TestCoroutineDispatcher this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestCoroutineDispatcher$pauseDispatcher$1(TestCoroutineDispatcher testCoroutineDispatcher, Continuation<? super TestCoroutineDispatcher$pauseDispatcher$1> continuation) {
super(continuation);
this.this$0 = testCoroutineDispatcher;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= IntCompanionObject.MIN_VALUE;
return this.this$0.pauseDispatcher(null, this);
}
}

View File

@@ -0,0 +1,195 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.test.SchedulerAsDelayController;
@Deprecated(level = DeprecationLevel.WARNING, message = "The execution order of `TestCoroutineDispatcher` can be confusing, and the mechanism of pausing is typically misunderstood. Please use `StandardTestDispatcher` or `UnconfinedTestDispatcher` instead.")
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0007\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u000f\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u001c\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0016J\u001c\u0010\u0015\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0016J\b\u0010\u0016\u001a\u00020\u000fH\u0017J,\u0010\u0016\u001a\u00020\u000f2\u001c\u0010\u0012\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000f0\u0018\u0012\u0006\u0012\u0004\u0018\u00010\u00190\u0017H\u0097@¢\u0006\u0002\u0010\u001aJ\u001c\u0010\u001b\u001a\u00020\u001c2\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u00142\u0006\u0010\u0010\u001a\u00020\u0011H\u0002J\b\u0010\u001d\u001a\u00020\u000fH\u0017J\b\u0010\u001e\u001a\u00020\u001fH\u0016R\u001e\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\b@BX\u0082\u000e¢\u0006\b\n\u0000\"\u0004\b\n\u0010\u000bR\u0014\u0010\u0004\u001a\u00020\u0005X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\\u0006 "}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineDispatcher;", "Lkotlinx/coroutines/test/TestDispatcher;", "Lkotlinx/coroutines/Delay;", "Lkotlinx/coroutines/test/SchedulerAsDelayController;", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "(Lkotlinx/coroutines/test/TestCoroutineScheduler;)V", "value", "", "dispatchImmediately", "setDispatchImmediately", "(Z)V", "getScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchYield", "pauseDispatcher", "Lkotlin/Function1;", "Lkotlin/coroutines/Continuation;", "", "(Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "post", "Lkotlinx/coroutines/DisposableHandle;", "resumeDispatcher", "toString", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestCoroutineDispatcher extends TestDispatcher implements Delay, SchedulerAsDelayController {
private boolean dispatchImmediately;
private final TestCoroutineScheduler scheduler;
/* JADX WARN: Multi-variable type inference failed */
public TestCoroutineDispatcher() {
this(null, 1, 0 == true ? 1 : 0);
}
private final DisposableHandle post(Runnable block, CoroutineContext context) {
return getScheduler().registerEvent$kotlinx_coroutines_test(this, 0L, block, context, new Function1<Runnable, Boolean>() { // from class: kotlinx.coroutines.test.TestCoroutineDispatcher$post$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Runnable runnable) {
return Boolean.FALSE;
}
});
}
private final void setDispatchImmediately(boolean z3) {
this.dispatchImmediately = z3;
if (z3) {
getScheduler().advanceUntilIdle();
}
}
@Override // kotlinx.coroutines.test.SchedulerAsDelayController, kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.apply { advanceTimeBy(delayTimeMillis); runCurrent() }", imports = {}))
public long advanceTimeBy(long j4) {
return SchedulerAsDelayController.DefaultImpls.advanceTimeBy(this, j4);
}
@Override // kotlinx.coroutines.test.SchedulerAsDelayController, kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.advanceUntilIdle()", imports = {}))
public long advanceUntilIdle() {
return SchedulerAsDelayController.DefaultImpls.advanceUntilIdle(this);
}
@Override // kotlinx.coroutines.test.SchedulerAsDelayController, kotlinx.coroutines.test.DelayController
@ExperimentalCoroutinesApi
public void cleanupTestCoroutines() {
SchedulerAsDelayController.DefaultImpls.cleanupTestCoroutines(this);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo1685dispatch(CoroutineContext context, Runnable block) {
TestCoroutineSchedulerKt.checkSchedulerInContext(getScheduler(), context);
if (!this.dispatchImmediately) {
post(block, context);
} else {
getScheduler().sendDispatchEvent$kotlinx_coroutines_test(context);
block.run();
}
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public void dispatchYield(CoroutineContext context, Runnable block) {
TestCoroutineSchedulerKt.checkSchedulerInContext(getScheduler(), context);
post(block, context);
}
@Override // kotlinx.coroutines.test.SchedulerAsDelayController, kotlinx.coroutines.test.DelayController
public long getCurrentTime() {
return SchedulerAsDelayController.DefaultImpls.getCurrentTime(this);
}
@Override // kotlinx.coroutines.test.TestDispatcher
public TestCoroutineScheduler getScheduler() {
return this.scheduler;
}
/* JADX WARN: Removed duplicated region for block: B:23:0x003f */
/* JADX WARN: Removed duplicated region for block: B:8:0x0023 */
@Override // kotlinx.coroutines.test.DelayController
@kotlin.Deprecated(level = kotlin.DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public java.lang.Object pauseDispatcher(kotlin.jvm.functions.Function1<? super kotlin.coroutines.Continuation<? super kotlin.Unit>, ? extends java.lang.Object> r6, kotlin.coroutines.Continuation<? super kotlin.Unit> r7) {
/*
r5 = this;
boolean r0 = r7 instanceof kotlinx.coroutines.test.TestCoroutineDispatcher$pauseDispatcher$1
if (r0 == 0) goto L13
r0 = r7
kotlinx.coroutines.test.TestCoroutineDispatcher$pauseDispatcher$1 r0 = (kotlinx.coroutines.test.TestCoroutineDispatcher$pauseDispatcher$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1 & r2
if (r3 == 0) goto L13
int r1 = r1 - r2
r0.label = r1
goto L18
L13:
kotlinx.coroutines.test.TestCoroutineDispatcher$pauseDispatcher$1 r0 = new kotlinx.coroutines.test.TestCoroutineDispatcher$pauseDispatcher$1
r0.<init>(r5, r7)
L18:
java.lang.Object r7 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 1
if (r2 == 0) goto L3f
if (r2 != r3) goto L37
boolean r5 = r0.Z$0
java.lang.Object r6 = r0.L$0
kotlinx.coroutines.test.TestCoroutineDispatcher r6 = (kotlinx.coroutines.test.TestCoroutineDispatcher) r6
kotlin.ResultKt.throwOnFailure(r7) // Catch: java.lang.Throwable -> L31
r7 = r5
r5 = r6
goto L55
L31:
r7 = move-exception
r4 = r7
r7 = r5
r5 = r6
r6 = r4
goto L5c
L37:
java.lang.IllegalStateException r5 = new java.lang.IllegalStateException
java.lang.String r6 = "call to 'resume' before 'invoke' with coroutine"
r5.<init>(r6)
throw r5
L3f:
kotlin.ResultKt.throwOnFailure(r7)
boolean r7 = r5.dispatchImmediately
r2 = 0
r5.setDispatchImmediately(r2)
r0.L$0 = r5 // Catch: java.lang.Throwable -> L5b
r0.Z$0 = r7 // Catch: java.lang.Throwable -> L5b
r0.label = r3 // Catch: java.lang.Throwable -> L5b
java.lang.Object r6 = r6.invoke(r0) // Catch: java.lang.Throwable -> L5b
if (r6 != r1) goto L55
return r1
L55:
r5.setDispatchImmediately(r7)
kotlin.Unit r5 = kotlin.Unit.INSTANCE
return r5
L5b:
r6 = move-exception
L5c:
r5.setDispatchImmediately(r7)
throw r6
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.test.TestCoroutineDispatcher.pauseDispatcher(kotlin.jvm.functions.Function1, kotlin.coroutines.Continuation):java.lang.Object");
}
@Override // kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
public void resumeDispatcher() {
setDispatchImmediately(true);
}
@Override // kotlinx.coroutines.test.SchedulerAsDelayController, kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "This function delegates to the test scheduler, which may cause confusing behavior unless made explicit.", replaceWith = @ReplaceWith(expression = "this.scheduler.runCurrent()", imports = {}))
public void runCurrent() {
SchedulerAsDelayController.DefaultImpls.runCurrent(this);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public String toString() {
return "TestCoroutineDispatcher[scheduler=" + getScheduler() + ']';
}
public /* synthetic */ TestCoroutineDispatcher(TestCoroutineScheduler testCoroutineScheduler, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? new TestCoroutineScheduler() : testCoroutineScheduler);
}
public TestCoroutineDispatcher(TestCoroutineScheduler testCoroutineScheduler) {
this.scheduler = testCoroutineScheduler;
this.dispatchImmediately = true;
}
@Override // kotlinx.coroutines.test.DelayController
@Deprecated(level = DeprecationLevel.ERROR, message = "Please use a dispatcher that is paused by default, like `StandardTestDispatcher`.")
public void pauseDispatcher() {
setDispatchImmediately(false);
}
}

View File

@@ -0,0 +1,45 @@
package kotlinx.coroutines.test;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import kotlin.Metadata;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.test.internal.TestMainDispatcher;
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\u001a\u001e\u0010\u0000\u001a\u00020\u00012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u001a \u0010\u0006\u001a\u00020\u00012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005H\u0007¨\u0006\u0007"}, d2 = {"StandardTestDispatcher", "Lkotlinx/coroutines/test/TestDispatcher;", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "UnconfinedTestDispatcher", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestCoroutineDispatchersKt {
public static final TestDispatcher StandardTestDispatcher(TestCoroutineScheduler testCoroutineScheduler, String str) {
if (testCoroutineScheduler == null && (testCoroutineScheduler = TestMainDispatcher.INSTANCE.getCurrentTestScheduler$kotlinx_coroutines_test()) == null) {
testCoroutineScheduler = new TestCoroutineScheduler();
}
return new StandardTestDispatcherImpl(testCoroutineScheduler, str);
}
public static /* synthetic */ TestDispatcher StandardTestDispatcher$default(TestCoroutineScheduler testCoroutineScheduler, String str, int i, Object obj) {
if ((i & 1) != 0) {
testCoroutineScheduler = null;
}
if ((i & 2) != 0) {
str = null;
}
return StandardTestDispatcher(testCoroutineScheduler, str);
}
@ExperimentalCoroutinesApi
public static final TestDispatcher UnconfinedTestDispatcher(TestCoroutineScheduler testCoroutineScheduler, String str) {
if (testCoroutineScheduler == null && (testCoroutineScheduler = TestMainDispatcher.INSTANCE.getCurrentTestScheduler$kotlinx_coroutines_test()) == null) {
testCoroutineScheduler = new TestCoroutineScheduler();
}
return new UnconfinedTestDispatcherImpl(testCoroutineScheduler, str);
}
public static /* synthetic */ TestDispatcher UnconfinedTestDispatcher$default(TestCoroutineScheduler testCoroutineScheduler, String str, int i, Object obj) {
if ((i & 1) != 0) {
testCoroutineScheduler = null;
}
if ((i & 2) != 0) {
str = null;
}
return UnconfinedTestDispatcher(testCoroutineScheduler, str);
}
}

View File

@@ -0,0 +1,74 @@
package kotlinx.coroutines.test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.internal.CoroutineExceptionHandlerImpl_commonKt;
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated for removal without a replacement. It may be to define one's own `CoroutineExceptionHandler` if you just need to handle 'uncaught exceptions without a special `TestCoroutineScope` integration.")
@Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010!\n\u0002\u0010\u0003\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u0005¢\u0006\u0002\u0010\u0004J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\u0018\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\tH\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\t0\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0012\u0010\n\u001a\u00060\u000bj\u0002`\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\r\u001a\b\u0012\u0004\u0012\u00020\t0\u000e8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010¨\u0006\u0017"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineExceptionHandler;", "Lkotlin/coroutines/AbstractCoroutineContextElement;", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "Lkotlinx/coroutines/test/UncaughtExceptionCaptor;", "()V", "_coroutinesCleanedUp", "", "_exceptions", "", "", "_lock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "uncaughtExceptions", "", "getUncaughtExceptions", "()Ljava/util/List;", "cleanupTestCoroutines", "", "handleException", "context", "Lkotlin/coroutines/CoroutineContext;", "exception", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestCoroutineExceptionHandler.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestCoroutineExceptionHandler.kt\nkotlinx/coroutines/test/TestCoroutineExceptionHandler\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,81:1\n28#2,4:82\n28#2,4:87\n28#2,4:92\n20#3:86\n20#3:91\n20#3:96\n1855#4,2:97\n*S KotlinDebug\n*F\n+ 1 TestCoroutineExceptionHandler.kt\nkotlinx/coroutines/test/TestCoroutineExceptionHandler\n*L\n60#1:82,4\n69#1:87,4\n72#1:92,4\n60#1:86\n69#1:91\n72#1:96\n76#1:97,2\n*E\n"})
/* loaded from: classes3.dex */
public final class TestCoroutineExceptionHandler extends AbstractCoroutineContextElement implements CoroutineExceptionHandler, UncaughtExceptionCaptor {
private boolean _coroutinesCleanedUp;
private final List<Throwable> _exceptions;
private final Object _lock;
public TestCoroutineExceptionHandler() {
super(CoroutineExceptionHandler.INSTANCE);
this._exceptions = new ArrayList();
this._lock = new Object();
}
@Override // kotlinx.coroutines.test.UncaughtExceptionCaptor
public void cleanupTestCoroutines() {
synchronized (this._lock) {
try {
this._coroutinesCleanedUp = true;
Throwable th = (Throwable) CollectionsKt.firstOrNull((List) this._exceptions);
if (th != null) {
Iterator it = CollectionsKt.drop(this._exceptions, 1).iterator();
while (it.hasNext()) {
((Throwable) it.next()).printStackTrace();
}
throw th;
}
} catch (Throwable th2) {
throw th2;
}
}
}
@Override // kotlinx.coroutines.test.UncaughtExceptionCaptor
public List<Throwable> getUncaughtExceptions() {
List<Throwable> list;
synchronized (this._lock) {
list = CollectionsKt.toList(this._exceptions);
}
return list;
}
@Override // kotlinx.coroutines.CoroutineExceptionHandler
public void handleException(CoroutineContext context, Throwable exception) {
synchronized (this._lock) {
try {
if (this._coroutinesCleanedUp) {
CoroutineExceptionHandlerImpl_commonKt.handleUncaughtCoroutineException(context, exception);
}
this._exceptions.add(exception);
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,307 @@
package kotlinx.coroutines.test;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import kotlin.KotlinNothingValueException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.PropertyReference1Impl;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.time.AbstractLongTimeSource;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import kotlin.time.ExperimentalTime;
import kotlin.time.TimeSource;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.channels.Channel;
import kotlinx.coroutines.channels.ChannelKt;
import kotlinx.coroutines.internal.ThreadSafeHeap;
import kotlinx.coroutines.selects.SelectClause1;
@Metadata(d1 = {"\u0000\u0080\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u0000 E2\u00020\u00012\u00020\u0002:\u0001EB\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010!\u001a\u00020\u000e2\u0006\u0010\"\u001a\u00020\u0007H\u0007J\u0018\u0010!\u001a\u00020\u000e2\u0006\u0010#\u001a\u00020$ø\u0001\u0000¢\u0006\u0004\b%\u0010&J\u0006\u0010'\u001a\u00020\u000eJ\u001b\u0010(\u001a\u00020\u000e2\f\u0010)\u001a\b\u0012\u0004\u0012\u00020+0*H\u0000¢\u0006\u0002\b,J\u0017\u0010-\u001a\u00020+2\b\b\u0002\u0010.\u001a\u00020+H\u0000¢\u0006\u0002\b/J\u0010\u00100\u001a\u00020\u000eH\u0080@¢\u0006\u0004\b1\u00102JM\u00103\u001a\u000204\"\b\b\u0000\u00105*\u00020\u00132\u0006\u00106\u001a\u0002072\u0006\u00108\u001a\u00020\u00072\u0006\u00109\u001a\u0002H52\u0006\u0010:\u001a\u00020;2\u0012\u0010<\u001a\u000e\u0012\u0004\u0012\u0002H5\u0012\u0004\u0012\u00020+0=H\u0000¢\u0006\u0004\b>\u0010?J\u0006\u0010@\u001a\u00020\u000eJ\u0015\u0010A\u001a\u00020\u000e2\u0006\u0010:\u001a\u00020;H\u0000¢\u0006\u0002\bBJ\u001b\u0010C\u001a\u00020+2\f\u0010)\u001a\b\u0012\u0004\u0012\u00020+0*H\u0000¢\u0006\u0002\bDR\t\u0010\u0004\u001a\u00020\u0005X\u0082\u0004R&\u0010\b\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u00078F@BX\u0087\u000e¢\u0006\u000e\n\u0000\u0012\u0004\b\t\u0010\u0003\u001a\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0010\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00130\u00120\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u0012\u0010\u0014\u001a\u00060\u0013j\u0002`\u0015X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0016\u001a\b\u0012\u0004\u0012\u00020\u000e0\u00178@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0018\u0010\u0019R\u001a\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\u000e0\u00178@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u001b\u0010\u0019R\u001c\u0010\u001c\u001a\u00020\u001d8\u0006X\u0087\u0004¢\u0006\u000e\n\u0000\u0012\u0004\b\u001e\u0010\u0003\u001a\u0004\b\u001f\u0010 \u0082\u0002\u0007\n\u0005\\u001e0\u0001¨\u0006F"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineScheduler;", "Lkotlin/coroutines/AbstractCoroutineContextElement;", "Lkotlin/coroutines/CoroutineContext$Element;", "()V", "count", "Lkotlinx/atomicfu/AtomicLong;", "<set-?>", "", "currentTime", "getCurrentTime$annotations", "getCurrentTime", "()J", "dispatchEvents", "Lkotlinx/coroutines/channels/Channel;", "", "dispatchEventsForeground", "events", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "Lkotlinx/coroutines/test/TestDispatchEvent;", "", "lock", "Lkotlinx/coroutines/internal/SynchronizedObject;", "onDispatchEvent", "Lkotlinx/coroutines/selects/SelectClause1;", "getOnDispatchEvent$kotlinx_coroutines_test", "()Lkotlinx/coroutines/selects/SelectClause1;", "onDispatchEventForeground", "getOnDispatchEventForeground$kotlinx_coroutines_test", "timeSource", "Lkotlin/time/TimeSource$WithComparableMarks;", "getTimeSource$annotations", "getTimeSource", "()Lkotlin/time/TimeSource$WithComparableMarks;", "advanceTimeBy", "delayTimeMillis", "delayTime", "Lkotlin/time/Duration;", "advanceTimeBy-LRDsOJo", "(J)V", "advanceUntilIdle", "advanceUntilIdleOr", "condition", "Lkotlin/Function0;", "", "advanceUntilIdleOr$kotlinx_coroutines_test", "isIdle", "strict", "isIdle$kotlinx_coroutines_test", "receiveDispatchEvent", "receiveDispatchEvent$kotlinx_coroutines_test", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "registerEvent", "Lkotlinx/coroutines/DisposableHandle;", "T", "dispatcher", "Lkotlinx/coroutines/test/TestDispatcher;", "timeDeltaMillis", "marker", "context", "Lkotlin/coroutines/CoroutineContext;", "isCancelled", "Lkotlin/Function1;", "registerEvent$kotlinx_coroutines_test", "(Lkotlinx/coroutines/test/TestDispatcher;JLjava/lang/Object;Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/DisposableHandle;", "runCurrent", "sendDispatchEvent", "sendDispatchEvent$kotlinx_coroutines_test", "tryRunNextTaskUnless", "tryRunNextTaskUnless$kotlinx_coroutines_test", "Key", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestCoroutineScheduler.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestCoroutineScheduler.kt\nkotlinx/coroutines/test/TestCoroutineScheduler\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 5 ThreadSafeHeap.kt\nkotlinx/coroutines/internal/ThreadSafeHeap\n*L\n1#1,282:1\n28#2,4:283\n28#2,4:289\n28#2,4:294\n28#2,4:299\n28#2,4:304\n28#2,4:310\n28#2,4:322\n28#2,4:328\n28#2,4:340\n28#2,4:345\n20#3:287\n20#3:293\n20#3:298\n20#3:303\n20#3:308\n20#3:314\n20#3:326\n20#3:332\n20#3:344\n20#3:349\n1#4:288\n60#5:309\n61#5,7:315\n60#5:327\n61#5,7:333\n*S KotlinDebug\n*F\n+ 1 TestCoroutineScheduler.kt\nkotlinx/coroutines/test/TestCoroutineScheduler\n*L\n49#1:283,4\n75#1:289,4\n95#1:294,4\n131#1:299,4\n133#1:304,4\n134#1:310,4\n170#1:322,4\n172#1:328,4\n193#1:340,4\n83#1:345,4\n49#1:287\n75#1:293\n95#1:298\n131#1:303\n133#1:308\n134#1:314\n170#1:326\n172#1:332\n193#1:344\n83#1:349\n134#1:309\n134#1:315,7\n172#1:327\n172#1:333,7\n*E\n"})
/* loaded from: classes3.dex */
public final class TestCoroutineScheduler extends AbstractCoroutineContextElement implements CoroutineContext.Element {
/* renamed from: Key, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final /* synthetic */ AtomicLongFieldUpdater count$volatile$FU = AtomicLongFieldUpdater.newUpdater(TestCoroutineScheduler.class, "count$volatile");
private volatile /* synthetic */ long count$volatile;
private long currentTime;
private final Channel<Unit> dispatchEvents;
private final Channel<Unit> dispatchEventsForeground;
private final ThreadSafeHeap<TestDispatchEvent<Object>> events;
private final Object lock;
private final TimeSource.WithComparableMarks timeSource;
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineScheduler$Key;", "Lkotlin/coroutines/CoroutineContext$Key;", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "()V", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* renamed from: kotlinx.coroutines.test.TestCoroutineScheduler$Key, reason: from kotlin metadata */
/* loaded from: classes3.dex */
public static final class Companion implements CoroutineContext.Key<TestCoroutineScheduler> {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public TestCoroutineScheduler() {
super(INSTANCE);
this.events = new ThreadSafeHeap<>();
this.lock = new Object();
this.dispatchEventsForeground = ChannelKt.Channel$default(-1, null, null, 6, null);
this.dispatchEvents = ChannelKt.Channel$default(-1, null, null, 6, null);
final DurationUnit durationUnit = DurationUnit.MILLISECONDS;
this.timeSource = new AbstractLongTimeSource(durationUnit) { // from class: kotlinx.coroutines.test.TestCoroutineScheduler$timeSource$1
@Override // kotlin.time.AbstractLongTimeSource
public long read() {
return TestCoroutineScheduler.this.getCurrentTime();
}
};
}
private final /* synthetic */ long getCount$volatile() {
return this.count$volatile;
}
@ExperimentalCoroutinesApi
public static /* synthetic */ void getCurrentTime$annotations() {
}
@ExperimentalTime
public static /* synthetic */ void getTimeSource$annotations() {
}
public static /* synthetic */ boolean isIdle$kotlinx_coroutines_test$default(TestCoroutineScheduler testCoroutineScheduler, boolean z3, int i, Object obj) {
if ((i & 1) != 0) {
z3 = true;
}
return testCoroutineScheduler.isIdle$kotlinx_coroutines_test(z3);
}
/* JADX INFO: Access modifiers changed from: private */
public static final void registerEvent$lambda$4$lambda$3(TestCoroutineScheduler testCoroutineScheduler, TestDispatchEvent testDispatchEvent) {
synchronized (testCoroutineScheduler.lock) {
testCoroutineScheduler.events.remove(testDispatchEvent);
Unit unit = Unit.INSTANCE;
}
}
private final /* synthetic */ void setCount$volatile(long j4) {
this.count$volatile = j4;
}
@ExperimentalCoroutinesApi
public final void advanceTimeBy(long delayTimeMillis) {
Duration.Companion companion = Duration.INSTANCE;
m1711advanceTimeByLRDsOJo(DurationKt.toDuration(delayTimeMillis, DurationUnit.MILLISECONDS));
}
/* renamed from: advanceTimeBy-LRDsOJo, reason: not valid java name */
public final void m1711advanceTimeByLRDsOJo(long delayTime) {
long addClamping;
TestDispatchEvent<Object> testDispatchEvent;
TestDispatchEvent<Object> testDispatchEvent2;
if (Duration.m1488isNegativeimpl(delayTime)) {
throw new IllegalArgumentException(("Can not advance time by a negative delay: " + ((Object) Duration.m1504toStringimpl(delayTime))).toString());
}
addClamping = TestCoroutineSchedulerKt.addClamping(getCurrentTime(), Duration.m1473getInWholeMillisecondsimpl(delayTime));
while (true) {
synchronized (this.lock) {
long currentTime = getCurrentTime();
ThreadSafeHeap<TestDispatchEvent<Object>> threadSafeHeap = this.events;
synchronized (threadSafeHeap) {
TestDispatchEvent<Object> firstImpl = threadSafeHeap.firstImpl();
if (firstImpl != null) {
testDispatchEvent = addClamping > firstImpl.time ? threadSafeHeap.removeAtImpl(0) : null;
}
}
testDispatchEvent2 = testDispatchEvent;
if (testDispatchEvent2 == null) {
this.currentTime = addClamping;
return;
}
long j4 = testDispatchEvent2.time;
if (currentTime > j4) {
TestCoroutineSchedulerKt.currentTimeAheadOfEvents();
throw new KotlinNothingValueException();
}
this.currentTime = j4;
}
testDispatchEvent2.dispatcher.processEvent$kotlinx_coroutines_test(testDispatchEvent2.marker);
}
}
public final void advanceUntilIdle() {
advanceUntilIdleOr$kotlinx_coroutines_test(new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestCoroutineScheduler$advanceUntilIdle$1
{
super(0);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
ThreadSafeHeap threadSafeHeap;
boolean none;
threadSafeHeap = TestCoroutineScheduler.this.events;
none = TestCoroutineSchedulerKt.none(threadSafeHeap, new PropertyReference1Impl() { // from class: kotlinx.coroutines.test.TestCoroutineScheduler$advanceUntilIdle$1.1
@Override // kotlin.jvm.internal.PropertyReference1Impl, kotlin.reflect.KProperty1
public Object get(Object obj) {
return Boolean.valueOf(((TestDispatchEvent) obj).isForeground);
}
});
return Boolean.valueOf(none);
}
});
}
public final void advanceUntilIdleOr$kotlinx_coroutines_test(Function0<Boolean> condition) {
do {
} while (tryRunNextTaskUnless$kotlinx_coroutines_test(condition));
}
public final long getCurrentTime() {
long j4;
synchronized (this.lock) {
j4 = this.currentTime;
}
return j4;
}
public final SelectClause1<Unit> getOnDispatchEvent$kotlinx_coroutines_test() {
return this.dispatchEvents.getOnReceive();
}
public final SelectClause1<Unit> getOnDispatchEventForeground$kotlinx_coroutines_test() {
return this.dispatchEventsForeground.getOnReceive();
}
public final TimeSource.WithComparableMarks getTimeSource() {
return this.timeSource;
}
public final boolean isIdle$kotlinx_coroutines_test(boolean strict) {
boolean isEmpty;
synchronized (this.lock) {
try {
isEmpty = strict ? this.events.isEmpty() : TestCoroutineSchedulerKt.none(this.events, new Function1<TestDispatchEvent<Object>, Boolean>() { // from class: kotlinx.coroutines.test.TestCoroutineScheduler$isIdle$1$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(TestDispatchEvent<Object> testDispatchEvent) {
return Boolean.valueOf(!testDispatchEvent.isCancelled.invoke().booleanValue());
}
});
} catch (Throwable th) {
throw th;
}
}
return isEmpty;
}
public final Object receiveDispatchEvent$kotlinx_coroutines_test(Continuation<? super Unit> continuation) {
Object receive = this.dispatchEvents.receive(continuation);
return receive == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? receive : Unit.INSTANCE;
}
public final <T> DisposableHandle registerEvent$kotlinx_coroutines_test(TestDispatcher dispatcher, long timeDeltaMillis, final T marker, CoroutineContext context, final Function1<? super T, Boolean> isCancelled) {
long addClamping;
DisposableHandle disposableHandle;
if (timeDeltaMillis < 0) {
throw new IllegalArgumentException(("Attempted scheduling an event earlier in time (with the time delta " + timeDeltaMillis + ')').toString());
}
TestCoroutineSchedulerKt.checkSchedulerInContext(this, context);
long andIncrement = count$volatile$FU.getAndIncrement(this);
boolean z3 = context.get(BackgroundWork.INSTANCE) == null;
synchronized (this.lock) {
addClamping = TestCoroutineSchedulerKt.addClamping(getCurrentTime(), timeDeltaMillis);
Intrinsics.checkNotNull(marker, "null cannot be cast to non-null type kotlin.Any");
final TestDispatchEvent<Object> testDispatchEvent = new TestDispatchEvent<>(dispatcher, andIncrement, addClamping, marker, z3, new Function0<Boolean>() { // from class: kotlinx.coroutines.test.TestCoroutineScheduler$registerEvent$2$event$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(0);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Boolean invoke() {
return isCancelled.invoke(marker);
}
});
this.events.addLast(testDispatchEvent);
sendDispatchEvent$kotlinx_coroutines_test(context);
disposableHandle = new DisposableHandle() { // from class: kotlinx.coroutines.test.a
@Override // kotlinx.coroutines.DisposableHandle
public final void dispose() {
TestCoroutineScheduler.registerEvent$lambda$4$lambda$3(TestCoroutineScheduler.this, testDispatchEvent);
}
};
}
return disposableHandle;
}
public final void runCurrent() {
long currentTime;
TestDispatchEvent<Object> testDispatchEvent;
TestDispatchEvent<Object> testDispatchEvent2;
synchronized (this.lock) {
currentTime = getCurrentTime();
}
while (true) {
synchronized (this.lock) {
ThreadSafeHeap<TestDispatchEvent<Object>> threadSafeHeap = this.events;
synchronized (threadSafeHeap) {
TestDispatchEvent<Object> firstImpl = threadSafeHeap.firstImpl();
if (firstImpl != null) {
testDispatchEvent = firstImpl.time <= currentTime ? threadSafeHeap.removeAtImpl(0) : null;
}
}
testDispatchEvent2 = testDispatchEvent;
if (testDispatchEvent2 == null) {
return;
}
}
testDispatchEvent2.dispatcher.processEvent$kotlinx_coroutines_test(testDispatchEvent2.marker);
}
}
public final void sendDispatchEvent$kotlinx_coroutines_test(CoroutineContext context) {
Channel<Unit> channel = this.dispatchEvents;
Unit unit = Unit.INSTANCE;
channel.mo1630trySendJP2dKIU(unit);
BackgroundWork backgroundWork = BackgroundWork.INSTANCE;
if (context.get(backgroundWork) != backgroundWork) {
this.dispatchEventsForeground.mo1630trySendJP2dKIU(unit);
}
}
public final boolean tryRunNextTaskUnless$kotlinx_coroutines_test(Function0<Boolean> condition) {
synchronized (this.lock) {
if (condition.invoke().booleanValue()) {
return false;
}
TestDispatchEvent<Object> removeFirstOrNull = this.events.removeFirstOrNull();
if (removeFirstOrNull == null) {
return false;
}
long currentTime = getCurrentTime();
long j4 = removeFirstOrNull.time;
if (currentTime > j4) {
TestCoroutineSchedulerKt.currentTimeAheadOfEvents();
throw new KotlinNothingValueException();
}
this.currentTime = j4;
removeFirstOrNull.dispatcher.processEvent$kotlinx_coroutines_test(removeFirstOrNull.marker);
return true;
}
}
}

View File

@@ -0,0 +1,43 @@
package kotlinx.coroutines.test;
import kotlin.KotlinNothingValueException;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.LongCompanionObject;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.internal.ThreadSafeHeap;
import kotlinx.coroutines.internal.ThreadSafeHeapNode;
@Metadata(d1 = {"\u0000>\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0001\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0018\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0001H\u0002\u001a\u0018\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0000\u001a\b\u0010\n\u001a\u00020\u000bH\u0002\u001a\b\u0010\f\u001a\u00020\u000bH\u0002\u001a:\u0010\r\u001a\u00020\u000e\"\u0012\b\u0000\u0010\u000f*\u00020\u0010*\b\u0012\u0004\u0012\u0002H\u000f0\u0011*\b\u0012\u0004\u0012\u0002H\u000f0\u00122\u0012\u0010\u0013\u001a\u000e\u0012\u0004\u0012\u0002H\u000f\u0012\u0004\u0012\u00020\u000e0\u0014H\u0002¨\u0006\u0015"}, d2 = {"addClamping", "", "a", "b", "checkSchedulerInContext", "", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "context", "Lkotlin/coroutines/CoroutineContext;", "currentTimeAheadOfEvents", "", "invalidSchedulerState", "none", "", "T", "Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "predicate", "Lkotlin/Function1;", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestCoroutineScheduler.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestCoroutineScheduler.kt\nkotlinx/coroutines/test/TestCoroutineSchedulerKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,282:1\n1#2:283\n*E\n"})
/* loaded from: classes3.dex */
public final class TestCoroutineSchedulerKt {
/* JADX INFO: Access modifiers changed from: private */
public static final long addClamping(long j4, long j5) {
long j6 = j4 + j5;
return j6 >= 0 ? j6 : LongCompanionObject.MAX_VALUE;
}
public static final void checkSchedulerInContext(TestCoroutineScheduler testCoroutineScheduler, CoroutineContext coroutineContext) {
TestCoroutineScheduler testCoroutineScheduler2 = (TestCoroutineScheduler) coroutineContext.get(TestCoroutineScheduler.Key);
if (testCoroutineScheduler2 != null && testCoroutineScheduler2 != testCoroutineScheduler) {
throw new IllegalStateException("Detected use of different schedulers. If you need to use several test coroutine dispatchers, create one `TestCoroutineScheduler` and pass it to each of them.");
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final Void currentTimeAheadOfEvents() {
invalidSchedulerState();
throw new KotlinNothingValueException();
}
private static final Void invalidSchedulerState() {
throw new IllegalStateException("The test scheduler entered an invalid state. Please report this at https://github.com/Kotlin/kotlinx.coroutines/issues.");
}
/* JADX INFO: Access modifiers changed from: private */
public static final <T extends ThreadSafeHeapNode & Comparable<? super T>> boolean none(ThreadSafeHeap<T> threadSafeHeap, Function1<? super T, Boolean> function1) {
return threadSafeHeap.find(function1) == null;
}
}

View File

@@ -0,0 +1,29 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Deprecated(level = DeprecationLevel.WARNING, message = "Use `TestScope` in combination with `runTest` instead.Please see the migration guide for details: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md")
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\bg\u0018\u00002\u00020\u0001J\b\u0010\b\u001a\u00020\tH'R\u001a\u0010\u0002\u001a\u00020\u00038&X§\u0004¢\u0006\f\u0012\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007¨\u0006\n"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineScope;", "Lkotlinx/coroutines/CoroutineScope;", "testScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getTestScheduler$annotations", "()V", "getTestScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "cleanupTestCoroutines", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@ExperimentalCoroutinesApi
/* loaded from: classes3.dex */
public interface TestCoroutineScope extends CoroutineScope {
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DefaultImpls {
@ExperimentalCoroutinesApi
public static /* synthetic */ void getTestScheduler$annotations() {
}
}
@Deprecated(message = "Please call `runTest`, which automatically performs the cleanup, instead of using this function.")
@ExperimentalCoroutinesApi
/* renamed from: cleanupTestCoroutines */
void mo1698cleanupTestCoroutines();
TestCoroutineScheduler getTestScheduler();
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineExceptionHandler;
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bb\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineScopeExceptionHandler;", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
interface TestCoroutineScopeExceptionHandler extends CoroutineExceptionHandler {
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DefaultImpls {
public static <R> R fold(TestCoroutineScopeExceptionHandler testCoroutineScopeExceptionHandler, R r4, Function2<? super R, ? super CoroutineContext.Element, ? extends R> function2) {
return (R) CoroutineExceptionHandler.DefaultImpls.fold(testCoroutineScopeExceptionHandler, r4, function2);
}
public static <E extends CoroutineContext.Element> E get(TestCoroutineScopeExceptionHandler testCoroutineScopeExceptionHandler, CoroutineContext.Key<E> key) {
return (E) CoroutineExceptionHandler.DefaultImpls.get(testCoroutineScopeExceptionHandler, key);
}
public static CoroutineContext minusKey(TestCoroutineScopeExceptionHandler testCoroutineScopeExceptionHandler, CoroutineContext.Key<?> key) {
return CoroutineExceptionHandler.DefaultImpls.minusKey(testCoroutineScopeExceptionHandler, key);
}
public static CoroutineContext plus(TestCoroutineScopeExceptionHandler testCoroutineScopeExceptionHandler, CoroutineContext coroutineContext) {
return CoroutineExceptionHandler.DefaultImpls.plus(testCoroutineScopeExceptionHandler, coroutineContext);
}
}
}

View File

@@ -0,0 +1,168 @@
package kotlinx.coroutines.test;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.Job;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010!\n\u0002\u0010\u0003\n\u0000\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0016\u001a\u00020\u0017H\u0017J\u000e\u0010\u0018\u001a\u00020\u00062\u0006\u0010\u0019\u001a\u00020\u000bR\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0002\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u0014\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u000b0\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u0012\u0010\u000f\u001a\u00060\u0010j\u0002`\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0012\u001a\u00020\u00138VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0015¨\u0006\u001a"}, d2 = {"Lkotlinx/coroutines/test/TestCoroutineScopeImpl;", "Lkotlinx/coroutines/test/TestCoroutineScope;", "coroutineContext", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/coroutines/CoroutineContext;)V", "cleanedUp", "", "getCoroutineContext", "()Lkotlin/coroutines/CoroutineContext;", "exceptions", "", "", "initialJobs", "", "Lkotlinx/coroutines/Job;", "lock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "testScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getTestScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "cleanupTestCoroutines", "", "reportException", "throwable", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestCoroutineScope.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestCoroutineScope.kt\nkotlinx/coroutines/test/TestCoroutineScopeImpl\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 TestCoroutineScope.kt\nkotlinx/coroutines/test/TestCoroutineScopeKt\n+ 5 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,348:1\n28#2,4:349\n28#2,4:356\n20#3:353\n20#3:360\n218#4,2:354\n1855#5,2:361\n*S KotlinDebug\n*F\n+ 1 TestCoroutineScope.kt\nkotlinx/coroutines/test/TestCoroutineScopeImpl\n*L\n74#1:349,4\n104#1:356,4\n74#1:353\n104#1:360\n91#1:354,2\n110#1:361,2\n*E\n"})
/* loaded from: classes3.dex */
public final class TestCoroutineScopeImpl implements TestCoroutineScope {
private boolean cleanedUp;
private final CoroutineContext coroutineContext;
private final Object lock = new Object();
private List<Throwable> exceptions = new ArrayList();
private final Set<Job> initialJobs = TestCoroutineScopeKt.activeJobs(getCoroutineContext());
public TestCoroutineScopeImpl(CoroutineContext coroutineContext) {
this.coroutineContext = coroutineContext;
}
/* JADX WARN: Code restructure failed: missing block: B:7:0x002c, code lost:
if (getTestScheduler().isIdle$kotlinx_coroutines_test(false) == false) goto L12;
*/
/* JADX WARN: Removed duplicated region for block: B:11:0x003d */
/* JADX WARN: Removed duplicated region for block: B:13:0x0042 */
/* JADX WARN: Removed duplicated region for block: B:16:0x0048 A[EXC_TOP_SPLITTER, SYNTHETIC] */
@Override // kotlinx.coroutines.test.TestCoroutineScope
@kotlin.Deprecated(message = "Please call `runTest`, which automatically performs the cleanup, instead of using this function.")
/* renamed from: cleanupTestCoroutines */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void mo1698cleanupTestCoroutines() {
/*
r5 = this;
kotlin.coroutines.CoroutineContext r0 = r5.getCoroutineContext()
kotlin.coroutines.ContinuationInterceptor$Key r1 = kotlin.coroutines.ContinuationInterceptor.INSTANCE
kotlin.coroutines.CoroutineContext$Element r0 = r0.get(r1)
kotlin.coroutines.ContinuationInterceptor r0 = (kotlin.coroutines.ContinuationInterceptor) r0
boolean r1 = r0 instanceof kotlinx.coroutines.test.DelayController
r2 = 0
if (r1 == 0) goto L14
kotlinx.coroutines.test.DelayController r0 = (kotlinx.coroutines.test.DelayController) r0
goto L15
L14:
r0 = r2
L15:
r1 = 0
r3 = 1
if (r0 == 0) goto L1d
r0.cleanupTestCoroutines() // Catch: kotlinx.coroutines.test.UncompletedCoroutinesError -> L2e
goto L2f
L1d:
kotlinx.coroutines.test.TestCoroutineScheduler r0 = r5.getTestScheduler()
r0.runCurrent()
kotlinx.coroutines.test.TestCoroutineScheduler r0 = r5.getTestScheduler()
boolean r0 = r0.isIdle$kotlinx_coroutines_test(r1)
if (r0 != 0) goto L2f
L2e:
r1 = r3
L2f:
kotlin.coroutines.CoroutineContext r0 = r5.getCoroutineContext()
kotlinx.coroutines.CoroutineExceptionHandler$Key r4 = kotlinx.coroutines.CoroutineExceptionHandler.INSTANCE
kotlin.coroutines.CoroutineContext$Element r0 = r0.get(r4)
boolean r4 = r0 instanceof kotlinx.coroutines.test.UncaughtExceptionCaptor
if (r4 == 0) goto L40
r2 = r0
kotlinx.coroutines.test.UncaughtExceptionCaptor r2 = (kotlinx.coroutines.test.UncaughtExceptionCaptor) r2
L40:
if (r2 == 0) goto L45
r2.cleanupTestCoroutines()
L45:
java.lang.Object r0 = r5.lock
monitor-enter(r0)
boolean r2 = r5.cleanedUp // Catch: java.lang.Throwable -> Lad
if (r2 != 0) goto Laf
r5.cleanedUp = r3 // Catch: java.lang.Throwable -> Lad
kotlin.Unit r2 = kotlin.Unit.INSTANCE // Catch: java.lang.Throwable -> Lad
monitor-exit(r0)
java.util.List<java.lang.Throwable> r0 = r5.exceptions
java.lang.Object r0 = kotlin.collections.CollectionsKt.firstOrNull(r0)
java.lang.Throwable r0 = (java.lang.Throwable) r0
if (r0 == 0) goto L7a
java.util.List<java.lang.Throwable> r5 = r5.exceptions
java.lang.Iterable r5 = (java.lang.Iterable) r5
java.util.List r5 = kotlin.collections.CollectionsKt.drop(r5, r3)
java.lang.Iterable r5 = (java.lang.Iterable) r5
java.util.Iterator r5 = r5.iterator()
L69:
boolean r1 = r5.hasNext()
if (r1 == 0) goto L79
java.lang.Object r1 = r5.next()
java.lang.Throwable r1 = (java.lang.Throwable) r1
kotlin.ExceptionsKt.addSuppressed(r0, r1)
goto L69
L79:
throw r0
L7a:
if (r1 != 0) goto La5
kotlin.coroutines.CoroutineContext r0 = r5.getCoroutineContext()
java.util.Set r0 = kotlinx.coroutines.test.TestCoroutineScopeKt.activeJobs(r0)
java.util.Set<kotlinx.coroutines.Job> r5 = r5.initialJobs
java.util.Set r5 = kotlin.collections.SetsKt.minus(r0, r5)
boolean r5 = r5.isEmpty()
if (r5 == 0) goto L91
return
L91:
kotlinx.coroutines.test.UncompletedCoroutinesError r5 = new kotlinx.coroutines.test.UncompletedCoroutinesError
java.lang.StringBuilder r1 = new java.lang.StringBuilder
java.lang.String r2 = "Test finished with active jobs: "
r1.<init>(r2)
r1.append(r0)
java.lang.String r0 = r1.toString()
r5.<init>(r0)
throw r5
La5:
kotlinx.coroutines.test.UncompletedCoroutinesError r5 = new kotlinx.coroutines.test.UncompletedCoroutinesError
java.lang.String r0 = "Unfinished coroutines during teardown. Ensure all coroutines are completed or cancelled by your test."
r5.<init>(r0)
throw r5
Lad:
r5 = move-exception
goto Lb7
Laf:
java.lang.IllegalStateException r5 = new java.lang.IllegalStateException // Catch: java.lang.Throwable -> Lad
java.lang.String r1 = "Attempting to clean up a test coroutine scope more than once."
r5.<init>(r1) // Catch: java.lang.Throwable -> Lad
throw r5 // Catch: java.lang.Throwable -> Lad
Lb7:
monitor-exit(r0)
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.test.TestCoroutineScopeImpl.mo1698cleanupTestCoroutines():void");
}
@Override // kotlinx.coroutines.CoroutineScope
public CoroutineContext getCoroutineContext() {
return this.coroutineContext;
}
@Override // kotlinx.coroutines.test.TestCoroutineScope
public TestCoroutineScheduler getTestScheduler() {
CoroutineContext.Element element = getCoroutineContext().get(TestCoroutineScheduler.INSTANCE);
Intrinsics.checkNotNull(element);
return (TestCoroutineScheduler) element;
}
public final boolean reportException(Throwable throwable) {
boolean z3;
synchronized (this.lock) {
if (this.cleanedUp) {
z3 = false;
} else {
this.exceptions.add(throwable);
z3 = true;
}
}
return z3;
}
}

View File

@@ -0,0 +1,29 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlinx.coroutines.CoroutineExceptionHandler;
@Metadata(d1 = {"\u0000!\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u00012\u00020\u0002J\u0018\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0016¨\u0006\t"}, d2 = {"kotlinx/coroutines/test/TestCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1", "Lkotlin/coroutines/AbstractCoroutineContextElement;", "Lkotlinx/coroutines/test/TestCoroutineScopeExceptionHandler;", "handleException", "", "context", "Lkotlin/coroutines/CoroutineContext;", "exception", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1 extends AbstractCoroutineContextElement implements TestCoroutineScopeExceptionHandler {
final /* synthetic */ Ref.ObjectRef<TestCoroutineScopeImpl> $scope;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1(Ref.ObjectRef<TestCoroutineScopeImpl> objectRef, CoroutineExceptionHandler.Companion companion) {
super(companion);
this.$scope = objectRef;
}
@Override // kotlinx.coroutines.CoroutineExceptionHandler
public void handleException(CoroutineContext context, Throwable exception) {
TestCoroutineScopeImpl testCoroutineScopeImpl = this.$scope.element;
Intrinsics.checkNotNull(testCoroutineScopeImpl);
if (!testCoroutineScopeImpl.reportException(exception)) {
throw exception;
}
}
}

View File

@@ -0,0 +1,182 @@
package kotlinx.coroutines.test;
import java.util.List;
import java.util.Set;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.sequences.SequencesKt;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.JobKt__JobKt;
@Metadata(d1 = {"\u0000H\n\u0000\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010 \n\u0002\u0010\u0003\n\u0002\b\u0007\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\u001a\u0012\u0010\u0015\u001a\u00020\u00022\b\b\u0002\u0010\u0016\u001a\u00020\tH\u0007\u001a\u0012\u0010\u0017\u001a\u00020\u00022\b\b\u0002\u0010\u0016\u001a\u00020\tH\u0007\u001a\u0012\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u001a0\u0019*\u00020\tH\u0000\u001a\u0014\u0010\u001b\u001a\u00020\u001c*\u00020\u00022\u0006\u0010\u001d\u001a\u00020\u0001H\u0007\u001a\f\u0010\u001e\u001a\u00020\u001c*\u00020\u0002H\u0007\u001a\f\u0010\u001f\u001a\u00020\u001c*\u00020\u0002H\u0007\u001a0\u0010\u001f\u001a\u00020\u001c*\u00020\u00022\u001c\u0010 \u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u001c0\"\u0012\u0006\u0012\u0004\u0018\u00010#0!H\u0087@¢\u0006\u0002\u0010$\u001a\f\u0010%\u001a\u00020\u001c*\u00020\u0002H\u0007\u001a\f\u0010&\u001a\u00020\u001c*\u00020\u0002H\u0007\"\u001e\u0010\u0000\u001a\u00020\u0001*\u00020\u00028FX\u0087\u0004¢\u0006\f\u0012\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006\"\u001b\u0010\u0007\u001a\u0004\u0018\u00010\b*\u00020\t8Â\u0002X\u0082\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000b\"\u0018\u0010\f\u001a\u00020\b*\u00020\u00028BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000e\"$\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010*\u00020\u00028FX\u0087\u0004¢\u0006\f\u0012\u0004\b\u0012\u0010\u0004\u001a\u0004\b\u0013\u0010\u0014¨\u0006'"}, d2 = {"currentTime", "", "Lkotlinx/coroutines/test/TestCoroutineScope;", "getCurrentTime$annotations", "(Lkotlinx/coroutines/test/TestCoroutineScope;)V", "getCurrentTime", "(Lkotlinx/coroutines/test/TestCoroutineScope;)J", "delayController", "Lkotlinx/coroutines/test/DelayController;", "Lkotlin/coroutines/CoroutineContext;", "getDelayController", "(Lkotlin/coroutines/CoroutineContext;)Lkotlinx/coroutines/test/DelayController;", "delayControllerForPausing", "getDelayControllerForPausing", "(Lkotlinx/coroutines/test/TestCoroutineScope;)Lkotlinx/coroutines/test/DelayController;", "uncaughtExceptions", "", "", "getUncaughtExceptions$annotations", "getUncaughtExceptions", "(Lkotlinx/coroutines/test/TestCoroutineScope;)Ljava/util/List;", "TestCoroutineScope", "context", "createTestCoroutineScope", "activeJobs", "", "Lkotlinx/coroutines/Job;", "advanceTimeBy", "", "delayTimeMillis", "advanceUntilIdle", "pauseDispatcher", "block", "Lkotlin/Function1;", "Lkotlin/coroutines/Continuation;", "", "(Lkotlinx/coroutines/test/TestCoroutineScope;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "resumeDispatcher", "runCurrent", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestCoroutineScope.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestCoroutineScope.kt\nkotlinx/coroutines/test/TestCoroutineScopeKt\n*L\n1#1,348:1\n218#1,2:349\n218#1,2:351\n218#1,2:353\n218#1,2:355\n218#1,2:357\n*S KotlinDebug\n*F\n+ 1 TestCoroutineScope.kt\nkotlinx/coroutines/test/TestCoroutineScopeKt\n*L\n229#1:349,2\n246#1:351,2\n263#1:353,2\n274#1:355,2\n346#1:357,2\n*E\n"})
/* loaded from: classes3.dex */
public final class TestCoroutineScopeKt {
@Deprecated(level = DeprecationLevel.WARNING, message = "This constructs a `TestCoroutineScope` with a deprecated `CoroutineDispatcher` by default. Please use `createTestCoroutineScope` instead.", replaceWith = @ReplaceWith(expression = "createTestCoroutineScope(TestCoroutineDispatcher() + TestCoroutineExceptionHandler() + context)", imports = {"kotlin.coroutines.EmptyCoroutineContext"}))
public static final TestCoroutineScope TestCoroutineScope(CoroutineContext coroutineContext) {
TestCoroutineScheduler testCoroutineScheduler = (TestCoroutineScheduler) coroutineContext.get(TestCoroutineScheduler.INSTANCE);
if (testCoroutineScheduler == null) {
testCoroutineScheduler = new TestCoroutineScheduler();
}
return createTestCoroutineScope(new TestCoroutineDispatcher(testCoroutineScheduler).plus(new TestCoroutineExceptionHandler()).plus(coroutineContext));
}
public static /* synthetic */ TestCoroutineScope TestCoroutineScope$default(CoroutineContext coroutineContext, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
return TestCoroutineScope(coroutineContext);
}
public static final Set<Job> activeJobs(CoroutineContext coroutineContext) {
CoroutineContext.Element element = coroutineContext.get(Job.INSTANCE);
if (element != null) {
return SequencesKt.toSet(SequencesKt.filter(((Job) element).getChildren(), new Function1<Job, Boolean>() { // from class: kotlinx.coroutines.test.TestCoroutineScopeKt$activeJobs$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Job job) {
return Boolean.valueOf(job.isActive());
}
}));
}
throw new IllegalStateException("Required value was null.");
}
@Deprecated(level = DeprecationLevel.ERROR, message = "The name of this function is misleading: it not only advances the time, but also runs the tasks scheduled *at* the ending moment.", replaceWith = @ReplaceWith(expression = "this.testScheduler.apply { advanceTimeBy(delayTimeMillis); runCurrent() }", imports = {}))
@ExperimentalCoroutinesApi
public static final void advanceTimeBy(TestCoroutineScope testCoroutineScope, long j4) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) testCoroutineScope.getCoroutineContext().get(ContinuationInterceptor.INSTANCE);
DelayController delayController = continuationInterceptor instanceof DelayController ? (DelayController) continuationInterceptor : null;
if (delayController != null) {
delayController.advanceTimeBy(j4);
} else {
testCoroutineScope.getTestScheduler().advanceTimeBy(j4);
testCoroutineScope.getTestScheduler().runCurrent();
}
}
@ExperimentalCoroutinesApi
public static final void advanceUntilIdle(TestCoroutineScope testCoroutineScope) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) testCoroutineScope.getCoroutineContext().get(ContinuationInterceptor.INSTANCE);
DelayController delayController = continuationInterceptor instanceof DelayController ? (DelayController) continuationInterceptor : null;
if (delayController != null) {
delayController.advanceUntilIdle();
} else {
testCoroutineScope.getTestScheduler().advanceUntilIdle();
}
}
/* JADX WARN: Type inference failed for: r3v1, types: [kotlinx.coroutines.test.TestCoroutineScopeImpl, T, kotlinx.coroutines.test.TestCoroutineScope] */
@Deprecated(level = DeprecationLevel.WARNING, message = "This function was introduced in order to help migrate from TestCoroutineScope to TestScope. Please use TestScope() construction instead, or just runTest(), without creating a scope.")
@ExperimentalCoroutinesApi
public static final TestCoroutineScope createTestCoroutineScope(CoroutineContext coroutineContext) {
CoroutineContext withDelaySkipping = TestScopeKt.withDelaySkipping(coroutineContext);
Ref.ObjectRef objectRef = new Ref.ObjectRef();
CoroutineExceptionHandler.Companion companion = CoroutineExceptionHandler.INSTANCE;
CoroutineExceptionHandler testCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1 = new TestCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1(objectRef, companion);
CoroutineExceptionHandler coroutineExceptionHandler = (CoroutineExceptionHandler) withDelaySkipping.get(companion);
if (coroutineExceptionHandler instanceof UncaughtExceptionCaptor) {
testCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1 = coroutineExceptionHandler;
} else if (coroutineExceptionHandler != null && !(coroutineExceptionHandler instanceof TestCoroutineScopeExceptionHandler)) {
throw new IllegalArgumentException("A CoroutineExceptionHandler was passed to TestCoroutineScope. Please pass it as an argument to a `launch` or `async` block on an already-created scope if uncaught exceptions require special treatment.");
}
CoroutineContext coroutineContext2 = (Job) withDelaySkipping.get(Job.INSTANCE);
if (coroutineContext2 == null) {
coroutineContext2 = JobKt__JobKt.Job$default((Job) null, 1, (Object) null);
}
?? testCoroutineScopeImpl = new TestCoroutineScopeImpl(withDelaySkipping.plus(testCoroutineScopeKt$createTestCoroutineScope$ownExceptionHandler$1).plus(coroutineContext2));
objectRef.element = testCoroutineScopeImpl;
return testCoroutineScopeImpl;
}
public static /* synthetic */ TestCoroutineScope createTestCoroutineScope$default(CoroutineContext coroutineContext, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
return createTestCoroutineScope(coroutineContext);
}
public static final long getCurrentTime(TestCoroutineScope testCoroutineScope) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) testCoroutineScope.getCoroutineContext().get(ContinuationInterceptor.INSTANCE);
DelayController delayController = continuationInterceptor instanceof DelayController ? (DelayController) continuationInterceptor : null;
return delayController != null ? delayController.getCurrentTime() : testCoroutineScope.getTestScheduler().getCurrentTime();
}
@ExperimentalCoroutinesApi
public static /* synthetic */ void getCurrentTime$annotations(TestCoroutineScope testCoroutineScope) {
}
private static final DelayController getDelayController(CoroutineContext coroutineContext) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) coroutineContext.get(ContinuationInterceptor.INSTANCE);
if (continuationInterceptor instanceof DelayController) {
return (DelayController) continuationInterceptor;
}
return null;
}
private static final DelayController getDelayControllerForPausing(TestCoroutineScope testCoroutineScope) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) testCoroutineScope.getCoroutineContext().get(ContinuationInterceptor.INSTANCE);
DelayController delayController = continuationInterceptor instanceof DelayController ? (DelayController) continuationInterceptor : null;
if (delayController != null) {
return delayController;
}
throw new IllegalStateException("This scope isn't able to pause its dispatchers");
}
public static final List<Throwable> getUncaughtExceptions(TestCoroutineScope testCoroutineScope) {
List<Throwable> uncaughtExceptions;
CoroutineContext.Element element = testCoroutineScope.getCoroutineContext().get(CoroutineExceptionHandler.INSTANCE);
UncaughtExceptionCaptor uncaughtExceptionCaptor = element instanceof UncaughtExceptionCaptor ? (UncaughtExceptionCaptor) element : null;
return (uncaughtExceptionCaptor == null || (uncaughtExceptions = uncaughtExceptionCaptor.getUncaughtExceptions()) == null) ? CollectionsKt.emptyList() : uncaughtExceptions;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "This list is only populated if `UncaughtExceptionCaptor` is in the test context, and so can be easily misused. It is only present for backward compatibility and will be removed in the subsequent releases. If you need to check the list of exceptions, please consider creating your own `CoroutineExceptionHandler`.")
public static /* synthetic */ void getUncaughtExceptions$annotations(TestCoroutineScope testCoroutineScope) {
}
@Deprecated(level = DeprecationLevel.ERROR, message = "The test coroutine scope isn't able to pause its dispatchers in the general case. Only `TestCoroutineDispatcher` supports pausing; pause it directly, or use a dispatcher that is always \"paused\", like `StandardTestDispatcher`.", replaceWith = @ReplaceWith(expression = "(this.coroutineContext[ContinuationInterceptor]!! as DelayController).pauseDispatcher(block)", imports = {"kotlin.coroutines.ContinuationInterceptor"}))
@ExperimentalCoroutinesApi
public static final Object pauseDispatcher(TestCoroutineScope testCoroutineScope, Function1<? super Continuation<? super Unit>, ? extends Object> function1, Continuation<? super Unit> continuation) {
Object pauseDispatcher = getDelayControllerForPausing(testCoroutineScope).pauseDispatcher(function1, continuation);
return pauseDispatcher == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? pauseDispatcher : Unit.INSTANCE;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "The test coroutine scope isn't able to pause its dispatchers in the general case. Only `TestCoroutineDispatcher` supports pausing; pause it directly, or use a dispatcher that is always \"paused\", like `StandardTestDispatcher`.", replaceWith = @ReplaceWith(expression = "(this.coroutineContext[ContinuationInterceptor]!! as DelayController).resumeDispatcher()", imports = {"kotlin.coroutines.ContinuationInterceptor"}))
@ExperimentalCoroutinesApi
public static final void resumeDispatcher(TestCoroutineScope testCoroutineScope) {
getDelayControllerForPausing(testCoroutineScope).resumeDispatcher();
}
@ExperimentalCoroutinesApi
public static final void runCurrent(TestCoroutineScope testCoroutineScope) {
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) testCoroutineScope.getCoroutineContext().get(ContinuationInterceptor.INSTANCE);
Unit unit = null;
DelayController delayController = continuationInterceptor instanceof DelayController ? (DelayController) continuationInterceptor : null;
if (delayController != null) {
delayController.runCurrent();
unit = Unit.INSTANCE;
}
if (unit == null) {
testCoroutineScope.getTestScheduler().runCurrent();
}
}
@Deprecated(level = DeprecationLevel.ERROR, message = "The test coroutine scope isn't able to pause its dispatchers in the general case. Only `TestCoroutineDispatcher` supports pausing; pause it directly, or use a dispatcher that is always \"paused\", like `StandardTestDispatcher`.", replaceWith = @ReplaceWith(expression = "(this.coroutineContext[ContinuationInterceptor]!! as DelayController).pauseDispatcher()", imports = {"kotlin.coroutines.ContinuationInterceptor"}))
@ExperimentalCoroutinesApi
public static final void pauseDispatcher(TestCoroutineScope testCoroutineScope) {
getDelayControllerForPausing(testCoroutineScope).pauseDispatcher();
}
}

View File

@@ -0,0 +1,89 @@
package kotlinx.coroutines.test;
import com.google.firebase.analytics.FirebaseAnalytics;
import kotlin.Metadata;
import kotlin.comparisons.ComparisonsKt;
import kotlin.jvm.JvmField;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.PropertyReference1Impl;
import kotlinx.coroutines.internal.ThreadSafeHeap;
import kotlinx.coroutines.internal.ThreadSafeHeapNode;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u0000*\u0004\b\u0000\u0010\u00012\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u00000\u00022\u00020\u0003B;\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\u0007\u0012\u0006\u0010\t\u001a\u00028\u0000\u0012\u0006\u0010\n\u001a\u00020\u000b\u0012\f\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000b0\\u0006\u0002\u0010\u000eJ\u0015\u0010\u001c\u001a\u00020\u00162\n\u0010\u001d\u001a\u0006\u0012\u0002\b\u00030\u0000H\u0096\u0002J\b\u0010\u001e\u001a\u00020\u001fH\u0016R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0004\u001a\u00020\u00058\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R \u0010\u000f\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u0010X\u0096\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R\u001a\u0010\u0015\u001a\u00020\u0016X\u0096\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u001aR\u0016\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000b0\r8\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u00020\u000b8\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0012\u0010\t\u001a\u00028\u00008\u0006X\u0087\u0004¢\u0006\u0004\n\u0002\u0010\u001bR\u0010\u0010\b\u001a\u00020\u00078\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006 "}, d2 = {"Lkotlinx/coroutines/test/TestDispatchEvent;", "T", "", "Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "dispatcher", "Lkotlinx/coroutines/test/TestDispatcher;", "count", "", "time", "marker", "isForeground", "", "isCancelled", "Lkotlin/Function0;", "(Lkotlinx/coroutines/test/TestDispatcher;JJLjava/lang/Object;ZLkotlin/jvm/functions/Function0;)V", "heap", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "getHeap", "()Lkotlinx/coroutines/internal/ThreadSafeHeap;", "setHeap", "(Lkotlinx/coroutines/internal/ThreadSafeHeap;)V", FirebaseAnalytics.Param.INDEX, "", "getIndex", "()I", "setIndex", "(I)V", "Ljava/lang/Object;", "compareTo", "other", "toString", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestDispatchEvent<T> implements Comparable<TestDispatchEvent<?>>, ThreadSafeHeapNode {
private final long count;
@JvmField
public final TestDispatcher dispatcher;
private ThreadSafeHeap<?> heap;
private int index;
@JvmField
public final Function0<Boolean> isCancelled;
@JvmField
public final boolean isForeground;
@JvmField
public final T marker;
@JvmField
public final long time;
public TestDispatchEvent(TestDispatcher testDispatcher, long j4, long j5, T t2, boolean z3, Function0<Boolean> function0) {
this.dispatcher = testDispatcher;
this.count = j4;
this.time = j5;
this.marker = t2;
this.isForeground = z3;
this.isCancelled = function0;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public ThreadSafeHeap<?> getHeap() {
return this.heap;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public int getIndex() {
return this.index;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public void setHeap(ThreadSafeHeap<?> threadSafeHeap) {
this.heap = threadSafeHeap;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public void setIndex(int i) {
this.index = i;
}
public String toString() {
StringBuilder sb = new StringBuilder("TestDispatchEvent(time=");
sb.append(this.time);
sb.append(", dispatcher=");
sb.append(this.dispatcher);
return com.google.android.gms.measurement.internal.a.n(sb, this.isForeground ? "" : ", background", ')');
}
@Override // java.lang.Comparable
public int compareTo(TestDispatchEvent<?> other) {
return ComparisonsKt.compareValuesBy((TestDispatchEvent<?>) this, other, (Function1<? super TestDispatchEvent<?>, ? extends Comparable<?>>[]) new Function1[]{new PropertyReference1Impl() { // from class: kotlinx.coroutines.test.TestDispatchEvent$compareTo$1
@Override // kotlin.jvm.internal.PropertyReference1Impl, kotlin.reflect.KProperty1
public Object get(Object obj) {
return Long.valueOf(((TestDispatchEvent) obj).time);
}
}, new PropertyReference1Impl() { // from class: kotlinx.coroutines.test.TestDispatchEvent$compareTo$2
@Override // kotlin.jvm.internal.PropertyReference1Impl, kotlin.reflect.KProperty1
public Object get(Object obj) {
long j4;
j4 = ((TestDispatchEvent) obj).count;
return Long.valueOf(j4);
}
}});
}
}

View File

@@ -0,0 +1,22 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.FunctionReferenceImpl;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class TestDispatcher$scheduleResumeAfterDelay$handle$1 extends FunctionReferenceImpl implements Function1<CancellableContinuationRunnable, Boolean> {
public static final TestDispatcher$scheduleResumeAfterDelay$handle$1 INSTANCE = new TestDispatcher$scheduleResumeAfterDelay$handle$1();
public TestDispatcher$scheduleResumeAfterDelay$handle$1() {
super(1, TestDispatcherKt.class, "cancellableRunnableIsCancelled", "cancellableRunnableIsCancelled(Lkotlinx/coroutines/test/CancellableContinuationRunnable;)Z", 1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(CancellableContinuationRunnable cancellableContinuationRunnable) {
boolean cancellableRunnableIsCancelled;
cancellableRunnableIsCancelled = TestDispatcherKt.cancellableRunnableIsCancelled(cancellableContinuationRunnable);
return Boolean.valueOf(cancellableRunnableIsCancelled);
}
}

View File

@@ -0,0 +1,58 @@
package kotlinx.coroutines.test;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.time.Duration;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CancellableContinuationKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DelayWithTimeoutDiagnostics;
import kotlinx.coroutines.DisposableHandle;
@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b&\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u0007\b\u0000¢\u0006\u0002\u0010\u0004J$\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\n\u0010\r\u001a\u00060\u000ej\u0002`\u000f2\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\u0015\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0015H\u0000¢\u0006\u0002\b\u0016J\u001e\u0010\u0017\u001a\u00020\u00132\u0006\u0010\u000b\u001a\u00020\f2\f\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u00130\u0019H\u0016J\u001a\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001dH\u0017ø\u0001\u0000¢\u0006\u0004\b\u001e\u0010\u001fR\u0012\u0010\u0005\u001a\u00020\u0006X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\b\u0082\u0002\u0007\n\u0005\\u001e0\u0001¨\u0006 "}, d2 = {"Lkotlinx/coroutines/test/TestDispatcher;", "Lkotlinx/coroutines/CoroutineDispatcher;", "Lkotlinx/coroutines/Delay;", "Lkotlinx/coroutines/DelayWithTimeoutDiagnostics;", "()V", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "invokeOnTimeout", "Lkotlinx/coroutines/DisposableHandle;", "timeMillis", "", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "context", "Lkotlin/coroutines/CoroutineContext;", "processEvent", "", "marker", "", "processEvent$kotlinx_coroutines_test", "scheduleResumeAfterDelay", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "timeoutMessage", "", "timeout", "Lkotlin/time/Duration;", "timeoutMessage-LRDsOJo", "(J)Ljava/lang/String;", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public abstract class TestDispatcher extends CoroutineDispatcher implements Delay, DelayWithTimeoutDiagnostics {
@Override // kotlinx.coroutines.Delay
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement as an internal method never intended for public use")
public Object delay(long j4, Continuation<? super Unit> continuation) {
return Delay.DefaultImpls.delay(this, j4, continuation);
}
public abstract TestCoroutineScheduler getScheduler();
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long timeMillis, Runnable block, CoroutineContext context) {
return getScheduler().registerEvent$kotlinx_coroutines_test(this, timeMillis, block, context, new Function1<Runnable, Boolean>() { // from class: kotlinx.coroutines.test.TestDispatcher$invokeOnTimeout$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Runnable runnable) {
return Boolean.FALSE;
}
});
}
public final void processEvent$kotlinx_coroutines_test(Object marker) {
if (!(marker instanceof Runnable)) {
throw new IllegalStateException("Check failed.");
}
((Runnable) marker).run();
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo1686scheduleResumeAfterDelay(long timeMillis, CancellableContinuation<? super Unit> continuation) {
CancellableContinuationKt.disposeOnCancellation(continuation, getScheduler().registerEvent$kotlinx_coroutines_test(this, timeMillis, new CancellableContinuationRunnable(continuation, this), continuation.getContext(), TestDispatcher$scheduleResumeAfterDelay$handle$1.INSTANCE));
}
@Override // kotlinx.coroutines.DelayWithTimeoutDiagnostics
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Is only needed internally")
/* renamed from: timeoutMessage-LRDsOJo */
public /* synthetic */ String mo1621timeoutMessageLRDsOJo(long timeout) {
return "Timed out after " + ((Object) Duration.m1504toStringimpl(timeout)) + " of _virtual_ (kotlinx.coroutines.test) time. To use the real time, wrap 'withTimeout' in 'withContext(Dispatchers.Default.limitedParallelism(1))'";
}
}

View File

@@ -0,0 +1,12 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
@Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0002¨\u0006\u0004"}, d2 = {"cancellableRunnableIsCancelled", "", "runnable", "Lkotlinx/coroutines/test/CancellableContinuationRunnable;", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestDispatcherKt {
/* JADX INFO: Access modifiers changed from: private */
public static final boolean cancellableRunnableIsCancelled(CancellableContinuationRunnable cancellableContinuationRunnable) {
return !cancellableContinuationRunnable.continuation.isActive();
}
}

View File

@@ -0,0 +1,29 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.jvm.JvmName;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.test.internal.TestMainDispatcher;
import kotlinx.coroutines.test.internal.TestMainDispatcherJvmKt;
@Metadata(d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u001a\f\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0007\u001a\u0014\u0010\u0003\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0004\u001a\u00020\u0005H\u0007¨\u0006\u0006"}, d2 = {"resetMain", "", "Lkotlinx/coroutines/Dispatchers;", "setMain", "dispatcher", "Lkotlinx/coroutines/CoroutineDispatcher;", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
@JvmName(name = "TestDispatchers")
@SourceDebugExtension({"SMAP\nTestDispatchers.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestDispatchers.kt\nkotlinx/coroutines/test/TestDispatchers\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,39:1\n1#2:40\n*E\n"})
/* loaded from: classes3.dex */
public final class TestDispatchers {
@ExperimentalCoroutinesApi
public static final void resetMain(Dispatchers dispatchers) {
TestMainDispatcherJvmKt.getTestMainDispatcher(dispatchers).resetDispatcher();
}
@ExperimentalCoroutinesApi
public static final void setMain(Dispatchers dispatchers, CoroutineDispatcher coroutineDispatcher) {
if (coroutineDispatcher instanceof TestMainDispatcher) {
throw new IllegalArgumentException("Dispatchers.setMain(Dispatchers.Main) is prohibited, probably Dispatchers.resetMain() should be used instead");
}
TestMainDispatcherJvmKt.getTestMainDispatcher(dispatchers).setDispatcher(coroutineDispatcher);
}
}

View File

@@ -0,0 +1,12 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlinx.coroutines.CoroutineScope;
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\bv\u0018\u00002\u00020\u0001R\u0012\u0010\u0002\u001a\u00020\u0001X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0003\u0010\u0004R\u0012\u0010\u0005\u001a\u00020\u0006X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\b\u0082\u0001\u0001\\u0006\n"}, d2 = {"Lkotlinx/coroutines/test/TestScope;", "Lkotlinx/coroutines/CoroutineScope;", "backgroundScope", "getBackgroundScope", "()Lkotlinx/coroutines/CoroutineScope;", "testScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getTestScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "Lkotlinx/coroutines/test/TestScopeImpl;", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public interface TestScope extends CoroutineScope {
CoroutineScope getBackgroundScope();
TestCoroutineScheduler getTestScheduler();
}

View File

@@ -0,0 +1,25 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.FunctionReferenceImpl;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class TestScopeImpl$enter$exceptions$1$2 extends FunctionReferenceImpl implements Function1<Throwable, Unit> {
public TestScopeImpl$enter$exceptions$1$2(Object obj) {
super(1, obj, TestScopeImpl.class, "reportException", "reportException(Ljava/lang/Throwable;)V", 0);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
((TestScopeImpl) this.receiver).reportException(th);
}
}

View File

@@ -0,0 +1,174 @@
package kotlinx.coroutines.test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CancellationException;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.sequences.SequencesKt;
import kotlinx.coroutines.AbstractCoroutine;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.internal.CoroutineExceptionHandlerImplKt;
import kotlinx.coroutines.test.internal.ExceptionCollector;
import kotlinx.coroutines.test.internal.ReportingSupervisorJob;
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010!\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B\r\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0006\u0010\u0018\u001a\u00020\u0002J\f\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\u00170\u001aJ\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u00170\u001aJ\u000e\u0010\u001c\u001a\u00020\u00022\u0006\u0010\u001d\u001a\u00020\u0017J\b\u0010\u001e\u001a\u00020\u001fH\u0016J\b\u0010 \u001a\u0004\u0018\u00010\u0017R\u0014\u0010\u0007\u001a\u00020\bX\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u000e\u001a\u00060\u000fj\u0002`\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0011\u001a\u00020\u00128VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0014R\u0014\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00170\u0016X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006!"}, d2 = {"Lkotlinx/coroutines/test/TestScopeImpl;", "Lkotlinx/coroutines/AbstractCoroutine;", "", "Lkotlinx/coroutines/test/TestScope;", "context", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/coroutines/CoroutineContext;)V", "backgroundScope", "Lkotlinx/coroutines/CoroutineScope;", "getBackgroundScope", "()Lkotlinx/coroutines/CoroutineScope;", "entered", "", "finished", "lock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "testScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getTestScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "uncaughtExceptions", "", "", "enter", "leave", "", "legacyLeave", "reportException", "throwable", "toString", "", "tryGetCompletionCause", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestScope.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestScope.kt\nkotlinx/coroutines/test/TestScopeImpl\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 5 StackTraceRecovery.kt\nkotlinx/coroutines/internal/StackTraceRecoveryKt\n*L\n1#1,336:1\n28#2,4:337\n28#2,4:343\n28#2,4:348\n28#2,4:353\n20#3:341\n20#3:347\n20#3:352\n20#3:357\n1#4:342\n163#5:358\n*S KotlinDebug\n*F\n+ 1 TestScope.kt\nkotlinx/coroutines/test/TestScopeImpl\n*L\n224#1:337,4\n251#1:343,4\n261#1:348,4\n287#1:353,4\n224#1:341\n251#1:347\n261#1:352\n287#1:357\n294#1:358\n*E\n"})
/* loaded from: classes3.dex */
public final class TestScopeImpl extends AbstractCoroutine<Unit> implements TestScope {
private final CoroutineScope backgroundScope;
private boolean entered;
private boolean finished;
private final Object lock;
private final List<Throwable> uncaughtExceptions;
public TestScopeImpl(CoroutineContext coroutineContext) {
super(coroutineContext, true, true);
this.uncaughtExceptions = new ArrayList();
this.lock = new Object();
this.backgroundScope = CoroutineScopeKt.CoroutineScope(getCoroutineContext().plus(BackgroundWork.INSTANCE).plus(new ReportingSupervisorJob(null, new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.test.TestScopeImpl$backgroundScope$1
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
if (th instanceof CancellationException) {
return;
}
TestScopeImpl.this.reportException(th);
}
}, 1, null)));
}
public final void enter() {
ExceptionCollector exceptionCollector;
List<Throwable> list;
synchronized (this.lock) {
try {
if (this.entered) {
throw new IllegalStateException("Only a single call to `runTest` can be performed during one test.");
}
this.entered = true;
if (this.finished) {
throw new IllegalStateException("Check failed.");
}
exceptionCollector = ExceptionCollector.INSTANCE;
CoroutineExceptionHandlerImplKt.ensurePlatformExceptionHandlerLoaded(exceptionCollector);
if (TestScopeKt.getCatchNonTestRelatedExceptions()) {
exceptionCollector.addOnExceptionCallback(this.lock, new TestScopeImpl$enter$exceptions$1$2(this));
}
list = this.uncaughtExceptions;
} catch (Throwable th) {
throw th;
}
}
if (list.isEmpty()) {
return;
}
exceptionCollector.removeOnExceptionCallback(this.lock);
UncaughtExceptionsBeforeTest uncaughtExceptionsBeforeTest = new UncaughtExceptionsBeforeTest();
Iterator<Throwable> it = list.iterator();
while (it.hasNext()) {
ExceptionsKt.addSuppressed(uncaughtExceptionsBeforeTest, it.next());
}
throw uncaughtExceptionsBeforeTest;
}
@Override // kotlinx.coroutines.test.TestScope
public CoroutineScope getBackgroundScope() {
return this.backgroundScope;
}
@Override // kotlinx.coroutines.test.TestScope
public TestCoroutineScheduler getTestScheduler() {
CoroutineContext.Element element = get$context().get(TestCoroutineScheduler.INSTANCE);
Intrinsics.checkNotNull(element);
return (TestCoroutineScheduler) element;
}
public final List<Throwable> leave() {
List<Throwable> list;
synchronized (this.lock) {
if (!this.entered || this.finished) {
throw new IllegalStateException("Check failed.");
}
ExceptionCollector.INSTANCE.removeOnExceptionCallback(this.lock);
this.finished = true;
list = this.uncaughtExceptions;
}
return list;
}
public final List<Throwable> legacyLeave() {
List<Throwable> list;
synchronized (this.lock) {
if (!this.entered || this.finished) {
throw new IllegalStateException("Check failed.");
}
ExceptionCollector.INSTANCE.removeOnExceptionCallback(this.lock);
this.finished = true;
list = this.uncaughtExceptions;
}
List list2 = SequencesKt.toList(SequencesKt.filter(getChildren(), new Function1<Job, Boolean>() { // from class: kotlinx.coroutines.test.TestScopeImpl$legacyLeave$activeJobs$1
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(Job job) {
return Boolean.valueOf(job.isActive());
}
}));
if (list.isEmpty()) {
if (!list2.isEmpty()) {
throw new UncompletedCoroutinesError("Active jobs found during the tear-down. Ensure that all coroutines are completed or cancelled by your test. The active jobs: " + list2);
}
if (!TestCoroutineScheduler.isIdle$kotlinx_coroutines_test$default(getTestScheduler(), false, 1, null)) {
throw new UncompletedCoroutinesError("Unfinished coroutines found during the tear-down. Ensure that all coroutines are completed or cancelled by your test.");
}
}
return list;
}
public final void reportException(Throwable throwable) {
synchronized (this.lock) {
if (this.finished) {
throw throwable;
}
Iterator<Throwable> it = this.uncaughtExceptions.iterator();
while (it.hasNext()) {
if (Intrinsics.areEqual(throwable, it.next())) {
return;
}
}
this.uncaughtExceptions.add(throwable);
if (this.entered) {
Unit unit = Unit.INSTANCE;
} else {
UncaughtExceptionsBeforeTest uncaughtExceptionsBeforeTest = new UncaughtExceptionsBeforeTest();
ExceptionsKt.addSuppressed(uncaughtExceptionsBeforeTest, throwable);
throw uncaughtExceptionsBeforeTest;
}
}
}
@Override // kotlinx.coroutines.JobSupport
public String toString() {
return com.google.android.gms.measurement.internal.a.n(new StringBuilder("TestScope["), this.finished ? "test ended" : this.entered ? "test started" : "test not started", ']');
}
public final Throwable tryGetCompletionCause() {
return getCompletionCause();
}
}

View File

@@ -0,0 +1,30 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CoroutineExceptionHandler;
@Metadata(d1 = {"\u0000!\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u00012\u00020\u0002J\u0018\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0016¨\u0006\t¸\u0006\u0000"}, d2 = {"kotlinx/coroutines/CoroutineExceptionHandlerKt$CoroutineExceptionHandler$1", "Lkotlin/coroutines/AbstractCoroutineContextElement;", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "handleException", "", "context", "Lkotlin/coroutines/CoroutineContext;", "exception", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nCoroutineExceptionHandler.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CoroutineExceptionHandler.kt\nkotlinx/coroutines/CoroutineExceptionHandlerKt$CoroutineExceptionHandler$1\n+ 2 TestScope.kt\nkotlinx/coroutines/test/TestScopeKt\n*L\n1#1,110:1\n172#2,2:111\n*E\n"})
/* loaded from: classes3.dex */
public final class TestScopeKt$TestScope$$inlined$CoroutineExceptionHandler$1 extends AbstractCoroutineContextElement implements CoroutineExceptionHandler {
final /* synthetic */ Ref.ObjectRef $scope$inlined;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TestScopeKt$TestScope$$inlined$CoroutineExceptionHandler$1(CoroutineExceptionHandler.Companion companion, Ref.ObjectRef objectRef) {
super(companion);
this.$scope$inlined = objectRef;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // kotlinx.coroutines.CoroutineExceptionHandler
public void handleException(CoroutineContext context, Throwable exception) {
T t2 = this.$scope$inlined.element;
Intrinsics.checkNotNull(t2);
((TestScopeImpl) t2).reportException(exception);
}
}

View File

@@ -0,0 +1,116 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.PublishedApi;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.time.ExperimentalTime;
import kotlin.time.TimeSource;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Metadata(d1 = {"\u0000<\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a\u0010\u0010\u0014\u001a\u00020\n2\b\b\u0002\u0010\u0015\u001a\u00020\u0016\u001a\u0014\u0010\u0017\u001a\u00020\u0018*\u00020\n2\u0006\u0010\u0019\u001a\u00020\tH\u0007\u001a\u001e\u0010\u0017\u001a\u00020\u0018*\u00020\n2\u0006\u0010\u001a\u001a\u00020\u001bH\u0007ø\u0001\u0000¢\u0006\u0004\b\u001c\u0010\u001d\u001a\f\u0010\u001e\u001a\u00020\u0018*\u00020\nH\u0007\u001a\f\u0010\u001f\u001a\u00020 *\u00020\nH\u0000\u001a\f\u0010!\u001a\u00020\u0018*\u00020\nH\u0007\u001a\f\u0010\"\u001a\u00020\u0016*\u00020\u0016H\u0000\"$\u0010\u0000\u001a\u00020\u00018\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u0002\u0010\u0003\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007\"\u001e\u0010\b\u001a\u00020\t*\u00020\n8FX\u0087\u0004¢\u0006\f\u0012\u0004\b\u000b\u0010\f\u001a\u0004\b\r\u0010\u000e\"\u001e\u0010\u000f\u001a\u00020\u0010*\u00020\n8FX\u0087\u0004¢\u0006\f\u0012\u0004\b\u0011\u0010\f\u001a\u0004\b\u0012\u0010\u0013\u0082\u0002\u0007\n\u0005\\u001e0\u0001¨\u0006#"}, d2 = {"catchNonTestRelatedExceptions", "", "getCatchNonTestRelatedExceptions$annotations", "()V", "getCatchNonTestRelatedExceptions", "()Z", "setCatchNonTestRelatedExceptions", "(Z)V", "currentTime", "", "Lkotlinx/coroutines/test/TestScope;", "getCurrentTime$annotations", "(Lkotlinx/coroutines/test/TestScope;)V", "getCurrentTime", "(Lkotlinx/coroutines/test/TestScope;)J", "testTimeSource", "Lkotlin/time/TimeSource$WithComparableMarks;", "getTestTimeSource$annotations", "getTestTimeSource", "(Lkotlinx/coroutines/test/TestScope;)Lkotlin/time/TimeSource$WithComparableMarks;", "TestScope", "context", "Lkotlin/coroutines/CoroutineContext;", "advanceTimeBy", "", "delayTimeMillis", "delayTime", "Lkotlin/time/Duration;", "advanceTimeBy-HG0u8IE", "(Lkotlinx/coroutines/test/TestScope;J)V", "advanceUntilIdle", "asSpecificImplementation", "Lkotlinx/coroutines/test/TestScopeImpl;", "runCurrent", "withDelaySkipping", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestScope.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestScope.kt\nkotlinx/coroutines/test/TestScopeKt\n+ 2 CoroutineExceptionHandler.kt\nkotlinx/coroutines/CoroutineExceptionHandlerKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,336:1\n48#2,4:337\n1#3:341\n*S KotlinDebug\n*F\n+ 1 TestScope.kt\nkotlinx/coroutines/test/TestScopeKt\n*L\n171#1:337,4\n*E\n"})
/* loaded from: classes3.dex */
public final class TestScopeKt {
private static boolean catchNonTestRelatedExceptions = true;
/* JADX WARN: Type inference failed for: r1v1, types: [kotlinx.coroutines.test.TestScopeImpl, T, kotlinx.coroutines.test.TestScope] */
public static final TestScope TestScope(CoroutineContext coroutineContext) {
CoroutineContext withDelaySkipping = withDelaySkipping(coroutineContext);
Ref.ObjectRef objectRef = new Ref.ObjectRef();
CoroutineExceptionHandler.Companion companion = CoroutineExceptionHandler.INSTANCE;
if (((CoroutineExceptionHandler) withDelaySkipping.get(companion)) != null) {
throw new IllegalArgumentException("A CoroutineExceptionHandler was passed to TestScope. Please pass it as an argument to a `launch` or `async` block on an already-created scope if uncaught exceptions require special treatment.");
}
?? testScopeImpl = new TestScopeImpl(withDelaySkipping.plus(new TestScopeKt$TestScope$$inlined$CoroutineExceptionHandler$1(companion, objectRef)));
objectRef.element = testScopeImpl;
return testScopeImpl;
}
public static /* synthetic */ TestScope TestScope$default(CoroutineContext coroutineContext, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
return TestScope(coroutineContext);
}
@ExperimentalCoroutinesApi
public static final void advanceTimeBy(TestScope testScope, long j4) {
testScope.getTestScheduler().advanceTimeBy(j4);
}
@ExperimentalCoroutinesApi
/* renamed from: advanceTimeBy-HG0u8IE, reason: not valid java name */
public static final void m1712advanceTimeByHG0u8IE(TestScope testScope, long j4) {
testScope.getTestScheduler().m1711advanceTimeByLRDsOJo(j4);
}
@ExperimentalCoroutinesApi
public static final void advanceUntilIdle(TestScope testScope) {
testScope.getTestScheduler().advanceUntilIdle();
}
public static final TestScopeImpl asSpecificImplementation(TestScope testScope) {
if (testScope instanceof TestScopeImpl) {
return (TestScopeImpl) testScope;
}
throw new NoWhenBranchMatchedException();
}
public static final boolean getCatchNonTestRelatedExceptions() {
return catchNonTestRelatedExceptions;
}
@PublishedApi
public static /* synthetic */ void getCatchNonTestRelatedExceptions$annotations() {
}
public static final long getCurrentTime(TestScope testScope) {
return testScope.getTestScheduler().getCurrentTime();
}
@ExperimentalCoroutinesApi
public static /* synthetic */ void getCurrentTime$annotations(TestScope testScope) {
}
public static final TimeSource.WithComparableMarks getTestTimeSource(TestScope testScope) {
return testScope.getTestScheduler().getTimeSource();
}
@ExperimentalTime
@ExperimentalCoroutinesApi
public static /* synthetic */ void getTestTimeSource$annotations(TestScope testScope) {
}
@ExperimentalCoroutinesApi
public static final void runCurrent(TestScope testScope) {
testScope.getTestScheduler().runCurrent();
}
public static final void setCatchNonTestRelatedExceptions(boolean z3) {
catchNonTestRelatedExceptions = z3;
}
public static final CoroutineContext withDelaySkipping(CoroutineContext coroutineContext) {
TestDispatcher StandardTestDispatcher$default;
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) coroutineContext.get(ContinuationInterceptor.INSTANCE);
if (continuationInterceptor instanceof TestDispatcher) {
TestCoroutineScheduler testCoroutineScheduler = (TestCoroutineScheduler) coroutineContext.get(TestCoroutineScheduler.INSTANCE);
if (testCoroutineScheduler != null && ((TestDispatcher) continuationInterceptor).getScheduler() != testCoroutineScheduler) {
throw new IllegalArgumentException(("Both a TestCoroutineScheduler " + testCoroutineScheduler + " and TestDispatcher " + continuationInterceptor + " linked to another scheduler were passed.").toString());
}
StandardTestDispatcher$default = (TestDispatcher) continuationInterceptor;
} else {
if (continuationInterceptor != null) {
throw new IllegalArgumentException("Dispatcher must implement TestDispatcher: " + continuationInterceptor);
}
StandardTestDispatcher$default = TestCoroutineDispatchersKt.StandardTestDispatcher$default((TestCoroutineScheduler) coroutineContext.get(TestCoroutineScheduler.INSTANCE), null, 2, null);
}
return coroutineContext.plus(StandardTestDispatcher$default).plus(StandardTestDispatcher$default.getScheduler());
}
}

View File

@@ -0,0 +1,15 @@
package kotlinx.coroutines.test;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated for removal without a replacement. Consider whether the default mechanism of handling uncaught exceptions is sufficient. If not, try writing your own `CoroutineExceptionHandler` and please report your use case at https://github.com/Kotlin/kotlinx.coroutines/issues.")
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0010\u0003\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\bg\u0018\u00002\u00020\u0001J\b\u0010\u0007\u001a\u00020\bH&R\u0018\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, d2 = {"Lkotlinx/coroutines/test/UncaughtExceptionCaptor;", "", "uncaughtExceptions", "", "", "getUncaughtExceptions", "()Ljava/util/List;", "cleanupTestCoroutines", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public interface UncaughtExceptionCaptor {
void cleanupTestCoroutines();
List<Throwable> getUncaughtExceptions();
}

View File

@@ -0,0 +1,11 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0005¢\u0006\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lkotlinx/coroutines/test/UncaughtExceptionsBeforeTest;", "Ljava/lang/IllegalStateException;", "Lkotlin/IllegalStateException;", "()V", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class UncaughtExceptionsBeforeTest extends IllegalStateException {
public UncaughtExceptionsBeforeTest() {
super("There were uncaught exceptions before the test started. Please avoid this, as such exceptions are also reported in a platform-dependent manner so that they are not lost.");
}
}

View File

@@ -0,0 +1,13 @@
package kotlinx.coroutines.test;
import kotlin.Metadata;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0001\u0018\u00002\u00060\u0001j\u0002`\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005¨\u0006\u0006"}, d2 = {"Lkotlinx/coroutines/test/UncompletedCoroutinesError;", "Ljava/lang/AssertionError;", "Lkotlin/AssertionError;", "message", "", "(Ljava/lang/String;)V", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@ExperimentalCoroutinesApi
/* loaded from: classes3.dex */
public final class UncompletedCoroutinesError extends AssertionError {
public UncompletedCoroutinesError(String str) {
super(str);
}
}

View File

@@ -0,0 +1,59 @@
package kotlinx.coroutines.test;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.coroutines.YieldContext;
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0019\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u001c\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\n\u0010\r\u001a\u00060\u000ej\u0002`\u000fH\u0016J\u0010\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\fH\u0016J\b\u0010\u0012\u001a\u00020\u0005H\u0016R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0002\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\\u0006\u0013"}, d2 = {"Lkotlinx/coroutines/test/UnconfinedTestDispatcherImpl;", "Lkotlinx/coroutines/test/TestDispatcher;", "scheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "(Lkotlinx/coroutines/test/TestCoroutineScheduler;Ljava/lang/String;)V", "getScheduler", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "isDispatchNeeded", "", "toString", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
final class UnconfinedTestDispatcherImpl extends TestDispatcher {
private final String name;
private final TestCoroutineScheduler scheduler;
public /* synthetic */ UnconfinedTestDispatcherImpl(TestCoroutineScheduler testCoroutineScheduler, String str, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(testCoroutineScheduler, (i & 2) != 0 ? null : str);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo1685dispatch(CoroutineContext context, Runnable block) {
TestCoroutineSchedulerKt.checkSchedulerInContext(getScheduler(), context);
getScheduler().sendDispatchEvent$kotlinx_coroutines_test(context);
YieldContext yieldContext = (YieldContext) context.get(YieldContext.INSTANCE);
if (yieldContext == null) {
throw new UnsupportedOperationException("Function UnconfinedTestCoroutineDispatcher.dispatch can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.");
}
yieldContext.dispatcherWasUnconfined = true;
}
@Override // kotlinx.coroutines.test.TestDispatcher
public TestCoroutineScheduler getScheduler() {
return this.scheduler;
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public boolean isDispatchNeeded(CoroutineContext context) {
return false;
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public String toString() {
StringBuilder sb = new StringBuilder();
String str = this.name;
if (str == null) {
str = "UnconfinedTestDispatcher";
}
sb.append(str);
sb.append("[scheduler=");
sb.append(getScheduler());
sb.append(']');
return sb.toString();
}
public UnconfinedTestDispatcherImpl(TestCoroutineScheduler testCoroutineScheduler, String str) {
this.scheduler = testCoroutineScheduler;
this.name = str;
}
}

View File

@@ -0,0 +1,96 @@
package kotlinx.coroutines.test.internal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.internal.ExceptionSuccessfullyProcessed;
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010%\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\"\u0010\u0010\u001a\u00020\t2\u0006\u0010\u0011\u001a\u00020\u00062\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\t0\u0007J\u0013\u0010\u0013\u001a\u00020\u000b2\b\u0010\u0014\u001a\u0004\u0018\u00010\u0006H\u0096\u0002J\u000e\u0010\u0015\u001a\u00020\u000b2\u0006\u0010\u0016\u001a\u00020\bJ\u0018\u0010\u0015\u001a\u00020\t2\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0016\u001a\u00020\bH\u0016J\u000e\u0010\u0019\u001a\u00020\t2\u0006\u0010\u0011\u001a\u00020\u0006J\u0010\u0010\u001a\u001a\u00020\u000b2\u0006\u0010\u0016\u001a\u00020\bH\u0002R&\u0010\u0004\u001a\u001a\u0012\u0004\u0012\u00020\u0006\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\t0\u00070\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\f\u001a\u00060\u0006j\u0002`\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\b0\u000fX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001b"}, d2 = {"Lkotlinx/coroutines/test/internal/ExceptionCollector;", "Lkotlin/coroutines/AbstractCoroutineContextElement;", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "()V", "callbacks", "", "", "Lkotlin/Function1;", "", "", "enabled", "", "lock", "Lkotlinx/coroutines/internal/SynchronizedObject;", "unprocessedExceptions", "", "addOnExceptionCallback", "owner", "callback", "equals", "other", "handleException", "exception", "context", "Lkotlin/coroutines/CoroutineContext;", "removeOnExceptionCallback", "reportException", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nExceptionCollector.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ExceptionCollector.kt\nkotlinx/coroutines/test/internal/ExceptionCollector\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,101:1\n28#2,4:102\n28#2,4:109\n28#2,4:114\n20#3:106\n20#3:113\n20#3:118\n1855#4,2:107\n*S KotlinDebug\n*F\n+ 1 ExceptionCollector.kt\nkotlinx/coroutines/test/internal/ExceptionCollector\n*L\n33#1:102,4\n45#1:109,4\n58#1:114,4\n33#1:106\n45#1:113\n58#1:118\n38#1:107,2\n*E\n"})
/* loaded from: classes3.dex */
public final class ExceptionCollector extends AbstractCoroutineContextElement implements CoroutineExceptionHandler {
private static boolean enabled;
public static final ExceptionCollector INSTANCE = new ExceptionCollector();
private static final Object lock = new Object();
private static final List<Throwable> unprocessedExceptions = new ArrayList();
private static final Map<Object, Function1<Throwable, Unit>> callbacks = new LinkedHashMap();
private ExceptionCollector() {
super(CoroutineExceptionHandler.INSTANCE);
}
private final boolean reportException(Throwable exception) {
Iterator<Function1<Throwable, Unit>> it = callbacks.values().iterator();
boolean z3 = false;
while (it.hasNext()) {
it.next().invoke(exception);
z3 = true;
}
return z3;
}
public final void addOnExceptionCallback(Object owner, Function1<? super Throwable, Unit> callback) {
synchronized (lock) {
try {
enabled = true;
if (callbacks.put(owner, callback) != null) {
throw new IllegalStateException("Check failed.");
}
Iterator<T> it = unprocessedExceptions.iterator();
while (it.hasNext()) {
INSTANCE.reportException((Throwable) it.next());
}
unprocessedExceptions.clear();
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
public boolean equals(Object other) {
return (other instanceof ExceptionCollector) || (other instanceof ExceptionCollectorAsService);
}
public final boolean handleException(Throwable exception) {
synchronized (lock) {
if (!enabled) {
return false;
}
if (INSTANCE.reportException(exception)) {
return true;
}
unprocessedExceptions.add(exception);
return false;
}
}
public final void removeOnExceptionCallback(Object owner) {
synchronized (lock) {
try {
if (enabled && callbacks.remove(owner) == null) {
throw new IllegalStateException("Check failed.");
}
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
@Override // kotlinx.coroutines.CoroutineExceptionHandler
public void handleException(CoroutineContext context, Throwable exception) {
if (handleException(exception)) {
throw ExceptionSuccessfullyProcessed.INSTANCE;
}
}
}

View File

@@ -0,0 +1,50 @@
package kotlinx.coroutines.test.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineExceptionHandler;
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0013\u0010\u0007\u001a\u00020\b2\b\u0010\t\u001a\u0004\u0018\u00010\nH\u0096\u0002J6\u0010\u000b\u001a\u0002H\f\"\u0004\b\u0000\u0010\f2\u0006\u0010\r\u001a\u0002H\f2\u0018\u0010\u000e\u001a\u0014\u0012\u0004\u0012\u0002H\f\u0012\u0004\u0012\u00020\u0010\u0012\u0004\u0012\u0002H\f0\u000fH\u0096\u0001¢\u0006\u0002\u0010\u0011J(\u0010\u0012\u001a\u0004\u0018\u0001H\u0013\"\b\b\u0000\u0010\u0013*\u00020\u00102\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u0002H\u00130\u0004H\u0096\u0003¢\u0006\u0002\u0010\u0014J\u0019\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001aH\u0096\u0001J\b\u0010\u001b\u001a\u00020\u001cH\u0016J\u0015\u0010\u001d\u001a\u00020\u00182\n\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004H\u0096\u0001J\u0011\u0010\u001e\u001a\u00020\u00182\u0006\u0010\u0017\u001a\u00020\u0018H\u0096\u0003R\u0016\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004X\u0096\u0005¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u001f"}, d2 = {"Lkotlinx/coroutines/test/internal/ExceptionCollectorAsService;", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "()V", "key", "Lkotlin/coroutines/CoroutineContext$Key;", "getKey", "()Lkotlin/coroutines/CoroutineContext$Key;", "equals", "", "other", "", "fold", "R", "initial", "operation", "Lkotlin/Function2;", "Lkotlin/coroutines/CoroutineContext$Element;", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;", "get", "E", "(Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element;", "handleException", "", "context", "Lkotlin/coroutines/CoroutineContext;", "exception", "", "hashCode", "", "minusKey", "plus", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class ExceptionCollectorAsService implements CoroutineExceptionHandler {
private final /* synthetic */ ExceptionCollector $$delegate_0 = ExceptionCollector.INSTANCE;
public boolean equals(Object other) {
return (other instanceof ExceptionCollectorAsService) || (other instanceof ExceptionCollector);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <R> R fold(R initial, Function2<? super R, ? super CoroutineContext.Element, ? extends R> operation) {
return (R) this.$$delegate_0.fold(initial, operation);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key<E> key) {
return (E) this.$$delegate_0.get(key);
}
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key<?> getKey() {
return this.$$delegate_0.getKey();
}
@Override // kotlinx.coroutines.CoroutineExceptionHandler
public void handleException(CoroutineContext context, Throwable exception) {
this.$$delegate_0.handleException(context, exception);
}
public int hashCode() {
return ExceptionCollector.INSTANCE.hashCode();
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key<?> key) {
return this.$$delegate_0.minusKey(key);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext context) {
return this.$$delegate_0.plus(context);
}
}

View File

@@ -0,0 +1,44 @@
package kotlinx.coroutines.test.internal;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.JobImpl;
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u0001B%\u0012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005¢\u0006\u0002\u0010\bJ\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u0006H\u0016R\u001d\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\\u0006\u000e"}, d2 = {"Lkotlinx/coroutines/test/internal/ReportingSupervisorJob;", "Lkotlinx/coroutines/JobImpl;", "parent", "Lkotlinx/coroutines/Job;", "onChildCancellation", "Lkotlin/Function1;", "", "", "(Lkotlinx/coroutines/Job;Lkotlin/jvm/functions/Function1;)V", "getOnChildCancellation", "()Lkotlin/jvm/functions/Function1;", "childCancelled", "", "cause", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nReportingSupervisorJob.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ReportingSupervisorJob.kt\nkotlinx/coroutines/test/internal/ReportingSupervisorJob\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,25:1\n1#2:26\n*E\n"})
/* loaded from: classes3.dex */
public final class ReportingSupervisorJob extends JobImpl {
private final Function1<Throwable, Unit> onChildCancellation;
public /* synthetic */ ReportingSupervisorJob(Job job, Function1 function1, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? null : job, function1);
}
@Override // kotlinx.coroutines.JobSupport
public boolean childCancelled(Throwable cause) {
try {
this.onChildCancellation.invoke(cause);
} catch (Throwable th) {
ExceptionsKt.addSuppressed(cause, th);
CoroutineExceptionHandlerKt.handleCoroutineException(this, cause);
}
Unit unit = Unit.INSTANCE;
return false;
}
public final Function1<Throwable, Unit> getOnChildCancellation() {
return this.onChildCancellation;
}
/* JADX WARN: Multi-variable type inference failed */
public ReportingSupervisorJob(Job job, Function1<? super Throwable, Unit> function1) {
super(job);
this.onChildCancellation = function1;
}
}

View File

@@ -0,0 +1,231 @@
package kotlinx.coroutines.test.internal;
import C.w;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.DefaultExecutorKt;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.MainCoroutineDispatcher;
import kotlinx.coroutines.test.TestCoroutineScheduler;
import kotlinx.coroutines.test.TestDispatcher;
@Metadata(d1 = {"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0000\u0018\u0000 \"2\u00020\u00012\u00020\u0002:\u0002\"#B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u001c\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0016J\u001c\u0010\u0015\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0016J$\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u00142\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\u0010\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\u0006\u0010\u001c\u001a\u00020\u000fJ\u001e\u0010\u001d\u001a\u00020\u000f2\u0006\u0010\u0018\u001a\u00020\u00192\f\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020\u000f0\u001fH\u0016J\u000e\u0010 \u001a\u00020\u000f2\u0006\u0010!\u001a\u00020\u0004R\u0014\u0010\u0006\u001a\u00020\u00028BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\bR\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00040\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\u00020\u00018VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\r\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006$"}, d2 = {"Lkotlinx/coroutines/test/internal/TestMainDispatcher;", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "Lkotlinx/coroutines/Delay;", "delegate", "Lkotlinx/coroutines/CoroutineDispatcher;", "(Lkotlinx/coroutines/CoroutineDispatcher;)V", "delay", "getDelay", "()Lkotlinx/coroutines/Delay;", "Lkotlinx/coroutines/test/internal/TestMainDispatcher$NonConcurrentlyModifiable;", "immediate", "getImmediate", "()Lkotlinx/coroutines/MainCoroutineDispatcher;", "mainDispatcher", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchYield", "invokeOnTimeout", "Lkotlinx/coroutines/DisposableHandle;", "timeMillis", "", "isDispatchNeeded", "", "resetDispatcher", "scheduleResumeAfterDelay", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "setDispatcher", "dispatcher", "Companion", "NonConcurrentlyModifiable", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestMainDispatcher.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestMainDispatcher.kt\nkotlinx/coroutines/test/internal/TestMainDispatcher\n+ 2 TestMainDispatcher.kt\nkotlinx/coroutines/test/internal/TestMainDispatcherKt\n*L\n1#1,100:1\n96#2:101\n*S KotlinDebug\n*F\n+ 1 TestMainDispatcher.kt\nkotlinx/coroutines/test/internal/TestMainDispatcher\n*L\n24#1:101\n*E\n"})
/* loaded from: classes3.dex */
public final class TestMainDispatcher extends MainCoroutineDispatcher implements Delay {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private NonConcurrentlyModifiable<CoroutineDispatcher> delegate;
private final CoroutineDispatcher mainDispatcher;
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u0004\u0018\u00010\u00048@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006R\u0016\u0010\u0007\u001a\u0004\u0018\u00010\b8@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\\u0006\u000b"}, d2 = {"Lkotlinx/coroutines/test/internal/TestMainDispatcher$Companion;", "", "()V", "currentTestDispatcher", "Lkotlinx/coroutines/test/TestDispatcher;", "getCurrentTestDispatcher$kotlinx_coroutines_test", "()Lkotlinx/coroutines/test/TestDispatcher;", "currentTestScheduler", "Lkotlinx/coroutines/test/TestCoroutineScheduler;", "getCurrentTestScheduler$kotlinx_coroutines_test", "()Lkotlinx/coroutines/test/TestCoroutineScheduler;", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final TestDispatcher getCurrentTestDispatcher$kotlinx_coroutines_test() {
NonConcurrentlyModifiable nonConcurrentlyModifiable;
MainCoroutineDispatcher main = Dispatchers.getMain();
TestMainDispatcher testMainDispatcher = main instanceof TestMainDispatcher ? (TestMainDispatcher) main : null;
CoroutineDispatcher coroutineDispatcher = (testMainDispatcher == null || (nonConcurrentlyModifiable = testMainDispatcher.delegate) == null) ? null : (CoroutineDispatcher) nonConcurrentlyModifiable.getValue();
if (coroutineDispatcher instanceof TestDispatcher) {
return (TestDispatcher) coroutineDispatcher;
}
return null;
}
public final TestCoroutineScheduler getCurrentTestScheduler$kotlinx_coroutines_test() {
TestDispatcher currentTestDispatcher$kotlinx_coroutines_test = getCurrentTestDispatcher$kotlinx_coroutines_test();
if (currentTestDispatcher$kotlinx_coroutines_test != null) {
return currentTestDispatcher$kotlinx_coroutines_test.getScheduler();
}
return null;
}
private Companion() {
}
}
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0002\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002B\u0015\u0012\u0006\u0010\u0003\u001a\u00028\u0000\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0014\u0010\u0014\u001a\u00060\u0015j\u0002`\u00162\u0006\u0010\u0017\u001a\u00020\nH\u0002J\u0014\u0010\u0018\u001a\u00060\u0015j\u0002`\u00162\u0006\u0010\u0017\u001a\u00020\nH\u0002R\u000f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00028\u00000\bX\u0082\u0004R\u0011\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\bX\u0082\u0004R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u000b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\bX\u0082\u0004R\t\u0010\f\u001a\u00020\rX\u0082\u0004R$\u0010\u000e\u001a\u00028\u00002\u0006\u0010\u000e\u001a\u00028\u00008F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u0011\u0010\u0013\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\bX\u0082\u0004¨\u0006\u0019"}, d2 = {"Lkotlinx/coroutines/test/internal/TestMainDispatcher$NonConcurrentlyModifiable;", "T", "", "initialValue", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "(Ljava/lang/Object;Ljava/lang/String;)V", "_value", "Lkotlinx/atomicfu/AtomicRef;", "exceptionWhenReading", "", "reader", "readers", "Lkotlinx/atomicfu/AtomicInt;", "value", "getValue", "()Ljava/lang/Object;", "setValue", "(Ljava/lang/Object;)V", "writer", "concurrentRW", "Ljava/lang/IllegalStateException;", "Lkotlin/IllegalStateException;", FirebaseAnalytics.Param.LOCATION, "concurrentWW", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestMainDispatcher.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestMainDispatcher.kt\nkotlinx/coroutines/test/internal/TestMainDispatcher$NonConcurrentlyModifiable\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,100:1\n1#2:101\n*E\n"})
/* loaded from: classes3.dex */
public static final class NonConcurrentlyModifiable<T> {
private volatile /* synthetic */ Object _value$volatile;
private volatile /* synthetic */ Object exceptionWhenReading$volatile;
private final String name;
private volatile /* synthetic */ Object reader$volatile;
private volatile /* synthetic */ int readers$volatile;
private volatile /* synthetic */ Object writer$volatile;
private static final /* synthetic */ AtomicReferenceFieldUpdater reader$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(NonConcurrentlyModifiable.class, Object.class, "reader$volatile");
private static final /* synthetic */ AtomicIntegerFieldUpdater readers$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(NonConcurrentlyModifiable.class, "readers$volatile");
private static final /* synthetic */ AtomicReferenceFieldUpdater writer$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(NonConcurrentlyModifiable.class, Object.class, "writer$volatile");
private static final /* synthetic */ AtomicReferenceFieldUpdater exceptionWhenReading$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(NonConcurrentlyModifiable.class, Object.class, "exceptionWhenReading$volatile");
private static final /* synthetic */ AtomicReferenceFieldUpdater _value$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(NonConcurrentlyModifiable.class, Object.class, "_value$volatile");
public NonConcurrentlyModifiable(T t2, String str) {
this.name = str;
this._value$volatile = t2;
}
private final IllegalStateException concurrentRW(Throwable location) {
return new IllegalStateException(w.r(new StringBuilder(), this.name, " is used concurrently with setting it"), location);
}
private final IllegalStateException concurrentWW(Throwable location) {
return new IllegalStateException(w.r(new StringBuilder(), this.name, " is modified concurrently"), location);
}
private final /* synthetic */ Object getExceptionWhenReading$volatile() {
return this.exceptionWhenReading$volatile;
}
private final /* synthetic */ Object getReader$volatile() {
return this.reader$volatile;
}
private final /* synthetic */ int getReaders$volatile() {
return this.readers$volatile;
}
private final /* synthetic */ Object getWriter$volatile() {
return this.writer$volatile;
}
private final /* synthetic */ Object get_value$volatile() {
return this._value$volatile;
}
private final /* synthetic */ void setExceptionWhenReading$volatile(Object obj) {
this.exceptionWhenReading$volatile = obj;
}
private final /* synthetic */ void setReader$volatile(Object obj) {
this.reader$volatile = obj;
}
private final /* synthetic */ void setReaders$volatile(int i) {
this.readers$volatile = i;
}
private final /* synthetic */ void setWriter$volatile(Object obj) {
this.writer$volatile = obj;
}
private final /* synthetic */ void set_value$volatile(Object obj) {
this._value$volatile = obj;
}
public final T getValue() {
reader$volatile$FU.set(this, new Throwable("reader location"));
readers$volatile$FU.incrementAndGet(this);
Throwable th = (Throwable) writer$volatile$FU.get(this);
if (th != null) {
exceptionWhenReading$volatile$FU.set(this, concurrentRW(th));
}
T t2 = (T) _value$volatile$FU.get(this);
readers$volatile$FU.decrementAndGet(this);
return t2;
}
public final void setValue(T t2) {
Throwable th;
Throwable th2;
Throwable th3 = (Throwable) exceptionWhenReading$volatile$FU.getAndSet(this, null);
if (th3 != null) {
throw th3;
}
if (readers$volatile$FU.get(this) != 0 && (th2 = (Throwable) reader$volatile$FU.get(this)) != null) {
throw concurrentRW(th2);
}
Throwable th4 = new Throwable("other writer location");
Throwable th5 = (Throwable) writer$volatile$FU.getAndSet(this, th4);
if (th5 != null) {
throw concurrentWW(th5);
}
_value$volatile$FU.set(this, t2);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = writer$volatile$FU;
while (!atomicReferenceFieldUpdater.compareAndSet(this, th4, null) && atomicReferenceFieldUpdater.get(this) == th4) {
}
if (readers$volatile$FU.get(this) != 0 && (th = (Throwable) reader$volatile$FU.get(this)) != null) {
throw concurrentRW(th);
}
}
}
public TestMainDispatcher(CoroutineDispatcher coroutineDispatcher) {
this.mainDispatcher = coroutineDispatcher;
this.delegate = new NonConcurrentlyModifiable<>(coroutineDispatcher, "Dispatchers.Main");
}
private final Delay getDelay() {
CoroutineContext.Element value = this.delegate.getValue();
Delay delay = value instanceof Delay ? (Delay) value : null;
return delay == null ? DefaultExecutorKt.getDefaultDelay() : delay;
}
@Override // kotlinx.coroutines.Delay
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement as an internal method never intended for public use")
public Object delay(long j4, Continuation<? super Unit> continuation) {
return Delay.DefaultImpls.delay(this, j4, continuation);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo1685dispatch(CoroutineContext context, Runnable block) {
this.delegate.getValue().mo1685dispatch(context, block);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public void dispatchYield(CoroutineContext context, Runnable block) {
this.delegate.getValue().dispatchYield(context, block);
}
@Override // kotlinx.coroutines.MainCoroutineDispatcher
public MainCoroutineDispatcher getImmediate() {
MainCoroutineDispatcher immediate;
CoroutineDispatcher value = this.delegate.getValue();
MainCoroutineDispatcher mainCoroutineDispatcher = value instanceof MainCoroutineDispatcher ? (MainCoroutineDispatcher) value : null;
return (mainCoroutineDispatcher == null || (immediate = mainCoroutineDispatcher.getImmediate()) == null) ? this : immediate;
}
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long timeMillis, Runnable block, CoroutineContext context) {
return getDelay().invokeOnTimeout(timeMillis, block, context);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public boolean isDispatchNeeded(CoroutineContext context) {
return this.delegate.getValue().isDispatchNeeded(context);
}
public final void resetDispatcher() {
this.delegate.setValue(this.mainDispatcher);
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo1686scheduleResumeAfterDelay(long timeMillis, CancellableContinuation<? super Unit> continuation) {
getDelay().mo1686scheduleResumeAfterDelay(timeMillis, continuation);
}
public final void setDispatcher(CoroutineDispatcher dispatcher) {
this.delegate.setValue(dispatcher);
}
}

View File

@@ -0,0 +1,60 @@
package kotlinx.coroutines.test.internal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.MainCoroutineDispatcher;
import kotlinx.coroutines.internal.MainDispatcherFactory;
import kotlinx.coroutines.internal.MainDispatchersKt;
import kotlinx.coroutines.internal.MissingMainCoroutineDispatcherFactory;
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0007\u001a\u00020\b2\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00010\nH\u0016R\u0014\u0010\u0003\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000b"}, d2 = {"Lkotlinx/coroutines/test/internal/TestMainDispatcherFactory;", "Lkotlinx/coroutines/internal/MainDispatcherFactory;", "()V", "loadPriority", "", "getLoadPriority", "()I", "createDispatcher", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "allFactories", "", "kotlinx-coroutines-test"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestMainDispatcherJvm.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestMainDispatcherJvm.kt\nkotlinx/coroutines/test/internal/TestMainDispatcherFactory\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,31:1\n766#2:32\n857#2,2:33\n1963#2,14:35\n*S KotlinDebug\n*F\n+ 1 TestMainDispatcherJvm.kt\nkotlinx/coroutines/test/internal/TestMainDispatcherFactory\n*L\n13#1:32\n13#1:33,2\n14#1:35,14\n*E\n"})
/* loaded from: classes3.dex */
public final class TestMainDispatcherFactory implements MainDispatcherFactory {
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public MainCoroutineDispatcher createDispatcher(List<? extends MainDispatcherFactory> allFactories) {
Object obj;
ArrayList arrayList = new ArrayList();
for (Object obj2 : allFactories) {
if (((MainDispatcherFactory) obj2) != this) {
arrayList.add(obj2);
}
}
Iterator it = arrayList.iterator();
if (it.hasNext()) {
Object next = it.next();
if (it.hasNext()) {
int loadPriority = ((MainDispatcherFactory) next).getLoadPriority();
do {
Object next2 = it.next();
int loadPriority2 = ((MainDispatcherFactory) next2).getLoadPriority();
if (loadPriority < loadPriority2) {
next = next2;
loadPriority = loadPriority2;
}
} while (it.hasNext());
}
obj = next;
} else {
obj = null;
}
MainDispatcherFactory mainDispatcherFactory = (MainDispatcherFactory) obj;
if (mainDispatcherFactory == null) {
mainDispatcherFactory = MissingMainCoroutineDispatcherFactory.INSTANCE;
}
return new TestMainDispatcher(MainDispatchersKt.tryCreateDispatcher(mainDispatcherFactory, arrayList));
}
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public int getLoadPriority() {
return Integer.MAX_VALUE;
}
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public String hintOnError() {
return MainDispatcherFactory.DefaultImpls.hintOnError(this);
}
}

View File

@@ -0,0 +1,19 @@
package kotlinx.coroutines.test.internal;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.MainCoroutineDispatcher;
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u001a\f\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0000¨\u0006\u0003"}, d2 = {"getTestMainDispatcher", "Lkotlinx/coroutines/test/internal/TestMainDispatcher;", "Lkotlinx/coroutines/Dispatchers;", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nTestMainDispatcherJvm.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestMainDispatcherJvm.kt\nkotlinx/coroutines/test/internal/TestMainDispatcherJvmKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,31:1\n1#2:32\n*E\n"})
/* loaded from: classes3.dex */
public final class TestMainDispatcherJvmKt {
public static final TestMainDispatcher getTestMainDispatcher(Dispatchers dispatchers) {
MainCoroutineDispatcher main = Dispatchers.getMain();
if (main instanceof TestMainDispatcher) {
return (TestMainDispatcher) main;
}
throw new IllegalArgumentException(("TestMainDispatcher is not set as main dispatcher, have " + main + " instead.").toString());
}
}

View File

@@ -0,0 +1,16 @@
package kotlinx.coroutines.test.internal;
import kotlin.Metadata;
import kotlinx.coroutines.DefaultExecutorKt;
import kotlinx.coroutines.Delay;
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\"\u001b\u0010\u0000\u001a\u00020\u00018Â\u0002X\u0082\u0004¢\u0006\f\u0012\u0004\b\u0002\u0010\u0003\u001a\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, d2 = {"defaultDelay", "Lkotlinx/coroutines/Delay;", "getDefaultDelay$annotations", "()V", "getDefaultDelay", "()Lkotlinx/coroutines/Delay;", "kotlinx-coroutines-test"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class TestMainDispatcherKt {
private static final Delay getDefaultDelay() {
return DefaultExecutorKt.getDefaultDelay();
}
private static /* synthetic */ void getDefaultDelay$annotations() {
}
}