Commit Graph

4352 Commits

Author SHA1 Message Date
Cody Kesting
9ce134cf40 Merge "Add CTS testing for ConnectivityDiagnostics Data Stall callback." into rvc-dev 2020-05-30 05:35:16 +00:00
Cody Kesting
ed86e4622d Merge "Add CTS tests for ConnectivityDiagnostics callbacks." into rvc-dev 2020-05-30 05:35:05 +00:00
Cody Kesting
a4107118ff Add CTS testing for ConnectivityDiagnostics Data Stall callback.
Verify that onDataStallSuspected() is invoked by the System when
expected.

ConnectivityDiagnosticsManager provides an API for registering callbacks
with the System. These callbacks allow the System to notify registered
and permissioned callbacks on Network validation, suspected data stalls,
and Network connectivity reported.

Bug: 148032944
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: If6ceae9d2bbcabf88298d2d8c39cad5275fbd1ef
Merged-In: If6ceae9d2bbcabf88298d2d8c39cad5275fbd1ef
(cherry picked from commit dfcee1ac4a2843884034623601deb78b1a2d84df)
2020-05-29 11:28:46 -07:00
Cody Kesting
caf797ef34 Add CTS tests for ConnectivityDiagnostics callbacks.
Verify that the callbacks onConnectivityReport() and
onNetworkConnectivityReported() are invoked by the System when expected.

ConnectivityDiagnosticsManager provides an API for registering callbacks
with the System. These callbacks allow the System to notify registered
and permissioned callbacks on Network validation, suspected data stalls,
and Network connectivity reported.

Bug: 148032944
Test: android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: I748229d41c16adf1561e03aa597d5aac00f12912
Merged-In: I748229d41c16adf1561e03aa597d5aac00f12912
(cherry picked from commit fa23ec3b252c33e4cdc3e1463d77ba279d7da144)
2020-05-29 11:28:07 -07:00
Remi NGUYEN VAN
1a3aa4dd6c Merge "Add CTS test for the capport API" into rvc-dev 2020-05-29 11:26:06 +00:00
Remi NGUYEN VAN
450854f8ba Add CTS test for the capport API
The test relies on EthernetManager#setIncludeTestInterfaces to run
validation on an "ethernet" network based on a tap interface, and
simulates DHCP and HTTP servers so the device sees the capport DHCP
option, and fetches the API contents.

Bug: 156062304
Test: atest CaptivePortalApiTest
(clean cherry-pick from aosp)
Merged-In: I734dbd05c0f50b8dc4553102ab286f0d8807a7ac

Change-Id: I734dbd05c0f50b8dc4553102ab286f0d8807a7ac
2020-05-29 11:41:09 +09:00
Yan Yan
ff0471554e Test IKE Session setup in IPv6 network
Bug: 148689509
Test: atest testIkeSessionSetupAndChildSessionSetupWithTunnelModeV6
Change-Id: Ia2fa9462c66a283697e0cb9dd4c475215c0eafde
Merged-In: Ia2fa9462c66a283697e0cb9dd4c475215c0eafde
(cherry picked from commit 71a855de7dcdc3bdbdb75c78be0f57f3055b0c72)
2020-05-28 19:50:22 +00:00
Yan Yan
a2b2ab5473 Test handling authentication failure
- Test receiving Authentication Failure notification
- Test setting up IKE Session with first Child setup failure

Bug: 155821007
Test: CtsIkeTestCases
Change-Id: I4ec43a3899d67a119cd4ba19e0ffc63c277325fb
Merged-In: I4ec43a3899d67a119cd4ba19e0ffc63c277325fb
(cherry picked from commit b765ebe3f26e61093dbe9ac0df1845afc5d42d3d)
2020-05-28 19:48:40 +00:00
Yan Yan
188e220da7 Test remotely initiated rekey
This commit:
- Adds test for remotely initiated rekey for IKE and Child SA
- Makes IkeTunUtils support building and injecting requests
- Adds method to parse hex to long because Long.parseLong cannot
  handle negative long value

