Commit Graph

2170 Commits

Author SHA1 Message Date
Lorenzo Colitti
98d23e7d02 Accept both pre-S and post-S errors in getConnectionOwnerUid.
On R and below, when an app that is not the active VPN app calls
getConnectionOwnerUid, a SecurityException is thrown. On S and
above, the method just returns INVALID_UID, which is what would
happen if the app was the active VPN app but was not authorized
to find that particular socket.

Accept both behaviours.

Bug: 173331190
Test: atest HostsideVpnTests#testGetConnectionOwnerUidSecurity passes on R and S
Change-Id: Ie6de2ef505b0d7bc253c55215a698aeaa210785c
2021-02-10 15:14:31 +09:00
Lorenzo Colitti
e9aeb3c1c5 Add CTS coverage for VpnTransportInfo.
Bug: 173331190
Test: FrameworksNetTests HostsideVpnTests CtsNetTestCases
Change-Id: I77d866270c63f1078a2a01941b2271d4338aa178
2021-02-10 15:14:26 +09:00
Lorenzo Colitti
1e5cdd3187 Add test coverage for registerSystemDefaultNetworkCallback.
Bug: 173331190
Test: atest CtsNetTestCases:NetworkAgentTest
Change-Id: I3ce51ca253a8bd06408137f6f9ed4056a832cb43
2021-02-09 20:10:36 +09:00
Treehugger Robot
1259762383 Merge "Temporarily disable flaky testRequestBackgroundNetwork CTS test" 2021-02-09 00:13:46 +00:00
Junyu Lai
438f787ca3 Merge changes from topic "vcn07"
* changes:
  Address comments on aosp/1550755
  [VCN07.1] Add test for bypassing VCN for non-internet request
2021-02-08 21:40:09 +00:00
junyulai
349deb8e15 Temporarily disable flaky testRequestBackgroundNetwork CTS test
Test: TH
Bug: 179554972
Change-Id: If82d561231b74e8cd0d220431ac83d08e8f16cdd
2021-02-08 21:48:13 +08:00
junyulai
5ceb5c3c8f Address comments on aosp/1550755
This CL bypass adding NOT_VCN_MANAGED on R device. And add TODOs
for refactoring and adding test coverage.

Test: atest CtsNetTestCasesLatestSdk:NetworkRequestTest on R device
Bug: 175662146

Change-Id: Id09b19c13f9a74e25d45689d2211418172dfaec8
2021-02-08 08:52:28 +00:00
Sudheer Shanka
8247993e00 Update meteredness of cellular networks for tests.
This would allow us to run both metered and unmetered networkpolicy
related tests when the device is on a cellular network.

Bug: 165343126
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Test: atest CtsHostsideNetworkTests:HostsideNetworkCallbackTests
Change-Id: Id70856dffc920e74bda28583dba4dd851a832397
Merged-In: Id70856dffc920e74bda28583dba4dd851a832397
2021-02-07 23:29:08 +00:00
junyulai
ea79aa6fd9 [VCN07.1] Add test for bypassing VCN for non-internet request
Test: atest NetworkRequestTest#testBypassingVcnForNonInternetRequest
Bug: 175662146
Change-Id: I245bd69e02866d3608ab1667b665f6e12860037b
2021-02-05 10:09:09 +08:00
Junyu Lai
38b5855ff7 [VCN06.1] Add CTS for request background network
Test: android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork
Bug: 175662146

Change-Id: Icd7d2bc18c4b328291e96fc3f18828d0421f5b6e
2021-01-29 14:34:38 +08:00
Junyu Lai
f555f4bca7 Merge "Revert "[VCN06.1] Add CTS for request background network"" 2021-01-19 10:24:47 +00:00
Junyu Lai
3660b71c11 Revert "[VCN06.1] Add CTS for request background network"
Revert "[VCN06] Support request background network"

Revert submission 1545847-vcn06

Reason for revert: b/177876289 presubmit failure
Reverted Changes:
I8042ce197:[VCN06.1] Add CTS for request background network
If9aaa87b7:[VCN06] Support request background network

