summaryrefslogtreecommitdiff
path: root/android/testSrc
diff options
context:
space:
mode:
authorTomasz Kosciuszko <tkosciuszko@google.com>2022-02-11 14:43:31 +0000
committerTomasz Kościuszko <tkosciuszko@google.com>2022-03-01 17:37:17 +0000
commit126520a9d24b0e53d83f087236f4560c8f96cbc8 (patch)
tree775df29ed8cd99171eca45c28f463314e5396896 /android/testSrc
parent91633b6e13121df8903a62692d91c02676c2aa69 (diff)
downloadidea-126520a9d24b0e53d83f087236f4560c8f96cbc8.tar.gz
[Surface Launching] Verify built apk manifest.
Extract manifest from the built apk and verify that the chosen complication types are supported by the Complication Source. Bug: 217191714 Tested: Manually with Android Studio, unit test. Change-Id: I25078751e0a130653db93812c771384d3cc29896
Diffstat (limited to 'android/testSrc')
-rw-r--r--android/testSrc/com/android/tools/idea/run/configuration/execution/AndroidComplicationConfigurationExecutorTest.kt14
1 files changed, 13 insertions, 1 deletions
diff --git a/android/testSrc/com/android/tools/idea/run/configuration/execution/AndroidComplicationConfigurationExecutorTest.kt b/android/testSrc/com/android/tools/idea/run/configuration/execution/AndroidComplicationConfigurationExecutorTest.kt
index 989d0383bd4..4c405e23dbf 100644
--- a/android/testSrc/com/android/tools/idea/run/configuration/execution/AndroidComplicationConfigurationExecutorTest.kt
+++ b/android/testSrc/com/android/tools/idea/run/configuration/execution/AndroidComplicationConfigurationExecutorTest.kt
@@ -19,12 +19,15 @@ package com.android.tools.idea.run.configuration.execution
import com.android.ddmlib.IShellOutputReceiver
import com.android.testutils.MockitoKt.any
import com.android.tools.deployer.model.component.AppComponent
-import com.android.tools.deployer.model.component.Complication
+import com.android.tools.deployer.model.component.Complication.ComplicationType.RANGED_VALUE
+import com.android.tools.deployer.model.component.Complication.ComplicationType.SHORT_TEXT
+import com.android.tools.deployer.model.component.Complication.ComplicationType.LONG_TEXT
import com.android.tools.idea.run.configuration.AndroidComplicationConfiguration
import com.android.tools.idea.run.configuration.AndroidComplicationConfigurationType
import com.android.tools.idea.run.configuration.AndroidConfigurationProgramRunner
import com.android.tools.idea.run.configuration.ComplicationSlot
import com.android.tools.idea.run.configuration.ComplicationWatchFaceInfo
+import com.android.tools.deployer.model.component.Complication
import com.google.common.truth.Truth.assertThat
import com.intellij.execution.RunManager
import com.intellij.execution.executors.DefaultDebugExecutor
@@ -105,6 +108,9 @@ class AndroidComplicationConfigurationExecutorTest : AndroidConfigurationExecuto
)
doReturn(appInstaller).`when`(executor).getApplicationInstaller(any())
+ // Mock the binary xml extraction.
+ doReturn(listOf(RANGED_VALUE, SHORT_TEXT, LONG_TEXT)).`when`(executor).getComplicationSourceTypes(any())
+
val runContentDescriptor = executor.doOnDevices(listOf(device)).blockingGet(1000)!!
// Verify commands sent to device.
@@ -195,6 +201,9 @@ class AndroidComplicationConfigurationExecutorTest : AndroidConfigurationExecuto
)
doReturn(appInstaller).`when`(executor).getApplicationInstaller(any())
+ // Mock the binary xml extraction.
+ doReturn(listOf(RANGED_VALUE, SHORT_TEXT, LONG_TEXT)).`when`(executor).getComplicationSourceTypes(any())
+
val runContentDescriptor = executor.doOnDevices(listOf(device)).blockingGet(1000)
assertThat(runContentDescriptor!!.processHandler).isNotNull()
@@ -271,6 +280,9 @@ class AndroidComplicationConfigurationExecutorTest : AndroidConfigurationExecuto
)
doReturn(appInstaller).`when`(executor).getApplicationInstaller(any())
+ // Mock the binary xml extraction.
+ doReturn(listOf(RANGED_VALUE, SHORT_TEXT, LONG_TEXT)).`when`(executor).getComplicationSourceTypes(any())
+
val runContentDescriptor = executor.doOnDevices(listOf(device)).blockingGet(1000)!!
// Verify that a warning was raised in console.