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
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
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
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
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
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
Use runAsShell from the new TestPermissionUtils, and rename popPacket to
poll.
Bug: 168868607
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I0d938e2967f3adc324dd2bc81138b4b2910af5f8
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
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
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
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
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
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
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