diff options
| author | Remi NGUYEN VAN <reminv@google.com> | 2022-01-18 12:36:25 +0900 |
|---|---|---|
| committer | Remi NGUYEN VAN <reminv@google.com> | 2022-01-18 16:55:32 +0900 |
| commit | 8bc36966d4e7aeb1eca933326d5e314af4909ed5 (patch) | |
| tree | 058516bb83cf3a812e32a33f8ed08bbf80ffa083 /tests/common/java/android/net/NetworkCapabilitiesTest.java | |
| parent | 392161e651d870c1c5dcf5ff1b1cb5afd029dea4 (diff) | |
Do not verify field count in tests used in CTS
Tests in tests/common and tests/cts are run as part of CtsNetTestCases.
Many used assertFieldCountEquals in parceling/unparceling tests to
ensure that unexpected fields were not added, or that they were not
missed when testing parceling/unparceling.
However with many of the classes updatable through module updates, the
field count may change in the future, breaking CTS tests.
Stop checking for the field count, as it would break on module releases,
and its value is lower than the maintenance cost.
Bug: 205901761
Test: atest CtsNetTestCases
Change-Id: I79854741f7e834574d4825bb737ef507785310fe
Diffstat (limited to 'tests/common/java/android/net/NetworkCapabilitiesTest.java')
| -rw-r--r-- | tests/common/java/android/net/NetworkCapabilitiesTest.java | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/tests/common/java/android/net/NetworkCapabilitiesTest.java b/tests/common/java/android/net/NetworkCapabilitiesTest.java index 2a4df7adea..9cc001dac3 100644 --- a/tests/common/java/android/net/NetworkCapabilitiesTest.java +++ b/tests/common/java/android/net/NetworkCapabilitiesTest.java @@ -59,7 +59,6 @@ import static com.android.modules.utils.build.SdkLevel.isAtLeastS; import static com.android.modules.utils.build.SdkLevel.isAtLeastT; import static com.android.testutils.MiscAsserts.assertEmpty; import static com.android.testutils.MiscAsserts.assertThrows; -import static com.android.testutils.ParcelUtils.assertParcelSane; import static com.android.testutils.ParcelUtils.assertParcelingIsLossless; import static org.junit.Assert.assertArrayEquals; @@ -344,21 +343,7 @@ public class NetworkCapabilitiesTest { } private void testParcelSane(NetworkCapabilities cap) { - // This test can be run as unit test against the latest system image, as CTS to verify - // an Android release that is as recent as the test, or as MTS to verify the - // Connectivity module. In the first two cases NetworkCapabilities will be as recent - // as the test. In the last case, starting from S NetworkCapabilities is updated as part - // of Connectivity, so it is also as recent as the test. For MTS on Q and R, - // NetworkCapabilities is not updatable, so it may have a different number of fields. - if (isAtLeastS()) { - // When this test is run on S+, NetworkCapabilities is as recent as the test, - // so this should be the most recent known number of fields. - assertParcelSane(cap, 18); - } else if (isAtLeastR()) { - assertParcelSane(cap, 15); - } else { - assertParcelSane(cap, 11); - } + assertParcelingIsLossless(cap); } private static NetworkCapabilities createNetworkCapabilitiesWithTransportInfo() { |
