[go: nahoru, domu]

Introduce experimental annotation in testing

Also hide / annotate benchmarking helpers that areno not ready to be
used.

Bug: 158820196
Test: N/A
Change-Id: Ib5737fa832c0f0c575b1c5b297ceccf21e89f17f
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
index 111e6b44..157633f 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
@@ -20,6 +20,7 @@
 import androidx.ui.test.assertMeasureSizeIsPositive
 import androidx.ui.test.assertNoPendingChanges
 import androidx.ui.integration.test.material.CheckboxesInRowsTestCase
+import androidx.ui.test.ExperimentalTesting
 import androidx.ui.test.createComposeRule
 import org.junit.Rule
 import org.junit.Test
@@ -31,6 +32,7 @@
  */
 @MediumTest
 @RunWith(Parameterized::class)
+@OptIn(ExperimentalTesting::class)
 class CheckboxesInRowsTest(private val numberOfCheckboxes: Int) {
 
     companion object {
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ColorPaletteTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ColorPaletteTest.kt
index ca6b5ae..c872f60 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ColorPaletteTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ColorPaletteTest.kt
@@ -20,6 +20,7 @@
 import androidx.ui.test.assertNoPendingChanges
 import androidx.ui.integration.test.material.ImmutableColorPaletteTestCase
 import androidx.ui.integration.test.material.ObservableColorPaletteTestCase
+import androidx.ui.test.ExperimentalTesting
 import androidx.ui.test.createComposeRule
 import androidx.ui.test.doFramesUntilNoChangesPending
 import org.junit.Assert
@@ -34,6 +35,7 @@
  */
 @MediumTest
 @RunWith(JUnit4::class)
+@OptIn(ExperimentalTesting::class)
 class ColorPaletteTest {
     @get:Rule
     val composeTestRule = createComposeRule(disableTransitions = true)
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
index e45e040..e933b87 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
@@ -20,6 +20,7 @@
 import androidx.ui.test.assertMeasureSizeIsPositive
 import androidx.ui.test.assertNoPendingChanges
 import androidx.ui.integration.test.foundation.RectsInColumnSharedModelTestCase
+import androidx.ui.test.ExperimentalTesting
 import androidx.ui.test.createComposeRule
 import org.junit.Rule
 import org.junit.Test
@@ -31,6 +32,7 @@
  */
 @MediumTest
 @RunWith(Parameterized::class)
+@OptIn(ExperimentalTesting::class)
 class RectsInColumnSharedModelTest(private val numberOfRectangles: Int) {
 
     companion object {
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
index 82d6dbc..ff6bbe6 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
@@ -20,6 +20,7 @@
 import androidx.ui.test.assertMeasureSizeIsPositive
 import androidx.ui.test.assertNoPendingChanges
 import androidx.ui.integration.test.foundation.RectsInColumnTestCase
+import androidx.ui.test.ExperimentalTesting
 import androidx.ui.test.createComposeRule
 import org.junit.Rule
 import org.junit.Test
@@ -31,6 +32,7 @@
  */
 @MediumTest
 @RunWith(Parameterized::class)
+@OptIn(ExperimentalTesting::class)
 class RectsInColumnTest(private val numberOfRectangles: Int) {
 
     companion object {
diff --git a/ui/ui-test/api/0.1.0-dev14.txt b/ui/ui-test/api/0.1.0-dev14.txt
index 3e96191..dcec23a 100644
--- a/ui/ui-test/api/0.1.0-dev14.txt
+++ b/ui/ui-test/api/0.1.0-dev14.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.rule.ActivityTestRule<T> activityTestRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.rule.ActivityTestRule<T> getActivityTestRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/api/current.txt b/ui/ui-test/api/current.txt
index aae1c4c..22cc8d6 100644
--- a/ui/ui-test/api/current.txt
+++ b/ui/ui-test/api/current.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions, boolean disableBlinkingCursor);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
index 3e96191..dcec23a 100644
--- a/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.rule.ActivityTestRule<T> activityTestRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.rule.ActivityTestRule<T> getActivityTestRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/api/public_plus_experimental_current.txt b/ui/ui-test/api/public_plus_experimental_current.txt
index aae1c4c..22cc8d6 100644
--- a/ui/ui-test/api/public_plus_experimental_current.txt
+++ b/ui/ui-test/api/public_plus_experimental_current.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions, boolean disableBlinkingCursor);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/api/restricted_0.1.0-dev14.txt b/ui/ui-test/api/restricted_0.1.0-dev14.txt
index 3e96191..dcec23a 100644
--- a/ui/ui-test/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-test/api/restricted_0.1.0-dev14.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.rule.ActivityTestRule<T> activityTestRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.rule.ActivityTestRule<T> getActivityTestRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/api/restricted_current.txt b/ui/ui-test/api/restricted_current.txt
index aae1c4c..22cc8d6 100644
--- a/ui/ui-test/api/restricted_current.txt
+++ b/ui/ui-test/api/restricted_current.txt
@@ -125,8 +125,7 @@
   }
 
   public interface ComposeTestRule extends org.junit.rules.TestRule {
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
     method public android.util.DisplayMetrics getDisplayMetrics();
@@ -153,6 +152,9 @@
   public final class ErrorMessagesKt {
   }
 
+  @kotlin.RequiresOptIn(message="This testing API is experimental and is likely to be changed or removed" + " entirely") public @interface ExperimentalTesting {
+  }
+
   public final class FiltersKt {
     method public static androidx.ui.test.SemanticsMatcher hasAnyAncestorThat(androidx.ui.test.SemanticsMatcher matcher);
     method public static androidx.ui.test.SemanticsMatcher hasAnyChildThat(androidx.ui.test.SemanticsMatcher matcher);
@@ -364,8 +366,7 @@
   public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
     ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, androidx.compose.Recomposer? recomposer, boolean disableTransitions, boolean disableBlinkingCursor);
     method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
-    method public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
+    method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
     method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
     method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
     method public androidx.ui.unit.Density getDensity();
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
index bb4d99f..8c06c17 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
@@ -16,6 +16,7 @@
 
 package androidx.ui.test
 
+import androidx.compose.Composable
 import androidx.compose.mutableStateOf
 import androidx.compose.onPreCommit
 import androidx.compose.state
@@ -36,8 +37,20 @@
         disableTransitions = true
     )
 
+    internal fun ComposeTestRule.forGivenContent(
+        composable: @Composable () -> Unit
+    ): ComposeTestCaseSetup {
+        @OptIn(ExperimentalTesting::class)
+        return forGivenTestCase(object : ComposeTestCase {
+            @Composable
+            override fun emitContent() {
+                composable()
+            }
+        })
+    }
+
     @Test
-    fun foreverRecomposing_viaModel_shouldFail() {
+    fun foreverRecomposing_viaModel_shouldFai2l() {
         val count = mutableStateOf(0)
         composeTestRule.forGivenContent {
             Text("Hello ${count.value}")
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt b/ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt
index ac8f4b0..97a593d 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt
@@ -54,15 +54,10 @@
     fun setContent(composable: @Composable () -> Unit)
 
     /**
-     * Takes the given content and prepares it for execution-controlled test via
-     * [ComposeTestCaseSetup].
-     */
-    fun forGivenContent(composable: @Composable () -> Unit): ComposeTestCaseSetup
-
-    /**
      * Takes the given test case and prepares it for execution-controlled test via
      * [ComposeTestCaseSetup].
      */
+    @ExperimentalTesting
     fun forGivenTestCase(testCase: ComposeTestCase): ComposeTestCaseSetup
 
     // TODO(pavlis): Provide better abstraction for host side reusability
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/ExperimentalTesting.kt b/ui/ui-test/src/main/java/androidx/ui/test/ExperimentalTesting.kt
new file mode 100644
index 0000000..9968f46
--- /dev/null
+++ b/ui/ui-test/src/main/java/androidx/ui/test/ExperimentalTesting.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.test
+
+@RequiresOptIn("This testing API is experimental and is likely to be changed or removed" +
+        " entirely")
+annotation class ExperimentalTesting
\ No newline at end of file
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt
index 389fc72..29cdc5e 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt
@@ -31,6 +31,7 @@
 import androidx.ui.test.ComposeTestCase
 import androidx.ui.test.ComposeTestCaseSetup
 import androidx.ui.test.ComposeTestRule
+import androidx.ui.test.ExperimentalTesting
 import androidx.ui.test.TextInputServiceForTests
 import androidx.ui.test.isOnUiThread
 import androidx.ui.test.runOnUiThread
@@ -141,15 +142,7 @@
         }
     }
 
-    override fun forGivenContent(composable: @Composable () -> Unit): ComposeTestCaseSetup {
-        return forGivenTestCase(object : ComposeTestCase {
-            @Composable
-            override fun emitContent() {
-                composable()
-            }
-        })
-    }
-
+    @ExperimentalTesting
     override fun forGivenTestCase(testCase: ComposeTestCase): ComposeTestCaseSetup {
         return AndroidComposeTestCaseSetup(
             testCase,