1 // Copyright 2020 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.base.test; 6 7 import java.lang.annotation.ElementType; 8 import java.lang.annotation.Retention; 9 import java.lang.annotation.RetentionPolicy; 10 import java.lang.annotation.Target; 11 12 /** 13 * Annotation that runs a test method on the UI thread. 14 * 15 * This is used in place of androidx.test.annotation.UiThreadTest, as ActivityTestRule will 16 * run on the UI thread if that annotation is present, possibly causing other Rules to unexpectedly 17 * run on the UI thread as well. 18 * 19 * UiThreadTestRule should be avoided altogether, as it causes @Before and @After to run on the UI 20 * thread, which most test writers do not expect. 21 */ 22 @Target(ElementType.METHOD) 23 @Retention(RetentionPolicy.RUNTIME) 24 public @interface UiThreadTest {} 25