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

Commit 24fd735c authored by Ben Reich's avatar Ben Reich
Browse files

Ensure TrampolineActivityTest runs when flag enabled

Bug: 377771195
Bug: 396079775
Bug: 390960496
Test: atest com.android.documentsui.TrampolineActivityTest
Flag: com.android.documentsui.flags.redirect_get_content
Change-Id: I23fc0ecda5b338a6f3b733bc36d968d40ba01d6c
parent 4bbd3a44
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