Bug: 155821007
Test: atest CtsIkeTestCases
Change-Id: I299cf190261ac15397f9ed389adb2c69e94a6507
Merged-In: I299cf190261ac15397f9ed389adb2c69e94a6507
(cherry picked from commit a5bff5a7b46c31dfa4ae692328edfb2b2a6462c8)
2020-05-28 19:47:03 +00:00
Yan Yan
783b9ad7f7 Test IKE Session setup with EAP-MSCHAPv2
Bug: 155821007
Test: atest CtsIkeTestCases
Change-Id: Ie8a328c53b531027ce63edaa874c4cd0904e0068
Merged-In: Ie8a328c53b531027ce63edaa874c4cd0904e0068
(cherry picked from commit aa4b9da896a4fd37ba01f4802fdf3de72b07a911)
2020-05-28 19:45:16 +00:00
Yan Yan
1e024e26cf Test IKE Session setup with digital-signature-based Auth
This commit adds a test for setting up IKE Session with
digital-signature-based authentication.

This test also verifies sending and receiving IKE fragments

Bug: 155821007
Test: atest CtsIkeTestCases:IkeSessionDigitalSignatureTest
Change-Id: I5829dfa955c47c0810760b7bf97372031e740f1e
Merged-In: I5829dfa955c47c0810760b7bf97372031e740f1e
(cherry picked from commit 3fde403c39e048e82223256ec7ca5c3ac7c93751)
2020-05-28 19:42:48 +00:00
Yan Yan
fd9c5eb675 Move common logic in testing and verification to IkeSessionTestBase
This commit moves following logics to IkeSessionTestBase so that all
subclasses can share it:
- build ChildParams
- perform IKE and first Child setup
- perform deleting IKE
- verifying IKE and first Child setup

Bug: 155821007
Test: atest CtsIkeTestCases:IkeSessionDigitalSignatureTest
Change-Id: Ib35b18240396a7b4823111e37be9a338d8ff6f06
Merged-In: Ib35b18240396a7b4823111e37be9a338d8ff6f06
(cherry picked from commit 34cdddb039da37c07bacf15f4c7a5fb36e757fad)
2020-05-28 19:41:17 +00:00
Automerger Merge Worker
f50119bbe4 Verify creation and deletion of IpSecTransform pair
- Verify that inbound and outbound IpSecTransforms
  are created when a Child Session is created
- Verify that when Child Session is deleted,
  the IpSecTransform pair is deleted

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: If142b3fb2ac791322921beeab1bc8d43db255317
Merged-In: If142b3fb2ac791322921beeab1bc8d43db255317
(cherry picked from commit a91fc43cbdfc6e58347493506fa5079a4280dca8)
2020-05-28 19:39:24 +00:00
Treehugger Robot
994edc463e Fix testTetheringUpstream flaky
testTetheringUpstream test case need cellular network. So it disable
wifi and getActiveNetwork to check whether current network is cellular.
But there is a race that call getActiveNetwork right away after
disconnect wifi. getActiveNetwork may return null because switching
network is not ready yet.

Bug: 156314879
Test: atest CtsTetheringTest

Merged-In: I6b433560fb27a3b4bd80c4198ccdb58a5be701b6
Change-Id: I6b433560fb27a3b4bd80c4198ccdb58a5be701b6
2020-05-28 04:17:51 +00:00
Chalard Jean
3eeb88d3b0 Merge "Add logs to NetworkCallbackTest to diagnose issues" into rvc-dev 2020-05-28 01:23:44 +00:00
Remi NGUYEN VAN
964f3f9ef2 Merge "Skip NetworkStatsBinderTest on Q" into rvc-dev 2020-05-28 00:16:07 +00:00
Yan Yan
64db03e386 Merge changes from topic "ike-cts-mts" into rvc-dev
* changes:
  Cleanup of IkeSessionPskTest
  Exit test if device does not support IPsec tunnel
2020-05-27 17:18:17 +00:00
Yan Yan
eccce8ea27 Merge "Apply MainlineTestModuleController to IKE CTS" into rvc-dev 2020-05-27 17:18:17 +00:00
Treehugger Robot
5df6449e3e Add logs to NetworkCallbackTest to diagnose issues
Bug: 157391946
Test: NetworkCallbackTests
Merged-In: I552a1ad05f97a2a9f83f5f7de77d2e7b64084ddc
Change-Id: Ic08df1908828f1487253a2b5dfb14e46442942b8
(cherry picked from commit 446a3ef6c2f9671dd7509906dbb647e1304ade78, aosp/1318216)
2020-05-27 13:28:22 +00:00
evitayan
e5c451c1db Apply MainlineTestModuleController to IKE CTS
Only run the tests when com.google.android.ipsec is
installed on device.

