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
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
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
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
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
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
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
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
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
DeviceConfig.resetToDefaults is designed to only be used by RescueParty
to reset flags and ban values after a disaster (e.g. bootloop). It's not
designed to be used to clear up local changes and causes CTS tests to
break/be flaky.
Switching to reading existing values, changing them, and reverting
to the pre-existing values to avoid further test breakages.
Bug: 165943447
Test: atest CtsAlarmManagerTestCases
Test: atest CtsBatterySavingTestCases
Test: atest CtsHostsideNetworkTests
Test: atest CtsJobSchedulerTestCases
Test: atest CtsPermissionTestCases:LocationAccessCheckTest
Change-Id: I237d2cd2b862a826f7e871b7a7c31840a3470d0a
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