From 1d8505b456eddab8babcdde93d0c411425c2dcd5 Mon Sep 17 00:00:00 2001 From: lucaslin Date: Mon, 23 Nov 2020 23:40:23 +0800 Subject: [PATCH] Ignore verifying canBeSatisfiedBy() on Android Q The method - satisfiedBy() has changed to canBeSatisfiedBy() starting from Android R, so the method - canBeSatisfiedBy() cannot be found when running this test on Android Q. Ignore verifying canBeSatisfiedBy() on Android Q to fix this problem. Bug: 173911834 Test: Run MatchAllNetworkSpecifierTest on Android Q, R, S. Change-Id: Ibe317b56f82d3ea100b1d78c3907dce4f2fd964d --- .../java/android/net/MatchAllNetworkSpecifierTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt b/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt index a67156a74d..a5e44d59fc 100644 --- a/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt +++ b/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt @@ -53,8 +53,13 @@ class MatchAllNetworkSpecifierTest { assertParcelSane(MatchAllNetworkSpecifier(), 0) } - @Test @IgnoreAfter(Build.VERSION_CODES.R) - fun testCanBeSatisfiedBy_BeforeS() { + @Test + @IgnoreUpTo(Build.VERSION_CODES.Q) + @IgnoreAfter(Build.VERSION_CODES.R) + // Only run this test on Android R. + // The method - satisfiedBy() has changed to canBeSatisfiedBy() starting from Android R, so the + // method - canBeSatisfiedBy() cannot be found when running this test on Android Q. + fun testCanBeSatisfiedBy_OnlyForR() { // MatchAllNetworkSpecifier didn't follow its parent class to change the satisfiedBy() to // canBeSatisfiedBy(), so if a caller calls MatchAllNetworkSpecifier#canBeSatisfiedBy(), the // NetworkSpecifier#canBeSatisfiedBy() will be called actually, and false will be returned.