Merge "Migrate Dream Tests" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
62444ddf32
@@ -26,6 +26,32 @@
|
||||
android:testOnly="true">
|
||||
<uses-library android:name="android.test.mock" android:required="true" />
|
||||
<uses-library android:name="android.test.runner" />
|
||||
|
||||
<service
|
||||
android:name="com.android.server.dreams.TestDreamService"
|
||||
android:exported="false"
|
||||
android:label="Test Dream" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.dreams.DreamService" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.service.dream"
|
||||
android:resource="@xml/test_dream_metadata" />
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.android.server.dreams.TestDreamServiceWithInvalidSettings"
|
||||
android:exported="false"
|
||||
android:label="Test Dream" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.dreams.DreamService" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.service.dream"
|
||||
android:resource="@xml/test_dream_metadata_invalid" />
|
||||
</service>
|
||||
</application>
|
||||
|
||||
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
22
services/tests/dreamservicetests/TEST_MAPPING
Normal file
22
services/tests/dreamservicetests/TEST_MAPPING
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "DreamServiceTests",
|
||||
"options": [
|
||||
{"include-filter": "com.android.server.dreams"},
|
||||
{"exclude-annotation": "android.platform.test.annotations.FlakyTest"},
|
||||
{"exclude-annotation": "androidx.test.filters.FlakyTest"},
|
||||
{"exclude-annotation": "org.junit.Ignore"}
|
||||
]
|
||||
}
|
||||
],
|
||||
"postsubmit": [
|
||||
{
|
||||
"name": "DreamServiceTests",
|
||||
"options": [
|
||||
{"include-filter": "com.android.server.dreams"},
|
||||
{"exclude-annotation": "org.junit.Ignore"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -15,5 +15,6 @@
|
||||
-->
|
||||
|
||||
<dream xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:settingsActivity="com.android.frameworks.servicestests/.TestDreamSettingsActivity"
|
||||
android:settingsActivity=
|
||||
"com.android.frameworks.dreamservicetests/.TestDreamSettingsActivity"
|
||||
android:showClockAndComplications="false" />
|
||||
@@ -44,6 +44,7 @@ import android.os.RemoteException;
|
||||
import android.os.test.TestLooper;
|
||||
import android.service.dreams.IDreamService;
|
||||
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
@@ -231,6 +232,7 @@ public class DreamControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlakyTest(bugId = 293109503)
|
||||
public void serviceDisconnect_resetsScreenTimeout() throws RemoteException {
|
||||
// Start dream.
|
||||
mDreamController.startDream(mToken, mDreamName, false /*isPreview*/, false /*doze*/,
|
||||
@@ -250,6 +252,7 @@ public class DreamControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlakyTest(bugId = 293109503)
|
||||
public void binderDied_resetsScreenTimeout() throws RemoteException {
|
||||
// Start dream.
|
||||
mDreamController.startDream(mToken, mDreamName, false /*isPreview*/, false /*doze*/,
|
||||
@@ -35,6 +35,7 @@ import android.service.dreams.IDreamOverlayClientCallback;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
@@ -123,6 +124,7 @@ public class DreamOverlayServiceTest {
|
||||
* Verifies that callbacks for subclasses are run on the provided executor.
|
||||
*/
|
||||
@Test
|
||||
@FlakyTest(bugId = 293108088)
|
||||
public void testCallbacksRunOnExecutor() throws RemoteException {
|
||||
final TestDreamOverlayService.Monitor monitor = Mockito.mock(
|
||||
TestDreamOverlayService.Monitor.class);
|
||||
@@ -36,13 +36,13 @@ import org.junit.runner.RunWith;
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class DreamServiceTest {
|
||||
private static final String TEST_PACKAGE_NAME = "com.android.frameworks.servicestests";
|
||||
private static final String TEST_PACKAGE_NAME = "com.android.frameworks.dreamservicetests";
|
||||
|
||||
@Test
|
||||
public void testMetadataParsing() throws PackageManager.NameNotFoundException {
|
||||
final String testDreamClassName = "com.android.server.dreams.TestDreamService";
|
||||
final String testSettingsActivity =
|
||||
"com.android.frameworks.servicestests/.TestDreamSettingsActivity";
|
||||
"com.android.frameworks.dreamservicetests/.TestDreamSettingsActivity";
|
||||
final DreamService.DreamMetadata metadata = getDreamMetadata(testDreamClassName);
|
||||
|
||||
assertThat(metadata.settingsActivity).isEqualTo(
|
||||
@@ -144,32 +144,6 @@
|
||||
android:resource="@xml/test_account_type2_authenticator"/>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.android.server.dreams.TestDreamService"
|
||||
android:exported="false"
|
||||
android:label="Test Dream" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.dreams.DreamService" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.service.dream"
|
||||
android:resource="@xml/test_dream_metadata" />
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.android.server.dreams.TestDreamServiceWithInvalidSettings"
|
||||
android:exported="false"
|
||||
android:label="Test Dream" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.dreams.DreamService" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.service.dream"
|
||||
android:resource="@xml/test_dream_metadata_invalid" />
|
||||
</service>
|
||||
|
||||
<receiver android:name="com.android.server.devicepolicy.ApplicationRestrictionsTest$AdminReceiver"
|
||||
android:permission="android.permission.BIND_DEVICE_ADMIN"
|
||||
android:exported="true">
|
||||
|
||||
Reference in New Issue
Block a user