Change-Id: Icd01643cae86c4448eb7105ef0f238b1f10ebc19
2021-01-19 09:06:00 +00:00
Junyu Lai
5b39b66544 Merge "[VCN06.1] Add CTS for request background network" 2021-01-19 01:04:20 +00:00
junyulai
f8370c08be [VCN06.1] Add CTS for request background network
Test: android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork
Bug: 175662146
Change-Id: I8042ce1971c728a9f900d090c0c4cabd994820bf
2021-01-18 16:32:33 +08:00
Remi NGUYEN VAN
4bf203d065 Skip NetworkAgentTest on R-
NetworkAgent is not updatable on R-, so there is no need to run tests
compiled against S on older platforms. They are also incompatible
because NetworkAgent stopped using AsyncChannel in S.

This only affects MTS, and CTS used to test S+ devices. CTS for R-
devices is already cut in a branch that this change will not merge to.

Bug: 177290955
Change-Id: I85c137a1b5fd7ef701fba4623566df5a8fb707a3
Test: atest CtsNetTestCasesLatestSdk
2021-01-15 07:45:29 +00:00
Treehugger Robot
26b0cf3261 Merge "Net CTS: move NsdManagerTest from Wifi CTS" 2021-01-14 03:51:17 +00:00
David Su
cd1851e0a2 Net CTS: move NsdManagerTest from Wifi CTS
NsdManagerTest is not owned by Wifi, so it doesn't
belong in Wifi CTS.

Bug: 176902925
Test: atest CtsNetTestCases
Change-Id: I8eb3cba7a3b2ff24a012cca8d3fdff173e88c69a
2021-01-14 03:47:25 +00:00
Patrick Rohr
4df8a7aef1 Add CTS test for Restricted Networking Mode
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Bug: 175281879
Bug: 170323671
Change-Id: Ic69e7e029debeea1f131242fb2baad2796d4768c
2021-01-11 09:47:04 +01:00
Sudheer Shanka
edb6669cf1 Merge "Increase the wait timeout for meteredness to change." 2021-01-07 22:56:48 +00:00
Sudheer Shanka
796f29c09e Increase the wait timeout for meteredness to change.
Bug: 170241174
Bug: 174808291
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Change-Id: I3af17819a403958d88a30af7f6346e5bb96b2828
2021-01-05 06:37:56 +00:00
Chalard Jean
4f896db6ff Migrate away from AsyncChannel in NetworkAgent
Use two oneway binder interfaces instead.
The interfaces post messages to handlers as was implemented before, but
provide a more strictly defined interface, with less hops between
NetworkAgent, AsyncChannel, and ConnectivityService.

Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Merged-In: Ica51d0179bcb3b4e314d2c3e85709aead6ca5657

Change-Id: Ica51d0179bcb3b4e314d2c3e85709aead6ca5657
2020-12-25 11:11:32 +09:00
Remi NGUYEN VAN
abb46bef36 Fix timeout on NetworkAgentTest callback
All callbacks in the class use the DEFAULT_TIMEOUT_MS, except for this recently
added test.

The test is currently flaky in various branches.
Fixes: 174716714
Fixes: 174691729
Change-Id: I9f4446bb83eb4402c912292ac31d46e1d2cb6a52
Test: TH
2020-12-16 06:29:20 +00:00
Remi NGUYEN VAN
9b6b353b5d Move cts/net/TEST_MAPPING to toplevel
The tests should just be run on any change in packages/modules/Connectivity,
not just changes in the CTS package.

Change-Id: I1c86c402f39a8a9b84e7422445df289c3ea7842f
Test: TEST_MAPPING needs to be verified by TH
2020-12-15 09:39:58 +00:00
Lorenzo Colitti
678d27faca Merge changes from topic "cs-generalize-underlying-networks"
* changes:
  Update NetworkAgentTest to support generalized underlying networks.
  Minor fixes to NetworkAgentTest.
2020-12-14 05:19:49 +00:00
Lorenzo Colitti
ed1211d2d8 Update NetworkAgentTest to support generalized underlying networks.
Currently, when an agent calls setUnderlyingNetworks, the
transports of the network are hardcoded to TRANSPORT_VPN only.
This is being fixed in another CL in this topic. The new code
reports the same transports sent by the agent.

This test registers an agent with TRANSPORT_TEST|TRANSPORT_VPN.
Update the test to expect both transports in the callbacks it
receives.

Bug: 173331190
Test: passes when run with other CL in topic
Change-Id: Iede61d74fa02a4fec1f345f6d18835c1acab7337
2020-12-12 22:57:06 +09:00
Lorenzo Colitti
cc3e994f16 Minor fixes to NetworkAgentTest.
- Use a more realistic routing config (instead of a LinkAddress
  with prefix length 0, an address with a mask of 32 and a
  default route).