This CL follows aosp/11427976 as an example.

Bug: 150497352
Test: m mts && mts-tradefed run mts-ipsec
Change-Id: I5992c54f9c0b9f1aa9752a207660f9f6e97ccace
2020-05-26 22:59:31 +00:00
Yan Yan
f580c71a43 Cleanup of IkeSessionPskTest
- Add java doc in IkeSessionTestBase about the necessity to use
  different addresses and Networks in each test
- Use ArrayTrackRecord in Test Session Callback to retrieve the
  latest result.
- Verify that IpSecTransform pair is created and deleted

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ib747c8cdfe1827e8df2aa7544e28e98a177d3d1c
Merged-In: Ib747c8cdfe1827e8df2aa7544e28e98a177d3d1c
(cherry picked from commit f729d7a112e83e04c008b0bbeed333238482d3e9)
2020-05-26 22:58:10 +00:00
Automerger Merge Worker
9604af3544 Exit test if device does not support IPsec tunnel
Bug: 155926216
Test: CtsIkeTestCases
Change-Id: I4e426b8f3509e56e7e2e7532e216533ad8bfbc2f
Merged-In: I4e426b8f3509e56e7e2e7532e216533ad8bfbc2f
(cherry picked from commit eb70555351725a608afac0fb9f94a327e9236729)
2020-05-26 22:57:58 +00:00
Remi NGUYEN VAN
46b3c762bb Skip NetworkStatsBinderTest on Q
The fix verified by that test is only applied on R+.

Test: atest NetworkStatsBinderTest
Bug: 150904735
Change-Id: I5ac69a121e5fa1b927ec94f3873f5c31b9031419
2020-05-26 17:12:40 +09:00
Luke Huang
fd4a967604 Deflaky test for DnsResolverTest
It's possible that private DNS setting is not in the state we expected
when we tried to enable strict mode during tests. The problem here is
that there are 2 setting Uris(mode and specifier) relating to strict
mode, each of them might trigger private DNS setting changing evnet in
ConnectivityService.
Previously, we tried to enable strict mode with first set private DNS
mode and then private DNS specifier. This may result in 2 consecutive
private DNS changes events with very short intervals, which caused
conflicts between DnsResolver / NetworkMonitor and lead to flaky tests.

So
0. Use opportunistic as default mode if no default mode existed.
1. Change the order (mode and specifier) for enabling strict mode.
2. Change private DNS mode only when needed.
     (If original mode is "hostname", then we only need to set
     specifier)

Bug: 153624005
Bug: 151122313
Bug: 150952393
Test: atest DnsResolverTest --rerun-until-failure 100
Test: forrest (git_master, cts/networking/gce-all)
Test: forrest (git_rvc-dev, atest CtsNetTestCases)
Test: forrest (git_rvc-dev, mts/dnsresolver/device-all)
Merged-In: I224a6493c87cebaf0bf954c2644e2945ccd50db1
Change-Id: Ib61ad7bd510341366ebbbb72aa451e5809ee3e9d
(cherry picked from commit 7561b1499c1b8da0334b32c0452d49113d9e4806)
2020-05-26 08:05:15 +00:00
Remi NGUYEN VAN
b407f77bd0 Merge "Use Q permission on Q for startCaptivePortalApp" into rvc-dev 2020-05-26 02:00:19 +00:00
Remi NGUYEN VAN
6b23e3b0e3 Merge "Skip testTemporarilyNotMeteredCapability on Q" into rvc-dev 2020-05-26 02:00:05 +00:00
Remi NGUYEN VAN
d79613570d Skip testTemporarilyNotMeteredCapability on Q
The capability did not exist on Q.

Bug: 155993662
Test: atest NetworkRequestTest
Original-Change: https://android-review.googlesource.com/1316082
Merged-In: I94e874e37cadadd90397278bf519db68db48a50f
Change-Id: I94e874e37cadadd90397278bf519db68db48a50f
2020-05-26 00:51:56 +00:00
Remi NGUYEN VAN
e878df691e Use Q permission on Q for startCaptivePortalApp
on Q startCaptivePortalApp was guarded by CONNECTIVITY_INTERNAL instead
of NETWORK_SETTINGS: change the permission adopted by shell on Q to
match the platform.

