Commit Graph

1590 Commits

Author SHA1 Message Date
Chalard Jean
796ccadc00 Add logs to NetworkCallbackTest to diagnose issues
Bug: 157391946
Test: NetworkCallbackTests
Change-Id: I552a1ad05f97a2a9f83f5f7de77d2e7b64084ddc
2020-05-27 15:51:53 +09:00
Ken Chen
5dd02e3103 Fix CtsNetTestCasesLatestSdk fail on Q platform
The CtsNetTestCasesLatestSdk needs to build against platform (for hidden
API access), The JNI library libnativedns_jni used by
CtsNetTestCasesLatestSdk needs to build against stable SDK (for running
on Q). To fulfill the combination, property jni_uses_sdk_apis must be
set.

Bug: 151122313
Bug: 150904735
Bug: 150918852
Test: atest CtsNetTestCasesLatestSdk on R and Q platforms
Change-Id: I5db3cb28829847e74412d270db7d17b81c5e26a2
2020-05-18 19:55:29 +08:00
Paul Hu
ebe9cb15a4 Merge "Address aosp/1272946 leftover comment" 2020-05-15 01:11:14 +00:00
Chiachang Wang
8ddd0227a9 Move testInvariantInCanBeSatisfiedBy to be its own test
Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
Change-Id: Id65b7189202108b232905535587f8a282e48007b
2020-05-12 09:39:16 +08:00
Chiachang Wang
c23b2ac096 Merge "Use local defined NetworkSpecifier to verify test" 2020-05-11 14:19:34 +00:00
Chiachang Wang
a495965c67 Use local defined NetworkSpecifier to verify test
Test will be affected by logic modification from different
NetworkSpecifiers. Since this test tries to test the behavior
of NetworkRequest but not NetworkSpecifier, use local defined
NetworkSpecifier to test to prevent repeating noisy breaks.
Also update test for testing invariant.

Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
Change-Id: I7e357c75a68244432231d59646ddf67c8d969c6d
2020-05-11 20:24:47 +08:00
paulhu
e5e8ae9e1b Address aosp/1272946 leftover comment
Verify that entitlement check bypass with TETHER_ERROR_NO_ERROR
response.

Bug: 152829363
Test: atests CtsTetheringTest
Change-Id: I6272d7b297bdf0e641612a09ffe12942cc2b42e1
2020-05-11 15:27:35 +08:00
lucaslin
5d57ec4a8f Refine NetworkCallbackTest
In R, to avoid data overages due to apps not detecting a
meteredness change, when a wifi network changes from unmetered
to metered the network will go down and will be replaced with a
new network. It will make NetworkCallbackTest fail because the
original design is getting the active network in setUp(). So once
the wifi reconnects, the network which is got in setUp() will be
meaningless and make the test fail due to network mismatches.
The new changes are:
1. Moving some initial pre-configurations into setUp().
2. Override the onCapabilitiesChanged() to check if network has
   changed to metered or not.
3. Add unregisterNetworkCallback() into iMyService.aidl so that
   NetworkCallbackTest can call it to unregister the network
   callback.
4. Enlarge the timeout of connecting network and receiving
   callback to prevent network cannot reconnect in time or
   callback cannot be received in a short time.

Bug: 153485744
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I1aa0e107cf6797b06dee4a15896c63321d822156
Merged-In: I1aa0e107cf6797b06dee4a15896c63321d822156
2020-05-08 08:01:34 +00:00
markchien
f941ae9c03 Tag CtsTetheringTest for sim card required
Bug: 155598732
Test: atest CtsTetheringTest
Change-Id: I79f841682049707d7cc26bf1ecc3e5affc86d196
2020-05-06 14:55:29 +08:00
Yan Yan
2e10c55003 Merge "Initial CL for testing IkeSession creation" 2020-05-01 05:58:18 +00:00
evitayan
653d7ebb44 Initial CL for testing IkeSession creation
This commit:
-Extend TunUtils for processing IKE packets
-Add IkeSessionBaseTest containing common functionality for all IkeSession tests
-Add end-to-end test for IKEv2 PSK verifying creating IKE SA, creating child SAs
 and closing sessions