- Use InetAddresses to parse IP addresses since it's a public API.
- Import the NET_CAPABILITY_xxx and TRANSPORT_xxx constants for
  readability.

Bug: 173331190
Test: test-only change
Change-Id: I9703d7dd5781f60fb3d531267d3f5370cbccd64f
2020-12-12 22:57:05 +09:00
Lorenzo Colitti
78f7c04770 Merge "Pass in proper NetworkCapabilities in testSetUnderlyingNetworks." 2020-12-09 00:11:23 +00:00
Lorenzo Colitti
977464ef5a Pass in proper NetworkCapabilities in testSetUnderlyingNetworks.
The CL that introduced testSetUnderlyingNetworks allowed tests to
pass in NetworkCapabilities when registering an agent, but
incorrectly always set the agent's capabilities anyway. This
resulted in testSetUnderlyingNetworks registering an agent with
TRANSPORT_VPN and NET_CAPABILITY_NOT_VPN.

Fix this by ensuring that createNetworkAgent either uses the
passed-in capabilities unmodified, or creates its own. Assert
that the test VPN network does not have NET_CAPABILITY_NOT_VPN.

While I'm at it, remove the manual unregistration of the callback
by using the registerNetworkCallback helper method.

Also add a little bit of extra test coverage.

Bug: 173331190
Test: test-only change
Change-Id: I114d876a1b2bf5344dd7c6fa23862df1c0a412c3
2020-12-08 01:15:32 +09:00
Remi NGUYEN VAN
d01761e07f Set noparent in connectivity CTS owners
Also reorganize the files to have one toplevel CTS owners file, and only
additional owners in subdirectories.

Change-Id: I28ce193896e1ade2034589327805870774a4d608
Test: m
2020-12-03 08:07:32 +00:00
Lorenzo Colitti
7d04b2a26c Merge "Add a CTS test for NetworkAgent#setUnderlyingNetworks." 2020-11-28 02:49:53 +00:00
Treehugger Robot
de39ae42ac Merge "Fix race condition in NetworkWatchListTest" 2020-11-27 10:12:05 +00:00
Lorenzo Colitti
3657ce9cda Add a CTS test for NetworkAgent#setUnderlyingNetworks.
Bug: 173331190
Test: atest CtsNetTestCases:NetworkAgentTest#testSetUnderlyingNetworks
Change-Id: I442a618d2d50eb15dbcb8926b60fc6fd0d5b2f3e
2020-11-27 18:09:24 +09:00
Remi NGUYEN VAN
d4430d28ba Merge "Add TEST_MAPPING config for CTS postsubmit" 2020-11-27 08:42:31 +00:00
Alan Stokes
36529b250a Fix race condition in NetworkWatchListTest
We were running cp to create a file and then running a command to read
the file. However were weren't waiting for the cp to finish (or,
indeed, start), so occasionally the read would fail saying the file
didn't exist.

Also added some logging, because diagnosing failure without it is
painful. Also simplify & improve file closing logic.

Some of this was previously submitted on internal master as change
I1c875102f0cce32cbbe2e3b36de913741c9abb92, but I've reverted that in
favor of this.

Bug: 168216494
Test: atest CtsNetTestCases:android.net.cts.NetworkWatchlistTest
Change-Id: I46a9db8b7a1885a9829f00bbd3233b863cfd1f5d
2020-11-26 14:27:39 +00:00
Treehugger Robot
1de9621925 Merge "Tune up TIMEOUTs of IPSec CTS for low end devices" 2020-11-25 19:56:50 +00:00
Remi NGUYEN VAN
1bc6287249 Add TEST_MAPPING config for CTS postsubmit
The new configuration runs tests on physical devices with SIM cards.
This is only done in postsubmit, as such tests can only run a few (~2) times a day due to
availability of the devices.

This configuration allows running all tests, so there is no annotation filter.

Change-Id: If95e4deeed8098327023f99e6e610331b8e86a0f
Test: TH validates TEST_MAPPING configurations
2020-11-25 18:27:48 +08:00
Junyu Lai
42fbb57b31 Merge changes from topic "TrafficStats.getTxRxBytes"
* changes:
  Exclude lingering traffic from loopback iface stats check
  Add CTS for getTx/RxBytes in TrafficStats
