Commit Graph

4234 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
0e9b130cbc Add utilities for network validation testing
Refactor out TestHttpServer to share it between CaptivePortalApiTest and
CaptivePortalTest, move it to frameworks/libs/net, and add a
NetworkValidationTestUtil class with utilities to set the test
validation URLs.

Test: atest CtsNetTestCasesLatestSdk:CaptivePortal[Api]Test
Bug: 160617623
Bug: 160656765
Change-Id: Icd7829e680b2dddd1ddaa3dc2d946c14c20b5a15
2020-08-21 19:17:03 +09:00
Treehugger Robot
7b965d116d Merge "Add a dependency test for getFrequency" 2020-08-14 04:02:54 +00:00
Remi NGUYEN VAN
1cf2445443 Add a dependency test for getFrequency
WifiInfo#getFrequency is tested in CTS since R, but because it is used
on Q devices in the NetworkStack, it should be covered by MTS.
Because wifi should be connected to run this test, CTS is the best place
to add a test.

Bug: 160006669
Test: atest NetworkStackDependenciesTest
Change-Id: I0040c2a163ef5e1a3b725d5aedc67259d01ca173
2020-08-13 15:19:27 +09:00
Chalard Jean
7356e73849 Rename Kotlin util files to not include the Kt suffix
Callers don't care what language the utilities are written in

Test: builds
Change-Id: I06bf9838432e429b3d03649654e1bcef04b89dd9
2020-07-31 17:22:49 +09:00
Chalard Jean
6bf9a90a55 Merge "Move some utils to a more appropriate package/directory" 2020-07-31 00:44:46 +00:00
Sudheer Shanka
d0f158204f Merge "Update language to comply with Android’s inclusive language guidance." 2020-07-30 21:19:38 +00:00
Sudheer Shanka
2d4d72bc31 Update language to comply with Android’s inclusive language guidance.
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: n/a
Change-Id: I466bcd05d1cb5a5ba271bd4a7513c0e7dfa5145c
2020-07-29 20:09:33 +00:00
Chalard Jean
71b829649f Move some utils to a more appropriate package/directory
Test: builds
Change-Id: Id0f0f89c34502deb6d0e50503e5534fcc51c3f9b
2020-07-29 21:15:43 +09:00
Chiachang Wang
577c469d6b Merge "Update language to comply with Android's inclusive language guidance" 2020-07-29 05:44:57 +00:00
Chiachang Wang
59201b8e94 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Bug: 161896447
Change-Id: I0c4be6060c66c75518629239703755c3fc5d99be
2020-07-29 11:58:48 +08:00
Edward Savage-Jones
241a767522 Add ConnectivityManagerTest#testSetAirplaneMode
Add a test to verify the NETWORK_AIRPLANE_MODE permission

Bug: 145164696
Test: atest android.net.cts.ConnectivityManagerTest#testSetAirplaneMode
Change-Id: I45c024f444988ec0c43d60778a1d9c9fd3acbdb5
2020-07-14 14:06:52 +00:00
Mark Chien
1129c316fd Merge "Don't run testRequestLatestEntitlementResult if not supported" 2020-07-10 07:06:56 +00:00
Treehugger Robot
ce5d7c09ab Merge "Add CtsNetTestCasesLatestSdk to mainline-presubmit" 2020-07-10 00:36:44 +00:00
Treehugger Robot
6cc5d32e6f Merge "Increase a timeout that's too short" 2020-07-09 15:11:02 +00:00
Chalard Jean
b7f471ae33 Increase a timeout that's too short
This should have been longer to start with. This oversight is due
to a poor API in TestNetworkCallback that was made that way for
backwards compatibility ; b/157405399 tracks improving this API.

Test: this
Bug: 160660082
Change-Id: If0587a2a91977427a2f679a502d838fbecdd82f2
2020-07-09 15:32:48 +09:00
Chalard Jean
2e2642f909 Merge "Ignore non-matching callbacks to fix flakiness" 2020-07-09 06:12:45 +00:00
easoncylee
a1b13d6d39 Add CtsNetTestCasesLatestSdk to mainline-presubmit
This is the pilot run for mainline testing in Test Mapping Suite.

For supporting mainline testing in Test Mapping Suite, developers can
run tests by configuring the TEST_MAPPING file, the 3 simple steps are:
  - Add tests to be part of general-tests suite if the test does not
    depend on a device specific features.
  - Update test configureation for TradeFed to run mainline testing.
  - Update TEST_MAPPING file with test-group as "mainline-presubmit"