Test: atest CaptivePortalTest on a Q device
Bug: 150904735

Original-Change: https://android-review.googlesource.com/1316081
Merged-In: I24b6907d164aba07df0f5a1a3715669e99cddd88
Change-Id: I24b6907d164aba07df0f5a1a3715669e99cddd88
2020-05-26 00:51:39 +00:00
Remi NGUYEN VAN
8c91b0feaf Fix and deflake ConnectivityManagerTest
- Migrate the test to JUnit4, as JUnit3 cannot use assumeTrue
 - Skip IPv4 keepalive tests on networks that do not have native IPv4.
 - Refactor usage of adoptShellPermissionIdentity to use try / finally
   or runAsShellPermissionIdentity: test failures could lead to
   permission failures in other tests due to mismatched adopt/drop.
 - Fix ensureWifiConnected to support the "wifi enabled but not fully
   connected" case.

Bug: 150949391
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest \
      --rerun-until-failure 50
Original-Change: https://android-review.googlesource.com/1310419
Merged-In: I7459753b1068e1760a95337760db58d1df213fad
Change-Id: I7459753b1068e1760a95337760db58d1df213fad
2020-05-26 00:48:51 +00:00
paulhu
5a86f4b18a Add a cts test for PermissionMonitor security problem
Add a cts test to check whether app can have netd sytem
permission even the app didn't grant the
CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.

Bug: 144679405
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: I2c717a11bda43db166a55d343eb752ab45947fe8
Merged-In: I2c717a11bda43db166a55d343eb752ab45947fe8
(cherry picked from commit 1bc6b39789, ag/10285567)
2020-05-25 05:43:18 +00:00
TreeHugger Robot
ed6b680e0c Merge "Create NetworkAgent CTS for NET_CAP_TEMP_NOT_METERED" into rvc-dev 2020-05-21 05:30:50 +00:00
Sarah Chin
8e28d8789d Create NetworkAgent CTS for NET_CAP_TEMP_NOT_METERED
Test: atest NetworkAgentTest
Bug: 155993662
Change-Id: Ic968bf37075c23e9ea7d98eaec7f4f37d9ebc337
2020-05-20 18:58:21 -07:00
Sarah Chin
0a0d71f1ec Add cts for TEMPORARILY_NOT_METERED
Bug: 155993662
Test: atest NetworkRequestTest
Change-Id: I6838dff70e6608f166119b99750db3bc59c59e42
2020-05-20 15:03:38 -07:00
TreeHugger Robot
eded3fd9be Merge "Apply MainlineTestModuleController to tethering cts tests" into rvc-dev 2020-05-19 19:32:00 +00:00
Chen Zhu
f021c464fd Apply MainlineTestModuleController to tethering cts tests
to only run them when com.google.android.tethering is

installed on device. This does not change any existing CTS run.

The logic only applies when the test triggered by mts-tradefed

to make sure it runs appropriate set of tests against the device.

For example, the test will be skipped when running MTS on Q because

tethering and wifi are not on Q devices.

Bug: 154845935
Test: m mts && mts-tradefed run mts-tethering
Change-Id: I9e6bd60982d4ef67538ad506e7008366bbf35363
2020-05-19 18:04:33 +00:00
Remi NGUYEN VAN
e196a61cbb 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
Merged-In: I5db3cb28829847e74412d270db7d17b81c5e26a2
Change-Id: I8e9af302b487199b144f4fd791bc39d57f002fe2
(cherry picked from commit 452ef123caa60eeebc1744b14137197c47704d6b)
2020-05-19 10:10:15 +00:00
Luke Huang
ce6a5df073 Revert "Fix flaky test for DnsResolverTest"
This reverts commit dd9608b7d1147a4eaf36ea634b9fc2f0feca1145.

Reason for revert: This CL made whole test failed.

