Commit Graph

2121 Commits

Author SHA1 Message Date
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
Treehugger Robot
9670ecfaa3 Merge "Fix MultinetworkApiTest for instant mode" 2020-10-30 13:28:53 +00:00
Weilun Du
aa00145105 Fix MultinetworkApiTest for instant mode
add AppModeFull@ to MultinetworkApiTest since CHANGE_NETWORK_STATE
could not be granted in instant mode.

CHANGE_NETWORK_STATE is required to select networks that are up but
not in the foreground, for example, the mobile network after the linger
timer has expired.

Bug: 168809106
Test: atest MultinetworkApiTest
      atest MultinetworkApiTest --instant

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: I37ca1a0f58d1c2ab57f8cd4489c2cfb13b0f2d39
2020-10-30 10:22:06 +00:00
Chalard Jean
e3c9bb8545 Merge "Make sure agents start in the CONNECTING state" 2020-10-29 12:31:03 +00:00
Treehugger Robot
5ecf780e6e Merge "Don't run hotspot related tests if Soft AP is not supported" 2020-10-29 05:32:56 +00:00
markchien
8705535e40 Don't run hotspot related tests if Soft AP is not supported
Also explicitly hold ACCESS_WIFI_STATE permission to avoid
no permission problem when using WifiManager#getScanResults
without shell identity.

Fix: 169219565
Test: "atest CtsTetheringTest" in cuttlefish and phyical device

Change-Id: I3d8fa7e8882bf96f61f3316a70efdf991addbcb2
2020-10-29 11:10:46 +08:00
Dan Shi
98716c5cdc Add all CTS tests to general-tests suite
Exempt-From-Owner-Approval: this change only adds the tests to
general-tests.zip, doesn't change any test behavior.

Bug: 171481522
Test: none
Change-Id: I1711237f00572d57f611dcd16ec9ad345a0b5b3b
2020-10-27 22:25:33 +00:00
Remi NGUYEN VAN
1cdfeec47d Merge "Move apache HTTP tests out of tests/net" 2020-10-27 06:39:25 +00:00
Remi NGUYEN VAN
438200afb9 Move apache HTTP tests out of tests/net
The apache HTTP library is part of the platform core APIs, which are
separate from the core networking APIs.

cts/tests/tests/net is planned to move to a separate git project to put
it closer to the associated connectivity module code.

Bug: 170371348
Test: m cts && cts-tradefed run cts -m CtsApacheHttpTestCases
Change-Id: I49972b21755235e280c75eec40db14f3db974ca1
2020-10-27 11:07:04 +09:00
Treehugger Robot
7851370b12 Merge "Add com.google.android.resolv.apex and com.google.android.tethering.apex for CtsNetTestCasesLatestSdk." 2020-10-26 08:56:35 +00:00
easoncylee
48c4cf621d Add com.google.android.resolv.apex and com.google.android.tethering.apex
for CtsNetTestCasesLatestSdk.

Reference: https://android-review.googlesource.com/c/platform/cts/+/1331100/3/tests/tests/net/AndroidTestTemplate.xml#23

Bug: 160877913
Test: forrest.
Change-Id: If39c594a0fdc39a8a7272464fc59e2a1483f6d54
2020-10-23 13:10:56 +08:00
Remi NGUYEN VAN
0c70933916 Wait for connect before dropping permissions
WifiManager#connect is implemented with a oneway binder call, so it may
return before the permission check. The previous code could drop shell
permissions before the check is performed.

Use WifiManager.ActionListener to wait for the operation to end before
dropping permissions.

Also refactor current usages of various "run as shell" utilities to use
TestPermissionUtil.runAsShell, which is the "standard" utility used in
connectivity tests (both in CTS and in other tests).