It's only for postsubmit now, and will be moved to actual presubmit
once the whole mechanism is stable.

For more details about the usage, please refer to go/test-mapping-mainline-user-guide

Bug: 160753366
Test: forrest.
Change-Id: I8704cc5626a3e049eb3c27adb86e9c1a4d828273
2020-07-08 15:13:27 +08:00
Treehugger Robot
7dde88274a Merge "Create NetworkAgent CTS for NET_CAP_TEMP_NOT_METERED" 2020-07-08 04:30:22 +00:00
Chalard Jean
f70d762a55 Ignore non-matching callbacks to fix flakiness
This is a host-side tests that receives its network callbacks
through a custom AIDL that proxies them to this host-side
process. As this runs of the real callbacks from a real network,
this test receives unrelated callbacks – in particular calls to
onCapabilitiesUpdated to warn the process of updates of the
signal strength.
This skips these callbacks across the board by only matching
the expected callback. This will fix flakiness in the test.

Also, as a drive-by fix, this also checks the network in
the onBlockedStatusChanged callback. If the network object
is not the expected one, the test should not pass.

Bug: 160270536
Test: NetworkCallbackTests
Change-Id: I67c685ebfb2c5e2ee6f7615196eedea8292ca3ff
2020-07-08 13:07:24 +09:00
Chalard Jean
3cded8dc20 Merge "Let testB141603906 run over ADB-over-network" 2020-07-01 13:31:26 +00:00
Jiyong Park
188ebc6a7f Merge "Drop .stubs from android.test.[base|runner|mock].stubs" 2020-07-01 11:58:41 +00:00
Jiyong Park
616e299222 Drop .stubs from android.test.[base|runner|mock].stubs
The .stubs library refer to the stub library of a java_sdk_library.
Since the name of the stub library is the implementation detail of the
build system, direct use of the name should be prohibited. Actually,
clients don't need to use the stub name directly because the build
system automatically redirects <name> to <name>.stubs.

Exempt-From-Owner-Approval: too many owners are involved. This is a
simple build script change.

Bug: 157007292
Test: m
Merged-In: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
(cherry picked from commit 89c4e06853f7ea4b5a62a3b02b4f5113617b2c60)
Change-Id: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
2020-07-01 17:17:28 +09:00
Remi NGUYEN VAN
4c602c3388 Merge "Move Inet[4]AddressUtils to libs/net" 2020-07-01 04:08:25 +00:00
Remi NGUYEN VAN
ba6f3be791 Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalApiTest
(clean cherry-pick from internal branch)
Merged-In: Ic7534afe3a437f2089ed33cebdad391dc498d187

Change-Id: Ic7534afe3a437f2089ed33cebdad391dc498d187
2020-06-30 19:20:40 +09:00
markchien
b589520368 Don't run testRequestLatestEntitlementResult if not supported
If tethering is not supported, skip testRequestLatestEntitlementResult
which test TetheringManager#requestLatestTetheringEntitlementResult
API.

Bug: 159869957
Test: atest CtsTetheringTest
Change-Id: I65c32d5bc26f18f8c9d91593ab0c178e69e75c39
2020-06-30 17:04:58 +08:00
Chalard Jean
5ed6690e66 Let testB141603906 run over ADB-over-network
This test (added in R) failed to take the adb-over-network
case into account like most other tests in the same file. As
such it erroneously fails when tested over such a test setup.
This patch exempts the shell from being subject to the VPN,
like other similar tests do, to avoid the adb connections
being killed.

Test: VpnTest
Bug: 159761399
Change-Id: I0bc14d4d2cade7618c59b2cb88638bdf608d43d3
2020-06-29 02:02:35 +00:00
Lorenzo Colitti
a86ff10ecf Merge "Increase ConnDiagsTest timeout for end-to-end test." 2020-06-26 07:13:56 +00:00
Cody Kesting
c8d9a5706e Increase ConnDiagsTest timeout for end-to-end test.
This change increases the delay allowed for administratorUid updates to
reach ConnectivityService in #testRegisterCallbackWithCarrierPrivileges.
Currently, there is no deterministic signal that can be used to wait for
this change, so Thread#sleep is required. This value is increased
because the previous delay did not give enough time for the
administratorUid change to reach CS, causing test flake.

Bug: 159718782
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: I36347f6d52e3ce1bd30e3f74c35f4ecd15c8c65e
2020-06-26 07:13:45 +00:00
Cody Kesting
ee8feba3c1 Fix ConnDiags Test for invoke-after-validate and unregister CBs.
This change fixes several things in ConnectivityDiagnosticsManagerTest:
- testOnConnectivityReportAvailable creates the Test Network after
registering the ConnectivityDiagnosticsCallback. This ensures that the
callback is invoked only after the network is validated (not for the
on-register behavior).