-Add basic tests for error scenarios

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ie6c18591ffcc883abbf0484d9a59dfda61b33257
2020-04-30 18:56:12 -07:00
Dominic Lemire
cae5079d9d Fix error message in RestrictBackgroundNetworkTest
Fixed the error message when the expected number of broadcasts is exceeded.

Bug: 147139427

Change-Id: I7e69dca81abdb29a9eb7d110266edbe483e17a01
2020-04-30 05:47:29 +00:00
Remi NGUYEN VAN
6c63b1eaac Merge "Force reconnect in connectToWifi" 2020-04-28 07:10:15 +00:00
Remi NGUYEN VAN
412c8a9f53 Merge "Add test for internet availability on portals" 2020-04-28 05:49:08 +00:00
Remi NGUYEN VAN
71cfc79527 Force reconnect in connectToWifi
There is no guarantee that Wifi will automatically reconnect after
enabling, especially in cases where no internet access was detected on
the access point the last time it was connected.

Use WifiManager#reconnect to force wifi to reconnect to the access
point. The API is deprecated for general use, but system apps are
documented as exempted from the deprecation.

Bug: 152280218
Test: atest --rerun-until-failure 200 CtsNetTestCases:CaptivePortalTest
Change-Id: Ia7d83337ee0ffad9414031711cf7e937b14f968d
2020-04-27 22:47:12 +09:00
Remi NGUYEN VAN
ecb661016f Add test for internet availability on portals
Add a test verifying that when the device has detected a captive portal,
or when the user is trying to login to a captive portal, the captive
portal network does not become the default network if another network
can provide internet access.
This follows R CDD requirements.

Test: atest CtsNetTestCases:android.net.cts.CaptivePortalTest
Bug: 152280218
Change-Id: I6a97ed26dba665efdc67abb2371e0fc30ede020c
2020-04-27 22:47:10 +09:00
Yan Yan
c910917fd2 Merge "Test configuring digital-signature-based auth" 2020-04-27 02:34:46 +00:00
Yan Yan
4f532038f1 Merge "Test building IkeSessionParams with EAP" 2020-04-26 21:29:31 +00:00
evitayan
bba019dc40 Test configuring digital-signature-based auth
Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ieaceaadf116cb2885cbf22ae48579cec88268416
2020-04-24 19:01:24 -07:00
evitayan
e800e95037 Test building IkeSessionParams with EAP
Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Iea7f4d14502f4b204c7a0d7357e1aaec99954e1f
2020-04-24 19:01:11 -07:00
Yan Yan
609d48cc11 Merge "Add test for IkeIdentification" 2020-04-25 01:56:17 +00:00
Yan Yan
f839aaad8c Merge "Add initial CTS test for IkeSessionParams" 2020-04-25 01:53:15 +00:00
evitayan
9dcef40023 Add test for IkeIdentification
Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ieda584446c37d121fc16a212e2c6c60b934b0f53
2020-04-24 18:16:18 +00:00
evitayan
b9438336c7 Add initial CTS test for IkeSessionParams
This commit adds tests for building IkeSessionParams with PSK. It
also tests configuring SA lifetimes, retransmissions and PCSCF
server requests

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: I16fdc1ff9a22acb82b376211e0f187c4ead4cae5
2020-04-24 10:30:30 -07:00
Treehugger Robot
6aa8f074d0 Merge "Add testTetheringUpstream cts test" 2020-04-24 15:36:21 +00:00
Treehugger Robot
c31694df4c Merge "Test legacy tether/untether API and onError callback" 2020-04-24 15:29:44 +00:00
markchien
0420e692a7 Add testTetheringUpstream cts test
If cellular is the mobile network, tethering should select it as
upstream. If DUN is required, tethering should use DUN as its upstream.

Bug: 153614366
Bug: 150644305
Test: atest CtsTetheringTest