2020-11-25 02:35:20 +00:00
Chalard Jean
d639d12161 Merge "This bug was fixed in S, don't test for it in R" 2020-11-24 07:01:57 +00:00
Chalard Jean
e90c48c9aa This bug was fixed in S, don't test for it in R
Bug: 172401665
Test: CtsNetTestCasesLatestSdk
Change-Id: Ib9fb3ec09eeaebbb4ac1b1b458cfcc5c4f506cff
2020-11-20 17:54:26 +09:00
Cody Kesting
b9e51da2e8 Merge "Use READ_PHONE_STATE when checking Carrier Configs." 2020-11-17 17:54:09 +00:00
Yintang Gu
5c39147e5a Tune up TIMEOUTs of IPSec CTS for low end devices
Ikev2VpnTest#testStartStopVpnProfileV4 and testStartStopVpnProfileV6
contains the IKE sequences and requires the phone to send and receive
the required packet in 1000ms.
On some low end devices, the response time may exceeds this TIMEOUT
sometimes.
So we need to use larger timeouts.

Bug: 171176723
Change-Id: I005b83ffecd8ade5063000690bfd4136d82f1a07
2020-11-13 10:43:31 +08:00
Treehugger Robot
4eda64baca Merge "Add an owner for NetworkWatchlistTest." 2020-11-12 13:02:46 +00:00
Treehugger Robot
f5ae03550a Merge "Use ACCESS_WIFI_STATE when clearing wifi blacklist" 2020-11-12 05:36:38 +00:00
Alan Stokes
108f82b463 Add an owner for NetworkWatchlistTest.
Test: N/A
Change-Id: Icfbeaf60e1ff98d29c449b9fcc43c0e5ce39a20e
2020-11-10 11:36:30 +00:00
junyulai
42ea4318f7 Exclude lingering traffic from loopback iface stats check
Lingering traffic from previous tests are only happens in
non-loopback interface. Stats gets from loopback interface
would not see them. Thus, exclude them from in-range check.

Test: atest TrafficStatsTest --rerun-until-failure 100
Bug: 164965653
Change-Id: Ic15c4c2e27f86b5711ada904c22734206c67d671
2020-11-10 10:11:14 +08:00
junyulai
549cc56731 Add CTS for getTx/RxBytes in TrafficStats
Test: atest TrafficStatsTest
Bug: 164965653
Change-Id: Ic3d253bbd036f40781d4f2706a67fb145ab4a575
2020-11-09 11:59:39 +08:00
Cody Kesting
a9bdde8881 Use READ_PHONE_STATE when checking Carrier Configs.
This CL Updates ConnectivityDiagnosticsManagerTest to explicitly use
the READ_PHONE_STATE permission when checking Carrier Configs for the
specified subId.

Bug: 169739061
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: I2307d7b03bcf9a918904a89be86777872a759293
2020-11-06 10:22:48 -08:00
Remi NGUYEN VAN
78cb3a9de0 Use CONNECTIVITY_INTERNAL on Q for portal URL
getCaptivePortalServerUrl requires CONNECTIVITY_INTERNAL or
MAINLINE_NETWORK_STACK on Q, and NETWORK_SETTINGS or
MAINLINE_NETWORK_STACK on R+.

Use CONNECTIVITY_INTERNAL on Q instead of NETWORK_SETTINGS to test it.

Bug: 172626873
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Change-Id: I03309de945b198ad9b40d51d799d2619bb3179ea
2020-11-06 16:14:37 +09:00
Remi NGUYEN VAN
72c7fe9b0c Use ACCESS_WIFI_STATE when clearing wifi blacklist
Some tests using CtsNetUtils, like tethering CTS tests, do not hold
ACCESS_WIFI_STATE at install time. Use shell permissions to allow the
utility to work in such configurations.

Bug: 171621759
Test: atest CtsTetheringTest:TetheringManagerTest
Change-Id: I63e76918421e5deb59fe67a64674348fb8d20265
2020-11-06 10:46:52 +09:00
Luke Huang
fcabfc688d Fix minor bug and deflaky for DnsResolverTest
1. Add the missing countdown() in the test callback
2. Add ensureWifiConnected() to prevent no available network problem.
3. Increase the timeout for awaiting private DNS setting because
   current one might not be enough.

Bug: 168027339
Test atest

Change-Id: I91190d8644ff7a7dfaf4fa3f2d43c17f67dfac11
2020-11-04 16:03:10 +08:00