Skip to content

Commit

Permalink
[Android] Use Looper at BytecodeTest
Browse files Browse the repository at this point in the history
classExists and checkSuperName were failing for DeveloperSettings.
Crash message said:
Can't create handler inside thread Thread[Instr: org.chromium.base.test.BaseChromiumAndroidJUnitRunner,5,main] that has not called Looper.prepare()

Related Chromium change: unclear
  • Loading branch information
AlexeyBarabash authored and emerick committed Sep 10, 2024
1 parent 26f89f6 commit 226874f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.View;
Expand All @@ -27,6 +28,7 @@
import androidx.test.filters.SmallTest;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -192,6 +194,11 @@ enum MethodModifier {
STATIC
}

@BeforeClass
public static void beforeClass() {
Looper.prepare();
}

@Test
@SmallTest
public void testClassesExist() throws Exception {
Expand Down

0 comments on commit 226874f

Please sign in to comment.