summaryrefslogtreecommitdiff
path: root/tests/common/java/android/net/NetworkCapabilitiesTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix CtsNetTestCases on QRemi NGUYEN VAN2022-04-151-18/+21
| | | | | | | | | | | | | | | | | | - Skip NetworkCapabilitiesTest on Q. The test covers code that is very localized in NetworkCapabilities.java, and is only updatable on S+, so does not need to be in MTS before that. - Fix ConnectivityManagerTest to remove external references to CaptivePortalData instances in the lambdas, as this is compiled into a method taking CaptivePortalData as argument, and because the class does not exist on Q, the test runner would crash enumerating method arguments. - Remove call to getSystemService(ETHERNET_SERVICE) on Q from the test thread, as it will crash when called from a thread that does not have a Looper. Test: atest CtsNetTestCases Bug: 227253613 Change-Id: I97c64b24c767e874dfba00aa1f46be2c4972f917
* Rename setAccessUids to setAllowedUidsChalard Jean2022-03-161-20/+20
| | | | | | | Bug: 217725769 Test: ConnectivityServiceTest CtsNetTestCases Change-Id: Ic8a3f91553d1462b7f54259c467fb90a950bdd59 Merged-In: I8860fbb353eedf5d01e9dc248e4d765046bd562c
* Merge "Allow test+other networks to have specifiers"Remi NGUYEN VAN2022-02-141-16/+30
|\
| * Allow test+other networks to have specifiersRemi NGUYEN VAN2022-01-121-16/+30
| | | | | | | | | | | | | | | | | | | | | | | | Allow adding a network specifier to networks that have two transports, if one of them is TRANSPORT_TEST. This allows creating test ethernet networks that have a network specifier. Bug: 175199512 Test: atest NetworkCapabilitiesTest Change-Id: I2ced91926dff21fbe143258f33f3d42004a954c7
* | Add accessUids to NetworkCapabilities.Chalard Jean2022-01-311-0/+46
| | | | | | | | | | | | | | | | For now, all entry points reject this. Followup changes will allow the supported use cases. Test: new unit tests and CTS for this in this patch Change-Id: I7262811a2e46336d3bb63c80886fc0578a36da94
* | Add low latency and high bandwidth network capabilitiesSooraj Sasindran2022-01-251-0/+27
| | | | | | | | | | | | Bug: 194332512 Test: build Change-Id: I415ca1ba90ea54c4106f806fe855bcb84d3e38ba
* | Add support for Multiple enterprise sliceSooraj Sasindran2022-01-221-46/+47
| | | | | | | | | | | | | | Bug: 194332512 Test: unit test CTS-Coverage-Bug: 211133973 Change-Id: Ie8be08a7cfa9155168d1da146d02fd1643248bdc
* | Merge "Update the SDK for the tests with intended target in T+"Chiachang Wang2022-01-211-1/+2
|\ \
| * | Update the SDK for the tests with intended target in T+Chiachang Wang2022-01-201-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Correct the SDK for those tests are expected running in T+ device. Check @IgnoreUpTo(S) may be incorrect after receiving patches before T release. Refer to temporary constant definition in DevSdkIgnoreRule until the SDK constant being pushed into AOSP and synced with branch used for mainline. BUg: 215294242 Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk Change-Id: Ide6a241f7944dd1e75bc33b21aa29471a5df94c6
* / Do not verify field count in tests used in CTSRemi NGUYEN VAN2022-01-181-16/+1
|/ | | | | | | | | | | | | | | | | Tests in tests/common and tests/cts are run as part of CtsNetTestCases. Many used assertFieldCountEquals in parceling/unparceling tests to ensure that unexpected fields were not added, or that they were not missed when testing parceling/unparceling. However with many of the classes updatable through module updates, the field count may change in the future, breaking CTS tests. Stop checking for the field count, as it would break on module releases, and its value is lower than the maintenance cost. Bug: 205901761 Test: atest CtsNetTestCases Change-Id: I79854741f7e834574d4825bb737ef507785310fe
* Add enterpriseSpecifierSooraj Sasindran2021-12-231-1/+88
| | | | | | | | | Add enterpriseSpecifier to network capability Bug: 194332512 CTS-Coverage-Bug: 211133973 Test: CTS and unit test. Change-Id: If16c8e17cee71cc6788c43a8818bcca68a00bf99
* Remove NetworkCapabilities#combine*Chalard Jean2021-12-131-129/+1
| | | | | | | | | | | | | | | | This is no longer used outside of tests, and can be safely removed. Also this family of methods is fairly confusing, as while it's well defined for some members, many later additions had to be written so as to dissallow some combinations when the workings of this family of methods didn't match the semantics of some members, making them possibly dangerous to use and at least exhibit difficult to understand semantics. Test: FrameworksNetTests m Change-Id: Ia69c20afa16c2153839891f6e33331caa9da33ff
* Fix NetworkCapabilitiesTest on SRemi NGUYEN VAN2021-11-111-7/+14
| | | | | | | | | | | | | | Mark NetworkCapabilitiesTest as ConnectivityModuleTest so that it is only run in MTS with the Connectivity module installed, and fix parceling tests to use the right number of fields in that case. NetworkCapabilitiesTest is only useful to test the Connectivity module, and not other modules like NetworkStack, as it is a unit test of a class in the Connectivity module. Bug: 205901761 Test: atest NetworkCapabilitiesTest Change-Id: I10ba0f866bc7a39b2c90bdde12a79feefea2d5ee
* Add new APIs in NetworkCapabilities to set and get underlying networkslucaslin2021-10-151-4/+61
| | | | | | | | | | | | Previously, the caller can only know about the transport type of the underlying network. The information might not be enough if the device support WiFi STA+STA. Thus, provide an API for the caller to get the correct underlying network. Bug: 191918368 Test: atest FrameworksNetTests:NetworkCapabilitiesTest Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f
* Separate test into reasonable multiple testsChiachang Wang2021-08-171-29/+87
| | | | | | | | | | The test actually verifies multiple behaviors and mutates the networkCapabilities. Thus, refactor the method to keep the tests easier to follow up. Bug: 191918212 Test: atest android.net.NetworkCapabilitiesTest Change-Id: Ibad1a0569d26d92f94153bee323cef5a1c30d8d4
* Fix NetworkCapabilities MTS on S, CTS on S+moduleRemi NGUYEN VAN2021-08-161-1/+2
| | | | | | | | | | | | | | | restrictCapabilitiesForTestNetwork was renamed after S release to be included in a mainline release, but this causes the MTS test to fail on S if the Connectivity module is not updated, and CTS to fail if the connectivity module is updated. Mark the test as @ConnectivityModuleTest so it can be skipped on non-connectivity module MTS tests (such as NetworkStack tests), and add back the previous method name to keep CTS passing. Bug: 196755836 Test: atest NetworkCapabilitiesTest Change-Id: Ibd6c2e62e5949ec6d93e9f6e4fc05129c29b94f8
* The net cap value should be bit shifted before &ingChiachang Wang2021-08-111-0/+44
| | | | | | | | | | | The check intends to do the bit & operation. The net cap value should be shifted against the original capabilities. Also fix the typo in the method name. Bug: 191918212 Test: atest FrameworksNetTests Change-Id: I98396b2538f36fe8b29d27a544a2dfb3060bc9c5
* Use TRANSPORT_USB from the SDKRemi NGUYEN VAN2021-07-141-1/+1
| | | | | | | | | Stop using the stopgap TRANSPORT_USB from NetworkCapabilitiesUtil, which is being removed. Bug: 184158327 Test: atest NetworkCapabilitiesTest Change-Id: I6bbb35d39ff67d6f53b389689dc9f1067e64f962
* Ignore checking TRANSPORT_USB when Android version is older than Slucaslin2021-07-141-4/+10
| | | | | | | | | | | | | | | | There is a new transport type - TRANSPORT_USB(8) in Android S, so when the test tries to add this new transport type in older Android version, it cannot pass the transport type validation and make test fail. (clean cherry-pick of change in downstream branch history) Original change ID before project move: I38816173b04ea198d99f64f45e9271ac2641e4ac Bug: 184158327 Test: run CtsNetTestCasesLatestSdk on Android R & Q Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f Change-Id: Ib0368241771d287c09c0e4463f91122533f85a27
* Add test for NetworkCapabilities.Builder.withoutDefaultCapabilitiesChiachang Wang2021-05-211-0/+12
| | | | | | Bug: 186061922 Test: atest CtsNetTestCases:android.net.NetworkCapabilitiesTest Change-Id: I369e71dd6ae85da78e114ea8377967ab0bde787b
* Do not automatically redact TransportInfo objects.Lorenzo Colitti2021-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, NetworkCapabilities always redacts the TransportInfo objects it contains whenever a defensive copy is made. This makes it impossible to make a defensive copy on a TransportInfo parcelled from another process without redacting it. Stop redacting by default; instead rely on ConnectivityService explicitly calling NetworkCapabilities' redacting constructor when it returns a NetworkCapabilities object to an app via a callback or synchronous call. This is currently done by - createWithLocationInfoSanitizedIfNecessaryWhenParceled, which is called from callCallbackForRequest, getNetworkCapabilities, and getDefaultNetworkCapabilitiesForUser. - getNetworkCapabilitiesWithoutUids, which is used when sending ConnectivityDiagnosticsManager callbacks. In this method, unconditionally redact all information, which is what the code did previously due to the default redaction setting for empty NetworkCapabilities objects being REDACT_ALL. Bug: 183938194 Test: atest NetworkCapabilitiesTest Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
* Move net unit tests to packages/ConnectivityRemi NGUYEN VAN2021-05-131-0/+1152
Move the tests together with packages/Connectivity code, so both can be moved to packages/modules/Connectivity together. Also reorganize unit tests in a unit/ directory, as other tests (integration/, common/ etc.) have been added in tests/net since they were created. This makes the directory structure consistent. Test: atest FrameworksNetTests Bug: 187814163 Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc