Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a444d475 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure TrampolineActivityTest runs when flag enabled" into main

parents e155040f 24fd735c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@ package com.android.documentsui

import android.content.Intent
import android.os.Build.VERSION_CODES
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.CheckFlagsRule
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -24,11 +27,13 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.android.documentsui.flags.Flags.FLAG_REDIRECT_GET_CONTENT
import com.android.documentsui.picker.TrampolineActivity
import java.util.regex.Pattern
import org.junit.Assert.assertNotNull
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@@ -57,6 +62,7 @@ class TrampolineActivityTest() {
    }

    @RunWith(Parameterized::class)
    @RequiresFlagsEnabled(FLAG_REDIRECT_GET_CONTENT)
    class ShouldLaunchCorrectPackageTest {
        enum class AppType {
            PHOTOPICKER,
@@ -129,6 +135,9 @@ class TrampolineActivityTest() {
        @Parameterized.Parameter(0)
        lateinit var testData: GetContentIntentData

        @get:Rule
        val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()

        @Before
        fun setUp() {
            val context = InstrumentationRegistry.getInstrumentation().targetContext
@@ -153,7 +162,11 @@ class TrampolineActivityTest() {
    }

    @RunWith(AndroidJUnit4::class)
    @RequiresFlagsEnabled(FLAG_REDIRECT_GET_CONTENT)
    class RedirectTest {
        @get:Rule
        val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()

        @Test
        fun testReferredGetContentFromPhotopickerShouldNotRedirectBack() {
            val context = InstrumentationRegistry.getInstrumentation().targetContext