- The TestNetworkInterface created while setting up the Test Network is
held onto for the duration of each test. This ensures that the interface
is not garbage collected during the test. While the interface is not
needed for the test, this change makes it clear when the interface is
cleaned up.

- All registered ConnectivityDiagnosticsCallbacks are unregistered at
the end of each test. This ensures that all accompanying NetworkRequests
are cleaned up. If NetworkRequests are leaked, unrelated test failures
can occur (the platform limits the number of NetworkRequests per UID).

Bug: 156294356
Bug: 148032944
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: I1836536fe60a65ba33170cd80e8f4996f1965d19
Merged-In: I1836536fe60a65ba33170cd80e8f4996f1965d19
2020-06-25 01:07:48 +00:00
Luke Huang
10fa0790d9 Merge "Add net-utils-framework-common to cts-net" 2020-06-24 18:41:18 +00:00
Luke Huang
1ef852ef06 Merge "Update DnsPacket package name" 2020-06-24 18:39:56 +00:00
Cody Kesting
5c2e383949 Only run ConnectivityDiagnosticsManagerTest as AppModeFull.
This CL restricts ConnectivityDiagnosticsManagerTest to only being run
as @AppModeFull. This is required, as Instant Apps are not allowed
CHANGE_NETWORK_STATE (required for CM#requestNetwork) or
MANAGE_TEST_NETWORKS (required for TestNetworkManager#setupTestNetwork)
permissions - both of which are required for
ConnectivityDiagnosticsManagerTest.

Bug: 158431112
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: Id867b8dcaca758cfeb83009848e1099e900a0790
Merged-In: Id867b8dcaca758cfeb83009848e1099e900a0790
2020-06-24 07:59:36 -07:00
Luke Huang
1eebfa3d87 Add net-utils-framework-common to cts-net
In order to avoid class package missing problem, add
net-utils-framework-common in cts net test build. Also jarjar
the package name to prevent conflict.

Test: build
Test: atest DnsResolverTest
Bug: 150952393
(clean cherry-pick from internal branch)
Merged-In: I40e2d4c4945a0579f6e1923e4722b09354ff050c
Change-Id: I40e2d4c4945a0579f6e1923e4722b09354ff050c
2020-06-24 11:39:56 +00:00
Luke Huang
d9daaff707 Update DnsPacket package name
The package name needs to be updated as
the class is moved into com.android.net.module.util.

Bug: 149403767
Test: atest DnsResolverTest
(clean cherry-pick from internal branch)
Merged-In: I908cb5f7bc6150e461748c8e34c92a19aa0206e4
Change-Id: I908cb5f7bc6150e461748c8e34c92a19aa0206e4
2020-06-24 19:38:10 +08:00
Lorenzo Colitti
c7f94d5052 Merge "CTS test ConnectivityDiagnostics via CarrierPrivilegesTracker." 2020-06-22 04:41:43 +00:00
Cody Kesting
7d1159a2d4 CTS test ConnectivityDiagnostics via CarrierPrivilegesTracker.
This change adds a CTS test for ConnectivityDiagnostics using
CarrierPrivilegesTracker to receive permissions for
ConnectivityDiagnostics callbacks.

Specifically, the test provides CarrierPrivileges to the test package
(android.net.cts) for the active subscription via Carrier Configs
overrides. CarrierPrivilegesTracker listens to the Carrier Configs
change and matches the loaded certificate with the test package, then
includes the test package UID as an administrator for the Network in
ConnectivityService. Then, a ConnectivityDiagnosticsCallback is
registered and receives a ConnectivityReport on register for the active
subscription.

Bug: 148032944
Bug: 151332031
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Iee8a428ada0b6e2127410267a13c3b688df83e6d
2020-06-17 10:38:48 -07:00
Treehugger Robot
1ae290c1a6 Merge "Toggle wifi when running CaptivePortalTest" 2020-06-16 00:43:07 +00:00
Benedict Wong
a330e50192 Merge "Verify owner of IKEv2 VPNs" 2020-06-15 17:09:46 +00:00
Remi NGUYEN VAN
fa761d5917 Toggle wifi when running CaptivePortalTest
Instead of reconnecting without disabling/re-enabling wifi in
CaptivePortalTest, actually do the toggle during the test and
on teardown to ensure that the BSSID blacklist is cleared.

CaptivePortalTest intentionally makes the network not validate, which
causes it to be added to the BSSID blacklist. Toggling wifi is necessary
to make sure the test does not affect other tests.

Also check development SDK instead of the exact SDK_INT number so that
the test can pass on current AOSP builds.

Bug: 158924461
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalTest \
          CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Change-Id: I31f9f4a9678e11042005c29535af840246358764
2020-06-15 19:38:01 +09:00
Treehugger Robot
10f23078c1 Merge "Fix CtsTetheringTest on devices without permanent softAp interfaces." 2020-06-15 09:49:44 +00:00
markchien
24d8b8391e Fix CtsTetheringTest on devices without permanent softAp interfaces.
Normally stop wifi tethering flow would be:
Tethering#stopTethering -> WifiManager#stopSoftAp -> softAp disabled,
then have WIIF_AP_STATE_CHANGED intent -> stop IpServer and broadcast
TETHER_STATE_CHANGED intent. SoftAp is disabled before tethering stop.

Because tethering would shutdown the corresponding IpServer if it
observed the interface is removed. For those devices that softAp
interface would be removed when stop tethering, the flow may be
Tethering#stopTethering -> WifiManager#stopSoftAp -> softAp disabing,
softAp interface is removed -> tethering trigger stop IpServer and
broadcast TETHER_STATE_CHANGED intent -> -> softAp disabled, then wifi
broadcast WIIF_AP_STATE_CHANGED intent. In this case, tethering is
stopped ready before softap is disabled.
For this case, CtsTeteringTest would have race between two test cases.
If two case need to start wifi tethering for testing and stop wifi
tethering after finish testing.
The second test may suffer from startTethering fail problem due to
softAP is not disabled yet.
    E WifiService: Tethering is already active.

Bug: 157806780
Test: atest CtsTetheringTest

Change-Id: I0ba6bc9dcbf7829dcad5561c707d5f5c5540f10b
2020-06-15 13:42:40 +08:00
Treehugger Robot
3475b733b5 Merge "Fix MultinetworkApiTest fail problem in instant mode" 2020-06-11 00:22:51 +00:00
Treehugger Robot
08a29ff260 Merge "Fix tests that failed on devices without IPsec tunnel feature" 2020-06-09 18:56:32 +00:00
Luke Huang
23710588f9 Fix MultinetworkApiTest fail problem in instant mode
CtsNetUtils#storePrivateDnsSetting might require WRITE_SECURE_SETTINGS
permission to run.
Therefore, move it from setUp to only belong to the required test case.

Bug: 158538281
Test: run cts --include-filter "arm64-v8a CtsNetTestCases[instant]
android.net.cts.MultinetworkApiTest"

Change-Id: I8ecadd134824a4023a3c6e173d52ba088d46b103
2020-06-10 00:51:39 +08:00
Treehugger Robot
5469352727 Merge "Reset vpn provision status" 2020-06-09 04:06:06 +00:00
Benedict Wong
9d1f86f3a8 Verify owner of IKEv2 VPNs
This change adds assertions to ensure that the owner UIDs of IKEv2 VPNs
are correctly set.

Bug: 150135470
Test: This
Change-Id: Iabf2859c289aa86ec38aea1edcc1fb248b9d0d26
2020-06-08 14:19:14 -07:00
evitayan
ce3c9ae278 Fix tests that failed on devices without IPsec tunnel feature
Three tests failed when they try to set up IKE Session with a
tunnel mode Child SA and the device does not have ipsec tunnel
feature. This commit changed these tests to set up IKE Session
with a transport mode SA because 1) the logic these tests are
verifying is unrelated to the Child SA type and 2) using
transport mode make sure these tests run on all the devices.

Bug: 158268209
Test: CtsIkeTestCases, verified on taimen
Change-Id: I9a8c7f631f0e6e02492816e3fbf0d751017dc2b3
2020-06-08 11:07:02 -07:00
Xin Li
cacd78fef9 Merge changes from topic "QQ3A.200605.002_merge"
* changes:
  Convert Android.mk to Android.bp for CVE-2018-9536
  Merge QQ3A.200605.002 into master
2020-06-06 01:41:30 +00:00
Lucas Lin
fbf126a6f8 Merge "Enlarge the onAvailable callback timeout to 30 seconds" 2020-06-05 08:53:49 +00:00
Treehugger Robot
10944b6376 Merge "Add CtsNetTestCasesLatestSdk to postsubmit" 2020-06-05 04:38:40 +00:00