Bug: 170371191
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalTest
Change-Id: I0f47c455f2c1596a887abab7d35146d8557d736a
2020-10-22 15:37:50 +09:00
Chalard Jean
845fa07bdc Make sure agents start in the CONNECTING state
Bug: 170904131
Test: this
Change-Id: I302b75c8e6606379c1887fa559b29bb4d29e0bdf
2020-10-17 01:03:44 +09:00
markchien
2888ab7bc7 Migrate Tethering util functions to CtsTetheringUtils
Bug: 166057846
Bug: 170265597
Test: atest MtsTetheringTest
      atest CtsTetheringTest
Change-Id: I59d529cb50b4b6cdafc6be78ad61a55ee1be0404
2020-10-16 17:11:20 +08:00
Yan Yan
d8f0f4a3c7 Merge "Migrate IPsec CTS out of tests/tests/net" 2020-10-15 17:30:49 +00:00
Yan Yan
b4d5a4b66f Migrate IPsec CTS out of tests/tests/net
Bug: 170487836
Test: atest CtsIkeTestCases
Change-Id: I08f069c2a11f3daa3f0332c631055a1e0be7ce7b
2020-10-14 10:58:37 -07:00
Treehugger Robot
b54ca7b0c3 Merge "Do not expect broadcasts in CaptivePortalTest" 2020-10-14 11:57:25 +00:00
Sudheer Shanka
468293beef Merge "Verify network state of apps hosting fg-service and in idle state." 2020-10-12 23:31:17 +00:00
xiamengsen
05c8a1ddd0 Verify network state of apps hosting fg-service and in idle state.
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java

Signed-off-by: xiamengsen <xiamengsen@xiaomi.com>
Change-Id: I0e6e40b714483e51cfee45c155d8ac8b2b356494
2020-10-12 18:42:00 +00:00
Treehugger Robot
1dd1530647 Merge "Update the QUIC packet format." 2020-10-12 11:40:54 +00:00
Remi NGUYEN VAN
48ea3b6816 Do not expect broadcasts in CaptivePortalTest
The legacy broadcast may not be sent if wifi does not become the default
network within timeout. CaptivePortalTest does not need wifi to be the
default network at the start of the test, as it will be
disconnected/reconnected immediately after anyway.

Bug: 169106352
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalTest
Change-Id: Ie4ee6b3c3ed7c0d414fd3cc162d4183248120895
2020-10-12 17:36:19 +09:00
Remi NGUYEN VAN
1bc58efade Merge "Use new test utilities from frameworks/libs/net" 2020-10-12 02:00:55 +00:00
Chalard Jean
43370c622d Merge "Fix a way for this test to flake." 2020-10-09 04:29:17 +00:00
Remi NGUYEN VAN
ae04a86b0b Use new test utilities from frameworks/libs/net
Use runAsShell from the new TestPermissionUtils, and rename popPacket to
poll.

This rolls forward the previous change as-is. See change
I34bad7ec79ef0fd03e5e40b643f0d85d686c53ec for details on why the
previous change was reverted.

Bug: 168868607
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I7b5176e84ffe08cc5ea1251f66cdcb9b7066ec0a
2020-10-09 02:54:33 +00:00
Remi NGUYEN VAN
dcc8bf6706 Merge "Revert "Use new test utilities from frameworks/libs/net"" 2020-10-09 01:48:20 +00:00
Remi NGUYEN VAN
0d4dee1c1a Revert "Use new test utilities from frameworks/libs/net"
Revert submission 1440811-iputils_constants_move

Reason for revert: Likely broke build in b/170438226
Reverted Changes:
Ic382d24e7:Move NetworkStackConstants to frameworks/libs/net
I0d938e296:Use new test utilities from frameworks/libs/net

Change-Id: Iec4709778ba1b30687df265a2a5c694c536b5456
2020-10-09 01:38:44 +00:00
Remi NGUYEN VAN
2087f3eeb1 Merge "Use new test utilities from frameworks/libs/net" 2020-10-09 00:14:15 +00:00
Treehugger Robot
c2339c4fb7 Merge "Remove vts10 suite setting" 2020-10-08 17:46:42 +00:00
Lorenzo Colitti
06aad059fb Update the QUIC packet format.
The QUIC packet format has changed again. Update the test to
ensure that the GFE can drop support for the old packet format
without causing all devices to fail CTS.

