Loading services/tests/servicestests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ android_test { "test-apps/SuspendTestApp/src/**/*.java", ], kotlincflags: [ "-Werror", ], static_libs: [ "frameworks-base-testutils", "services.accessibility", Loading services/tests/servicestests/src/com/android/server/om/OverlayActorEnforcerTests.kt +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class OverlayActorEnforcerTests { @BeforeClass @JvmStatic fun checkAllCasesUniquelyNamed() { val duplicateCaseNames = CASES.mapIndexed { caseIndex, testCase -> val duplicateCaseNames = CASES.mapIndexed { _, testCase -> testCase.failures.map { makeTestName(testCase, it.first, Params.Type.FAILURE) } + testCase.allowed.map { Loading services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigNamedActorTest.kt +9 −15 Original line number Diff line number Diff line Loading @@ -18,12 +18,13 @@ package com.android.server.systemconfig import android.content.Context import android.util.Xml import androidx.test.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry import com.android.server.SystemConfig import com.google.common.truth.Truth.assertThat import org.junit.Assert.assertEquals import org.junit.Assert.assertThrows import org.junit.Rule import org.junit.Test import org.junit.rules.ExpectedException import org.junit.rules.TemporaryFolder class SystemConfigNamedActorTest { Loading @@ -37,14 +38,11 @@ class SystemConfigNamedActorTest { private const val PACKAGE_TWO = "com.test.actor.two" } private val context: Context = InstrumentationRegistry.getContext() private val context: Context = InstrumentationRegistry.getInstrumentation().context @get:Rule val tempFolder = TemporaryFolder(context.filesDir) @get:Rule val expected = ExpectedException.none() private var uniqueCounter = 0 @Test Loading Loading @@ -193,11 +191,9 @@ class SystemConfigNamedActorTest { </config> """.write() expected.expect(IllegalStateException::class.java) expected.expectMessage("Defining $ACTOR_ONE as $PACKAGE_ONE " + val exc = assertThrows(IllegalStateException::class.java) { assertPermissions() } assertEquals(exc.message, "Defining $ACTOR_ONE as $PACKAGE_ONE " + "for the android namespace is not allowed") assertPermissions() } @Test Loading @@ -217,11 +213,9 @@ class SystemConfigNamedActorTest { </config> """.write() expected.expect(IllegalStateException::class.java) expected.expectMessage("Duplicate actor definition for $NAMESPACE_TEST/$ACTOR_ONE;" + val exc = assertThrows(IllegalStateException::class.java) { assertPermissions() } assertEquals(exc.message, "Duplicate actor definition for $NAMESPACE_TEST/$ACTOR_ONE;" + " defined as both $PACKAGE_ONE and $PACKAGE_TWO") assertPermissions() } private fun String.write() = tempFolder.root.resolve("${uniqueCounter++}.xml") Loading Loading
services/tests/servicestests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ android_test { "test-apps/SuspendTestApp/src/**/*.java", ], kotlincflags: [ "-Werror", ], static_libs: [ "frameworks-base-testutils", "services.accessibility", Loading
services/tests/servicestests/src/com/android/server/om/OverlayActorEnforcerTests.kt +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class OverlayActorEnforcerTests { @BeforeClass @JvmStatic fun checkAllCasesUniquelyNamed() { val duplicateCaseNames = CASES.mapIndexed { caseIndex, testCase -> val duplicateCaseNames = CASES.mapIndexed { _, testCase -> testCase.failures.map { makeTestName(testCase, it.first, Params.Type.FAILURE) } + testCase.allowed.map { Loading
services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigNamedActorTest.kt +9 −15 Original line number Diff line number Diff line Loading @@ -18,12 +18,13 @@ package com.android.server.systemconfig import android.content.Context import android.util.Xml import androidx.test.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry import com.android.server.SystemConfig import com.google.common.truth.Truth.assertThat import org.junit.Assert.assertEquals import org.junit.Assert.assertThrows import org.junit.Rule import org.junit.Test import org.junit.rules.ExpectedException import org.junit.rules.TemporaryFolder class SystemConfigNamedActorTest { Loading @@ -37,14 +38,11 @@ class SystemConfigNamedActorTest { private const val PACKAGE_TWO = "com.test.actor.two" } private val context: Context = InstrumentationRegistry.getContext() private val context: Context = InstrumentationRegistry.getInstrumentation().context @get:Rule val tempFolder = TemporaryFolder(context.filesDir) @get:Rule val expected = ExpectedException.none() private var uniqueCounter = 0 @Test Loading Loading @@ -193,11 +191,9 @@ class SystemConfigNamedActorTest { </config> """.write() expected.expect(IllegalStateException::class.java) expected.expectMessage("Defining $ACTOR_ONE as $PACKAGE_ONE " + val exc = assertThrows(IllegalStateException::class.java) { assertPermissions() } assertEquals(exc.message, "Defining $ACTOR_ONE as $PACKAGE_ONE " + "for the android namespace is not allowed") assertPermissions() } @Test Loading @@ -217,11 +213,9 @@ class SystemConfigNamedActorTest { </config> """.write() expected.expect(IllegalStateException::class.java) expected.expectMessage("Duplicate actor definition for $NAMESPACE_TEST/$ACTOR_ONE;" + val exc = assertThrows(IllegalStateException::class.java) { assertPermissions() } assertEquals(exc.message, "Duplicate actor definition for $NAMESPACE_TEST/$ACTOR_ONE;" + " defined as both $PACKAGE_ONE and $PACKAGE_TWO") assertPermissions() } private fun String.write() = tempFolder.root.resolve("${uniqueCounter++}.xml") Loading