Change-Id: Ief9c745322e8705c0e50185e749a81c5a9d20743
2020-04-24 22:29:43 +08:00
markchien
1a54afc5b1 Test legacy tether/untether API and onError callback
Test legacy tether/untether API behavior. tether() rely on downstream
setup ready for tethering. Currently the only user is bluetooth
tethering. For other tetherings, there is no guaranteed that calling
tether() can always switch given interface to tethered. Tethering
may callback with onError depend on the interface status. Caller
should use startTethering/stopTethering API instead of these
legacy APIs.

This change also change the precondition verification of startTethering.
If tethering interface got error last time, such interface would not
be reported as tetherable.

Bug: 150632712
Test: atest CtsTetheringTest
Change-Id: Ifb3a0618208ffd0ff224c60f377036bc22ba0565
2020-04-24 21:16:06 +08:00
Yan Yan
c7afaba688 Merge "Add CTS for EapSessionConfig" 2020-04-24 00:00:43 +00:00
Yan Yan
c921e5075f Merge "Create base class that sets up test network" 2020-04-23 22:19:21 +00:00
Yan Yan
dbe2adf308 Merge "Make a copy of TunUtils and PacketUtils" 2020-04-23 22:18:45 +00:00
Sudheer Shanka
8d7f5f0f9a Merge changes I05285811,I782f8a06,I7c5bf823,I7bb2a7e4
* changes:
  Ensure location is enabled before getting SSID.
  Fix a regression in how required properties are collected.
  Fix Error Prone errors
  Reland "Pull service dumps to help debug test failures."
2020-04-23 17:57:10 +00:00
evitayan
8cfc634bbc Create base class that sets up test network
This class will be extended by both IkeSessionParamsTest and
IkeSessionTestBase

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: I98979758a7a684219e35c02ded93224ea172d44f
2020-04-23 10:40:49 -07:00
Mark Chien
34ec9b0db7 Merge "Test enable tethering permission and stopAllTethering" 2020-04-23 13:02:04 +00:00
evitayan
8af9ca27a2 Make a copy of TunUtils and PacketUtils
Temporarily make copies. Eventually will statically include the
source files in CtsIkeTestCases

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: I7dd5c8b849f0d987fa6d76bc5a0bc1a7eed49b0d
2020-04-23 00:58:44 -07:00
Paul Hu
e3ef038b64 Merge "Add TetheringCommonTests to CtsTetheringTest" 2020-04-23 02:45:23 +00:00
Sudheer Shanka
0ac91b4737 Ensure location is enabled before getting SSID.
When location is disabled, Wi-Fi scan results and SSID are not available
to apps.

Fixes: 153850762
Fixes: 153396893
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I05285811d7131e116d5e1d072137ed2cf9576d05
Merged-In: I05285811d7131e116d5e1d072137ed2cf9576d05
2020-04-22 14:37:45 -07:00
Sudheer Shanka
a6a1ad183e Fix a regression in how required properties are collected.
+ Enable app standby mode before running the tests.

Fixes: 147459100
Fixes: 117169751
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: cts-tradefed run singleCommand cts-on-gsi --skip-device-info \
      --skip-preconditions -m CtsHostsideNetworkTests \
      -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
Merged-In: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
2020-04-22 13:59:46 -07:00
Sudheer Shanka
39cc315273 Fix Error Prone errors
Soong wasn't including android_app or android_test sources in the
javac-check target used for the Error Prone build, which allowed
some Error Prone errors to get in.  Fix them so Error Prone can be
re-enabled for these targets.

Fixes:
cts/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java:61: error: [CollectionIncompatibleType] Argument '~requiredProperty.getValue()' should not be passed to this method; its type int is not compatible with its collection's type argument Property

Bug: 146455923
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I7c5bf823bf371902285ce3ee3929796fa40c653b
Merged-In: I48b1ccb61c807d0b41a165298ef5981258d6656e
2020-04-22 13:52:12 -07:00
Sudheer Shanka
1206400ccf Reland "Pull service dumps to help debug test failures."
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