Packet format changes suggested by dschinazi@.

Test: atest --rerun-until-failure 100 CtsNetTestCasesLatestSdk:MultinetworkApiTest#testNativeDatagramTransmission
Change-Id: I8625ac9a58c55fc19dfb9fdb5f34a89cee40caaf
2020-10-08 16:28:33 +09:00
Dan Shi
d65405de4b Remove vts10 suite setting
Bug: 169583551
Test: build
Change-Id: I42d38bd2f9e8b1e932571a38c2ebe72861d18fca

Exempt-From-Owner-Approval: This CL remove vts10 from test_suites setting.
Change-Id: I42d38bd2f9e8b1e932571a38c2ebe72861d18fca
2020-10-07 02:31:26 +00:00
Remi NGUYEN VAN
ddb629663b Merge "Add a test for getCaptivePortalServerUrl" 2020-10-07 00:53:06 +00:00
Chiachang Wang
d074c9ea58 Merge "Don't wait for unnecessary disconnect broadcast" 2020-10-07 00:50:36 +00:00
Treehugger Robot
7ba787cc83 Merge "Move CtsNetTestCasesLatestSdk to presubmit" 2020-10-06 14:12:49 +00:00
Chiachang Wang
b40f760f8d Don't wait for unnecessary disconnect broadcast
testTetheringUpstream does not require WIFI to be default
network since the test disconnects WIFI and verifies that
tethering use cellular network to be its upstream. Test only
needs to ensure WIFI is disconnected so the broadcast is not
necessary. Change to alternative method that does not wait for
disconnect broadcast to prevent flaky caused by unvalidated
wifi network.

Bug: 168217651
Test: atest TetheringManagerTest
Change-Id: If74fcad192cb4d4947ac2c99cd9ea2d3971d2cac
2020-10-05 14:11:43 +08:00
Remi NGUYEN VAN
8b8e27df06 Use new test utilities from frameworks/libs/net
Use runAsShell from the new TestPermissionUtils, and rename popPacket to
poll.

Bug: 168868607
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I0d938e2967f3adc324dd2bc81138b4b2910af5f8
2020-10-05 14:32:57 +09:00
Remi NGUYEN VAN
a1b195ee3f Add a test for getCaptivePortalServerUrl
The API returns a URL that can be used to test the presence of a captive
portal.
The only requirements are that the URL is valid, and HTTP (as per
javadoc).

Bug: 168755498
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I9a92b422a7df2379fadab79ed49b77e7c2fcc393
2020-10-05 13:02:21 +09:00
Remi NGUYEN VAN
a773ccbe97 Move CtsNetTestCasesLatestSdk to presubmit
The last 19 runs have been green. This is already in presubmit in other
branches.

Note that mainline-presubmit is still not supported in some branches.

Bug: 158153057
Test: m
Merged-In: I9d7954503990902ae807d74de14f4a2874328072

Change-Id: I9d7954503990902ae807d74de14f4a2874328072
2020-10-05 10:34:35 +09:00
Treehugger Robot
accaf62b80 Merge "Skip unsupported hardware for testB141603906" 2020-10-02 02:53:35 +00:00
Chalard Jean
4613c7e02a Fix a way for this test to flake.
While tests are hopefully cleaning up after themselves,
there is no guarantee that there is a currently available
default network milliseconds after any given test. Some
tests need to disconnect to check something, or to change
a property of the wifi network that they have to revert at
the end for example. Or, a test may fail leaving the device
without a default network.

To make sure the state is correctly cleaned up, have
tearDown make sure the device is connected to a working
Internet connection before the test ends, so that the next
test can be sure to find established connectivity
immediately. It's possible the device needs a few hundred
milliseconds to re-establish connectivity, so this patch
gives a grace of up to 30 seconds (the default waiting
timer for TestCallback) for connectivity to be restored at
the end of any test.

