Commit Graph

2288 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
7ecf53ec21 Fix timeout on NetworkAgentTest callback am: abb46bef36 am: 44cc38ce67 am: bc1e892463
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1530739

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifb92470433df1f096261968d9d10a1e314ab705b
2020-12-21 05:46:55 +00: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
6a2a355206 Move cts/net/TEST_MAPPING to toplevel am: 9b6b353b5d am: 69963e8600 am: d2c83f152a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1529961

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2778ead9d69a36d7e3b23be98e18b318f00f40b7
2020-12-16 03:20:33 +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
d57fcbe873 Merge changes from topic "cs-generalize-underlying-networks" am: 678d27faca am: 7c822d82b7 am: 2ed0825b76
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1526361

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibaab9f8b09cecb9bea9dcbad14d54939d3829628
2020-12-14 06:40:27 +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
becc4502e2 Merge "Pass in proper NetworkCapabilities in testSetUnderlyingNetworks." am: 78f7c04770 am: 06513c4cd2 am: bdd3d7477a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1518566

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6ff7d4a93529d6dfee4271c429aa837f6ebca78
2020-12-09 03:05:38 +00: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
f3bc8c4b6d Set noparent in connectivity CTS owners am: d01761e07f am: 7fc54e7294 am: 80c934b7fe
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1516266

Change-Id: I287c02192a32b87b9100ece72259e1a65bb04b8a
2020-12-03 11:50:21 +00: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
5016423e6d Merge "Add a CTS test for NetworkAgent#setUnderlyingNetworks." am: 7d04b2a26c am: 6bd26a9f30 am: b8a7b65506
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1511114

Change-Id: Ie06c01450106f7b8bb4fd247a372420074326954
2020-11-28 04:50:46 +00:00
Lorenzo Colitti
7d04b2a26c Merge "Add a CTS test for NetworkAgent#setUnderlyingNetworks." 2020-11-28 02:49:53 +00:00
Treehugger Robot
d9f603eebf Merge "Fix race condition in NetworkWatchListTest" am: de39ae42ac am: 59ecc20061 am: 14991f2507
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1511070

Change-Id: I0f6639d68c486ff556ee28b65476cfab2cf61fd6
2020-11-27 11:40:56 +00:00
Treehugger Robot
de39ae42ac Merge "Fix race condition in NetworkWatchListTest" 2020-11-27 10:12:05 +00:00
Remi NGUYEN VAN
8b94253963 Merge "Add TEST_MAPPING config for CTS postsubmit" am: d4430d28ba am: 9d29736aea am: 1b305b9cac
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1509694

Change-Id: I49f70affe37bee2091cd7222afc469c43e3fee95
2020-11-27 10:02:29 +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
214ba4350c Merge "Revert "Tweak NetworkWatchListTests."" 2020-11-26 13:34:38 +00:00
Alan Stokes
29e0258707 Revert "Tweak NetworkWatchListTests."
This reverts commit 17b1001282.

Reason for revert: I'll resubmit in AOSP, with the fix for the test included.

Change-Id: I5bd63a5341a9b67ce63ec34080de13ed9203eba6
2020-11-26 12:30:05 +00:00
Treehugger Robot
6a9fca1fab Merge "Tune up TIMEOUTs of IPSec CTS for low end devices" am: 1de9621925 am: 8f501fea9c am: 0922cab8d6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1498276

Change-Id: I47aba7368f00194121235957efbb4b1810b21c3f
2020-11-25 21:15:03 +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
341e40ff92 Merge changes from topic "TrafficStats.getTxRxBytes" am: 42fbb57b31 am: 3e5a3ed5d5 am: 7bd157737e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490181

Change-Id: I2ed2b34cc43b7822e82aaa8482d1c6dfdbe9c4e3
2020-11-25 06:32:26 +00:00
junyulai
7fbfe6b4b6 Add CTS for getTx/RxBytes in TrafficStats am: 549cc56731 am: 34fe3e48e4 am: 2551dc97bc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490180

Change-Id: Iea8de06176cffcb0d32dcd63ceb070d887d3706b
2020-11-25 06:32:25 +00:00
junyulai
34fe3e48e4 Add CTS for getTx/RxBytes in TrafficStats am: 549cc56731
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490180

Change-Id: Id02aa1ab9038287da16594d513368935408ed8c5
2020-11-25 04:14:46 +00: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
1cb10ffcb7 Merge "This bug was fixed in S, don't test for it in R" am: d639d12161 am: a56ea8445c am: 57674cb4d7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1505171

Change-Id: I6d7b4a2b1b952b7d12f482ffd44676e19f28ee31
2020-11-24 10:25:17 +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
b0d9d4c91a Merge "Use READ_PHONE_STATE when checking Carrier Configs." am: b9e51da2e8 am: 38cda37e44 am: 858c8c94c8 am: b079174dcb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1489639

Change-Id: I47cbb1dfae6176bd8ede840636a06373ecdf358d
2020-11-17 19:57:05 +00: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
98fd4e7b1d Merge "Add an owner for NetworkWatchlistTest." am: 4eda64baca am: 107b0a0745 am: 458c898778 am: 3cd209f671
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1492980

Change-Id: Ie4a100bd2c1a78dc3a663c140537e0fa313eea51
2020-11-12 14:53:05 +00:00
Treehugger Robot
4eda64baca Merge "Add an owner for NetworkWatchlistTest." 2020-11-12 13:02:46 +00:00
Treehugger Robot
55c6c776df Merge "Use ACCESS_WIFI_STATE when clearing wifi blacklist" am: f5ae03550a am: 85dfa5cae0 am: 531e6b8080 am: b39a8f6def
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490016

Change-Id: Ifa5c49beeb12bfebbe2cd35e9a2cb578389b8794
2020-11-12 07:22:36 +00:00
Treehugger Robot
91148a5d94 Merge "Use CONNECTIVITY_INTERNAL on Q for portal URL" am: 2a7cf08b8e am: 58ae094ec7 am: 1a7d76dba8 am: 288211a65b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490178

Change-Id: Ic07bea55ec41cb2ef96554b8b490b0297fb81308
2020-11-12 07:22:29 +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
TreeHugger Robot
8f7c1c2d3d Merge "Tweak NetworkWatchListTests." 2020-11-10 10:21:52 +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
Luke Huang
e2005b0138 Fix minor bug and deflaky for DnsResolverTest am: fcabfc688d am: f904b98507 am: 50afb08ab9 am: 3aad4761fe
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1486780

Change-Id: I0ee8161fac3b6db7a000ddb0a057cd91a17bd7d5
2020-11-09 06:52:52 +00: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
Alan Stokes
17b1001282 Tweak NetworkWatchListTests.
Add logging to try to help diagnose flakiness.

And while I'm here, simplify & improve file closing logic.

Bug: 168216494
Test: atest CtsNetTestCases:android.net.cts.NetworkWatchlistTest
Change-Id: I1c875102f0cce32cbbe2e3b36de913741c9abb92
2020-11-06 16:57:53 +00: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