Bug: 153624005
Bug: 150952393
Bug: 151122313
Merged-In: I083529616dbf80421ea6a322bb57d2bb0f2bca62
Change-Id: I002c39d6535fb31b13bc463812517fe1882f1884
(cherry picked from commit 98015badd01863fa4a79c089f371d9a50f2ae98c)
2020-05-19 01:53:45 +00:00
Luke Huang
402077cc3a Fix flaky test for DnsResolverTest
It's possible that private DNS setting is not in the state we expected
when we tried to enable strict mode during tests. The problem here is
that there are 2 setting Uris(mode and specifier) relating to strict
mode, each of them might trigger private DNS setting changing evnet in
ConnectivityService.
Previously, we tried to enable strict mode with first set private DNS
mode and then private DNS specifier. This may result in 2 consecutive
private DNS changes events with very short intervals, which caused
conflicts between DnsResolver / NetworkMonitor and lead to flaky tests.

So
1. Change the order (mode and specifier) for enabling strict mode.
2. Change private DNS mode only when needed.
     (If original mode is "hostname", then we only need to set
     specifier)

Bug: 153624005
Bug: 153624702
Test: atest DnsResolverTest --rerun-until-failure 100
Merged-In: Iaed6285677f74a5ee6cc6684534ddc0758b25974
Change-Id: I566bdfa98dc070247b52fe29ca1f31cbd1bb8cc2
(cherry picked from commit 877af1ee3ed2c3a9e9256e216709908d2beb3bfb)
2020-05-18 02:40:06 +00:00
Paul Hu
c0f0623482 Merge "Address aosp/1272946 leftover comment" into rvc-dev 2020-05-18 01:37:41 +00:00
Kweku Adams
66c5773f79 Ensure airplane mode is off.
If the device is put into airplane mode before the network tests run,
the tests fail. This ensures that airplane mode is off before the tests
run.

Bug: 150788500
Test: atest CtsHostsideNetworkTests
Change-Id: I7a84be751e5e9efb534d48c6d8ff457875ebe716
2020-05-15 10:09:41 -07:00
Paul Hu
30e4e9a202 Address aosp/1272946 leftover comment
Verify that entitlement check bypass with TETHER_ERROR_NO_ERROR
response.

Bug: 152829363
Test: atests CtsTetheringTest
Change-Id: I6272d7b297bdf0e641612a09ffe12942cc2b42e1
Merged-In: I6272d7b297bdf0e641612a09ffe12942cc2b42e1
(cherry picked from commit 92133d472ffbe6301db00c93060d76d90cdd02d2, aosp/1307453)
2020-05-15 08:24:46 +00:00
Chiachang Wang
1621a260a2 Move testInvariantInCanBeSatisfiedBy to be its own test
Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
Merged-In: Id65b7189202108b232905535587f8a282e48007b
Change-Id: Id65b7189202108b232905535587f8a282e48007b
2020-05-12 09:03:41 +00:00
Chiachang Wang
54978bda2d 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
Merged-In: I7e357c75a68244432231d59646ddf67c8d969c6d
Change-Id: I7e357c75a68244432231d59646ddf67c8d969c6d
2020-05-12 00:51:06 +00:00
Lucas Lin
c06ab57a8d Merge "Refine NetworkCallbackTest" into rvc-dev 2020-05-08 05:33:29 +00:00
lucaslin
63203afe0e 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
2020-05-08 11:02:46 +08:00
Mark Chien
a25d852b12 Tag CtsTetheringTest for sim card required
Bug: 155598732
Test: atest CtsTetheringTest
Merged-In: I79f841682049707d7cc26bf1ecc3e5affc86d196
Change-Id: I79f841682049707d7cc26bf1ecc3e5affc86d196
2020-05-07 10:32:38 +00:00
Kweku Adams
627f2b69ef Merge "Test that idle apps get network when device charges." into rvc-dev 2020-05-07 01:25:28 +00:00
Hai Zhang
9c3108c681 Merge "Declare MANAGE_EXTERNAL_STORAGE for test apps." into rvc-dev 2020-05-04 23:33:47 +00:00
Kweku Adams
efb1857443 Test that idle apps get network when device charges.
This is a partial revert of the change that removed the parole
(Icd7b6eff8777f9b53a10eca521b73988f58f2d84).

Bug: 151802309
Test: atest --rerun-until-failure 10 com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I65f5ff20cdd342905e1afd1f4897017aa60682d3
2020-05-04 13:34:29 -07:00
evitayan
120a7db874 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
Merged-In: Ie6c18591ffcc883abbf0484d9a59dfda61b33257
2020-05-01 11:52:28 -07:00