Bug: 161767594 and others
Test: ConnectivityManagerTest
Change-Id: I8cf3e6e6c116cabd5b04bf2562da84f7e635ca2a
2020-09-29 10:03:01 +00:00
Chiachang Wang
4ffaa483a7 Merge "Don't check broadcast intent on connection status check" 2020-09-24 10:07:56 +00:00
Chiachang Wang
8ff9c262ca Don't check broadcast intent on connection status check
testRequestNetworkCallback_onUnavailable is flaky because
the test expects a connectivity broadcast to be sent for the
lost network. But after testSetAirplaneMode, the wifi network
is not yet default network so a broadcast is never sent but
only onUnavailable is triggered. Replace disconnectFromWifi
with ensureWifiDisconnected to skip checking the broadcast.

Bug: 162323152
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest\
      --rerun-until-failure 20
Change-Id: I88f434798ec83539df9cc6a81446ca37a0081e3b
2020-09-24 09:38:53 +00:00
paulhu
01f9b00e88 Add CTS to verify DownloadManager permission
If DownloadManager doesn't have
CONNECTIVITY_USE_RESTRICTED_NETWORKS permission, it can't bind
socket to VPN when it is in VPN disallowed list but requested
downloading app is in VPN allowed list. Add a new CTS test to
verify that DownloadManager can do the download successfully via
VPN network.

Bug: 165774987
Test: atest HostsideVpnTests
Change-Id: Iba9e2f26ad325d0fdb34ab9a06faaaf9cb623166
2020-09-24 10:47:19 +08:00
Chiachang Wang
17ee20dc59 Deflake test to ensure airplane mode switches work as expected
testSetAirplaneMode verifies the result by checking if intent is
broadcasted or not. The working internet may sometimes remain
connected if the commands processed fast but sometimes don't.
It will leave uncertain network status to the follow-up tests
and cause flaky. This behavior specifically breaks
testRequestNetworkCallback_onUnavailable. As WiFi is not
enabled and still disconnecting, the behavior will confuse
test to not to disconnect WiFi. However, test may still get an
active WiFi network since the WiFi is not disconneted yet. Thus,
verify that working internet should disconnect and reconnect
expectedly if airplane mode is updated.

Bug: 162323152
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest\
      --rerun-until-failure 20
Change-Id: Id126c43b1f009e7bbce18d75020f25347448b7fb
2020-09-18 10:51:11 +08:00
Josh Yang
ae3412405d Skip unsupported hardware for testB141603906
Bug: 168748249
Fix: 168748249
Test: local cts passed.
Change-Id: I8af0d5f9716a510322b2bfb0cdf6f05f94b12604
2020-09-17 00:27:59 +00:00
Xin Li
77065af37d Merge "Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)" into stage-aosp-master 2020-09-01 20:03:43 +00:00
Treehugger Robot
b974f51473 Merge "Don't require WiFi in CtsHostsideNetworkTests." 2020-09-01 09:15:35 +00:00
Tse Ho Lin
243c42a9b9 Don't require WiFi in CtsHostsideNetworkTests.
Skip test for non-WiFi connections.

Bug: 162192335
Test: run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideNetworkCallbackTests#testOnBlockedStatusChanged_dataSaver
Change-Id: I7c20e3454a2fe81671162e0a50f90d64ed7516d0
2020-09-01 05:20:44 +00:00
Cody Kesting
cb00911ada Specify CAPABILITY_INTERNET for ConnDiags CTS test.
This CL updates the NetworkCapabilities used for getting a cellular
data network in ConnectivityDiagnosticsManagerTest to require
CAPABILITY_INTERNET.

Bug: 166732795
Test: atest CtsNetTestCases
Change-Id: Ia32ac00f949a2ee9319c80c25f294bfa834ad0f9
2020-08-31 11:00:26 -07:00
Xin Li
9d04ab0a42 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Id9ba142af9d2da12bda66d0c376d4b8c13f1503b
Change-Id: I1a1bdaabd06f43b695ac94172a6f46d00b7f5b84
2020-08-29 01:22:07 -07:00
Treehugger Robot
d863e35484 Merge "Add working internet precondition check" 2020-08-27 11:12:35 +00:00