diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/Android.bp | 14 | ||||
-rw-r--r-- | tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt | 9 |
2 files changed, 19 insertions, 4 deletions
diff --git a/tests/integration/Android.bp b/tests/integration/Android.bp index 1a985a9..af63f0e 100644 --- a/tests/integration/Android.bp +++ b/tests/integration/Android.bp @@ -82,6 +82,18 @@ android_test { test_suites: ["device-tests"], } +// The static lib needs to be jarjared by each module so they do not conflict with each other +// (e.g. wifi, system server, network stack need to use different package names when including it). +// Apply NetworkStack jarjar rules to the tests as well so classes in NetworkStaticLibTests have the +// same package names as in module code. +android_library { + name: "NetworkStackStaticLibTestsLib", + platform_apis: true, + min_sdk_version: "29", + jarjar_rules: ":NetworkStackJarJarRules", + static_libs: ["NetworkStaticLibTestsLib"], +} + // Special version of the network stack tests that includes all tests necessary for code coverage // purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests. android_test { @@ -95,7 +107,7 @@ android_test { static_libs: [ "NetworkStackTestsLib", "NetworkStackIntegrationTestsLib", - "NetworkStaticLibTestsLib", + "NetworkStackStaticLibTestsLib", ], compile_multilib: "both", manifest: "AndroidManifest_coverage.xml", diff --git a/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt b/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt index b2607eb..348392d 100644 --- a/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt +++ b/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt @@ -22,7 +22,7 @@ import android.app.NotificationManager import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_NONE import android.app.PendingIntent -import android.app.PendingIntent.FLAG_UPDATE_CURRENT +import android.app.PendingIntent.FLAG_IMMUTABLE import android.content.Context import android.content.Intent import android.content.res.Resources @@ -57,6 +57,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq +import org.mockito.ArgumentMatchers.intThat import org.mockito.Captor import org.mockito.Mock import org.mockito.Mockito.any @@ -188,7 +189,8 @@ class NetworkStackNotifierTest { assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(timeout, note.timeoutAfter) verify(mDependencies).getActivityPendingIntent( - eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) + eq(mCurrentUserContext), mIntentCaptor.capture(), + intThat { it or FLAG_IMMUTABLE != 0 }) } private fun verifyCanceledNotificationAfterNetworkLost() { @@ -279,7 +281,8 @@ class NetworkStackNotifierTest { verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mDependencies).getActivityPendingIntent( - eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) + eq(mCurrentUserContext), mIntentCaptor.capture(), + intThat { it or FLAG_IMMUTABLE != 0 }) verifyVenueInfoIntent(mIntentCaptor.value) verifyCanceledNotificationAfterDefaultNetworkLost() } |