This reverts commit 89099548f8.

Bug: 137859686
Change-Id: I7bb2a7e4b2dca3696761e7c030f3380b9226b676
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-22 12:27:50 -07:00
Chiachang Wang
6f63ef0e47 Update logic for checking NetworkSpecifier
We cannot test using WifiNetworkSpecifier, because the matching
behaviour for null WifiNetworkSpecifier changed between Q and R.
Replace WifiNetworkSpecifier with MatchAllNetworkSpecifier and
TelephonyNetworkSpecifier that behave the same in both Q and R
to verify.

Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
      on aosp and internal build
Change-Id: I14e2a5e629051e243f3b892b608cb1c6195cd8ed
2020-04-22 22:18:50 +08:00
Lucas Lin
6ca20ffe6d Merge "Revert "Pull service dumps to help debug test failures."" 2020-04-22 05:56:52 +00:00
Chiachang Wang
6aac2067f6 Check target transport type for meterness change
When test case updates the wifi network from unmetered to
metered, test case will wait for wifi network reconnect.
However, if other metered networks are also connected at
the same time, test case may mis-take the network as the
target network. Thus, add transport type check to ensure
the transport type of the network is the expected one.

Bug: 153400606
Test: atest CtsNetTestCasesLatestSdk:\
      android.net.cts.ConnectivityManagerTest#\
      testGetMultipathPreference
Change-Id: I75dab1a00bbe1a1c75b548a6ce4ae3eacd325d92
2020-04-22 05:51:39 +00:00
Tony Huang
89099548f8 Revert "Pull service dumps to help debug test failures."
This reverts commit e3711ae317.

Reason for revert: Might cause build break on errorprone branch

Change-Id: Iddece3edf4b1e96fafb8b36282f58410a2476025
2020-04-22 04:31:43 +00:00
paulhu
6f203abeab Add TetheringCommonTests to CtsTetheringTest
Bug: 153614365
Bug: 153613717
Test: atest CtsTetheringTest
Change-Id: I26c06d522ef2935deb2b1abbd3c5b6be97a48a27
2020-04-22 10:25:11 +08:00
evitayan
9d364b6aea Add CTS for EapSessionConfig
Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: I54dedff0555bdfcaae390ddde7b05d24dfabe9b0
2020-04-21 11:24:41 -07:00
Sudheer Shanka
e3711ae317 Pull service dumps to help debug test failures.
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

Bug: 137859686
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I93317c201a0ea06732e29154ab7e140735381f59
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-21 14:29:19 +00:00
Remi NGUYEN VAN
8b5e3031fa Merge "Fix test initialization errors on Q" 2020-04-21 12:07:03 +00:00
Remi NGUYEN VAN
a7f8f2d01c Fix test initialization errors on Q
ConnectivityDiagnosticsManagerTest, MultinetworkApiTest,
NetworkAgentTest crashed before the runner could start them:
 - Ignore ConnectivityDiagnosticsManagerTest on Q: it tests an API that
   was introduced in R.
 - Build JNI libraries used by MultinetworkApiTest against the NDK to
   avoid errors loading the libraries on older platforms, when
   transitive dependencies have been added.
 - Do not attempt to override Handler#getLooper() (which is final) in
   NetworkAgentTest; it appears to have been overridden by accident by
   specifying "val looper" in the TestableNetworkAgent definition, which
   generates a getter.

Test: atest CtsNetTestCasesLatestSdk:ConnectivityDiagnosticsManagerTest
      atest CtsNetTestCasesLatestSdk:MultinetworkApiTest
      atest CtsNetTestCasesLatestSdk:NetworkAgentTest
Bug: 150918852
Change-Id: I262b54c6897ed755adaeb2b118c638320634f7a1
2020-04-21 15:16:44 +09:00
Junyu Lai
9eba1b2c1b Merge "Remove upper bound check of getTotal* APIs in TrafficStatsTest" 2020-04-21 03:07:58 +00:00