Commit Graph

4021 Commits

Author SHA1 Message Date
Yan Yan
4a7fcbcb54 Merge "Test IKE Session setup in IPv6 network" 2020-05-28 17:03:51 +00:00
Yan Yan
77a425820a Merge "Test handling authentication failure" 2020-05-28 04:22:35 +00:00
Treehugger Robot
555ca8801b Merge "Fix testTetheringUpstream flaky" 2020-05-28 01:36:55 +00:00
Yan Yan
06c7ebc8e4 Merge "Test remotely initiated rekey" 2020-05-28 01:10:38 +00:00
Yan Yan
aecb7c05e2 Merge "Test IKE Session setup with EAP-MSCHAPv2" 2020-05-28 01:09:11 +00:00
Yan Yan
6b5975c9fb Merge "Test IKE Session setup with digital-signature-based Auth" 2020-05-27 23:38:25 +00:00
markchien
47e3788e3e Fix testTetheringUpstream flaky
testTetheringUpstream test case need cellular network. So it disable
wifi and getActiveNetwork to check whether current network is cellular.
But there is a race that call getActiveNetwork right away after
disconnect wifi. getActiveNetwork may return null because switching
network is not ready yet.

Bug: 156314879
Test: atest CtsTetheringTest

Change-Id: I6b433560fb27a3b4bd80c4198ccdb58a5be701b6
2020-05-27 23:03:07 +08:00
Treehugger Robot
89b5be1e4d Merge "Add logs to NetworkCallbackTest to diagnose issues" 2020-05-27 10:19:57 +00:00
Chalard Jean
796ccadc00 Add logs to NetworkCallbackTest to diagnose issues
Bug: 157391946
Test: NetworkCallbackTests
Change-Id: I552a1ad05f97a2a9f83f5f7de77d2e7b64084ddc
2020-05-27 15:51:53 +09:00
evitayan
8719bd68eb Test IKE Session setup in IPv6 network
Bug: 148689509
Test: atest testIkeSessionSetupAndChildSessionSetupWithTunnelModeV6
Change-Id: Ia2fa9462c66a283697e0cb9dd4c475215c0eafde
2020-05-26 17:22:21 -07:00
evitayan
ac96b659d3 Test handling authentication failure
- Test receiving Authentication Failure notification
- Test setting up IKE Session with first Child setup failure

Bug: 155821007
Test: CtsIkeTestCases
Change-Id: I4ec43a3899d67a119cd4ba19e0ffc63c277325fb
2020-05-26 15:52:14 -07:00
Yan Yan
609752fca4 Merge "Move common logic in testing and verification to IkeSessionTestBase" 2020-05-26 22:51:40 +00:00
evitayan
c0b2dbdaf6 Test remotely initiated rekey
This commit:
- Adds test for remotely initiated rekey for IKE and Child SA
- Makes IkeTunUtils support building and injecting requests
- Adds method to parse hex to long because Long.parseLong cannot
  handle negative long value

Bug: 155821007
Test: atest CtsIkeTestCases
Change-Id: I299cf190261ac15397f9ed389adb2c69e94a6507
2020-05-26 15:49:56 -07:00
evitayan
ce7032f0be Test IKE Session setup with EAP-MSCHAPv2
Bug: 155821007
Test: atest CtsIkeTestCases
Change-Id: Ie8a328c53b531027ce63edaa874c4cd0904e0068
2020-05-26 15:49:43 -07:00
evitayan
ab4bc2dd35 Test IKE Session setup with digital-signature-based Auth
This commit adds a test for setting up IKE Session with
digital-signature-based authentication.

This test also verifies sending and receiving IKE fragments

Bug: 155821007
Test: atest CtsIkeTestCases:IkeSessionDigitalSignatureTest
Change-Id: I5829dfa955c47c0810760b7bf97372031e740f1e
2020-05-26 15:49:36 -07:00
Yan Yan
3e8456302a Merge "Verify creation and deletion of IpSecTransform pair" 2020-05-26 22:34:00 +00:00
evitayan
13f043a8db Move common logic in testing and verification to IkeSessionTestBase
This commit moves following logics to IkeSessionTestBase so that all
subclasses can share it:
- build ChildParams
- perform IKE and first Child setup
- perform deleting IKE
- verifying IKE and first Child setup

Bug: 155821007
Test: atest CtsIkeTestCases:IkeSessionDigitalSignatureTest
Change-Id: Ib35b18240396a7b4823111e37be9a338d8ff6f06
2020-05-26 10:30:28 -07:00
evitayan
908f1d3365 Verify creation and deletion of IpSecTransform pair
- Verify that inbound and outbound IpSecTransforms
  are created when a Child Session is created
- Verify that when Child Session is deleted,
  the IpSecTransform pair is deleted

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: If142b3fb2ac791322921beeab1bc8d43db255317
2020-05-26 10:21:00 -07:00
Remi NGUYEN VAN
352a01edfd Merge "Skip testTemporarilyNotMeteredCapability on Q" 2020-05-26 00:00:45 +00:00
Remi NGUYEN VAN
efcc79f2a5 Merge "Use Q permission on Q for startCaptivePortalApp" 2020-05-26 00:00:17 +00:00
Remi NGUYEN VAN
591263914c Merge "Fix and deflake ConnectivityManagerTest" 2020-05-25 23:59:11 +00:00
Remi NGUYEN VAN
6dfe6412a2 Skip testTemporarilyNotMeteredCapability on Q
The capability did not exist on Q.

Bug: 155993662
Test: atest NetworkRequestTest
Change-Id: I94e874e37cadadd90397278bf519db68db48a50f
2020-05-25 19:21:21 +09:00
Remi NGUYEN VAN
aa660b56cf Use Q permission on Q for startCaptivePortalApp
on Q startCaptivePortalApp was guarded by CONNECTIVITY_INTERNAL instead
of NETWORK_SETTINGS: change the permission adopted by shell on Q to
match the platform.

Test: atest CaptivePortalTest on a Q device
Bug: 150904735

Change-Id: I24b6907d164aba07df0f5a1a3715669e99cddd88
2020-05-25 19:15:53 +09:00
Remi NGUYEN VAN
2f5879f6c7 Fix and deflake ConnectivityManagerTest
- Migrate the test to JUnit4, as JUnit3 cannot use assumeTrue
 - Skip IPv4 keepalive tests on networks that do not have native IPv4.
 - Refactor usage of adoptShellPermissionIdentity to use try / finally
   or runAsShellPermissionIdentity: test failures could lead to
   permission failures in other tests due to mismatched adopt/drop.
 - Fix ensureWifiConnected to support the "wifi enabled but not fully
   connected" case.

Bug: 150949391
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest \
      --rerun-until-failure 50
Change-Id: I7459753b1068e1760a95337760db58d1df213fad
2020-05-25 19:15:39 +09:00
Remi NGUYEN VAN
c7cd60d9d4 Merge "Add a cts test for PermissionMonitor security problem" 2020-05-25 09:21:39 +00:00
Luke Huang
76fdd5976f Merge "Deflaky test for DnsResolverTest" 2020-05-22 15:28:05 +00:00
Yan Yan
27349420bd Merge "Cleanup of IkeSessionPskTest" 2020-05-22 01:49:08 +00:00
evitayan
34e71a5b68 Cleanup of IkeSessionPskTest
- Add java doc in IkeSessionTestBase about the necessity to use
  different addresses and Networks in each test
- Use ArrayTrackRecord in Test Session Callback to retrieve the
  latest result.
- Verify that IpSecTransform pair is created and deleted

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ib747c8cdfe1827e8df2aa7544e28e98a177d3d1c
2020-05-21 16:23:02 -07:00
Yan Yan
32d03b84b6 Merge "Exit test if device does not support IPsec tunnel" 2020-05-21 23:10:54 +00:00
Luke Huang
d6e36d820e Deflaky test for DnsResolverTest
It's possible that private DNS setting is not in the state we expected
when we tried to enable strict mode during tests. The problem here is
that there are 2 setting Uris(mode and specifier) relating to strict
mode, each of them might trigger private DNS setting changing evnet in
ConnectivityService.
Previously, we tried to enable strict mode with first set private DNS
mode and then private DNS specifier. This may result in 2 consecutive
private DNS changes events with very short intervals, which caused
conflicts between DnsResolver / NetworkMonitor and lead to flaky tests.

So
0. Use opportunistic as default mode if no default mode existed.
1. Change the order (mode and specifier) for enabling strict mode.
2. Change private DNS mode only when needed.
     (If original mode is "hostname", then we only need to set
     specifier)

Bug: 153624005
Bug: 151122313
Bug: 150952393
Test: atest DnsResolverTest --rerun-until-failure 100
Test: forrest (git_master, cts/networking/gce-all)
Test: forrest (git_rvc-dev, atest CtsNetTestCases)
Test: forrest (git_rvc-dev, mts/dnsresolver/device-all)
Change-Id: I224a6493c87cebaf0bf954c2644e2945ccd50db1
2020-05-21 16:04:49 +08:00
Sarah Chin
bab248804b Merge "Add cts for TEMPORARILY_NOT_METERED" 2020-05-21 01:37:51 +00:00
Sarah Chin
ae36797b69 Add cts for TEMPORARILY_NOT_METERED
Bug: 155993662
Test: atest NetworkRequestTest
Change-Id: I6838dff70e6608f166119b99750db3bc59c59e42
Merged-In: I6838dff70e6608f166119b99750db3bc59c59e42
2020-05-20 17:27:55 -07:00
evitayan
677a1c1554 Exit test if device does not support IPsec tunnel
Bug: 155926216
Test: CtsIkeTestCases
Change-Id: I4e426b8f3509e56e7e2e7532e216533ad8bfbc2f
2020-05-20 15:18:32 -07:00
Remi NGUYEN VAN
114a0914bd Merge "Fix CtsNetTestCasesLatestSdk fail on Q platform" 2020-05-19 04:27:39 +00:00
Luke Huang
dfa5480414 Revert "Fix flaky test for DnsResolverTest"
This reverts commit fb735de0e8.

Reason for revert: This CL made whole test failed.

Bug: 153624005
Bug: 150952393
Bug: 151122313
Change-Id: I083529616dbf80421ea6a322bb57d2bb0f2bca62
2020-05-19 01:18:49 +00:00
Ken Chen
5dd02e3103 Fix CtsNetTestCasesLatestSdk fail on Q platform
The CtsNetTestCasesLatestSdk needs to build against platform (for hidden
API access), The JNI library libnativedns_jni used by
CtsNetTestCasesLatestSdk needs to build against stable SDK (for running
on Q). To fulfill the combination, property jni_uses_sdk_apis must be
set.

Bug: 151122313
Bug: 150904735
Bug: 150918852
Test: atest CtsNetTestCasesLatestSdk on R and Q platforms
Change-Id: I5db3cb28829847e74412d270db7d17b81c5e26a2
2020-05-18 19:55:29 +08:00
Luke Huang
fb735de0e8 Fix flaky test for DnsResolverTest
It's possible that private DNS setting is not in the state we expected
when we tried to enable strict mode during tests. The problem here is
that there are 2 setting Uris(mode and specifier) relating to strict
mode, each of them might trigger private DNS setting changing evnet in
ConnectivityService.
Previously, we tried to enable strict mode with first set private DNS
mode and then private DNS specifier. This may result in 2 consecutive
private DNS changes events with very short intervals, which caused
conflicts between DnsResolver / NetworkMonitor and lead to flaky tests.

So
1. Change the order (mode and specifier) for enabling strict mode.
2. Change private DNS mode only when needed.
     (If original mode is "hostname", then we only need to set
     specifier)

Bug: 153624005
Bug: 153624702
Test: atest DnsResolverTest --rerun-until-failure 100
Change-Id: Iaed6285677f74a5ee6cc6684534ddc0758b25974
2020-05-15 23:39:19 +08:00
Paul Hu
ebe9cb15a4 Merge "Address aosp/1272946 leftover comment" 2020-05-15 01:11:14 +00:00
Chiachang Wang
d40f746ea0 Merge "Move testInvariantInCanBeSatisfiedBy to be its own test" 2020-05-12 05:36:50 +00:00
Chiachang Wang
8ddd0227a9 Move testInvariantInCanBeSatisfiedBy to be its own test
Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
Change-Id: Id65b7189202108b232905535587f8a282e48007b
2020-05-12 09:39:16 +08:00
Chiachang Wang
c23b2ac096 Merge "Use local defined NetworkSpecifier to verify test" 2020-05-11 14:19:34 +00:00
Chiachang Wang
a495965c67 Use local defined NetworkSpecifier to verify test
Test will be affected by logic modification from different
NetworkSpecifiers. Since this test tries to test the behavior
of NetworkRequest but not NetworkSpecifier, use local defined
NetworkSpecifier to test to prevent repeating noisy breaks.
Also update test for testing invariant.

Bug: 154451660
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
Change-Id: I7e357c75a68244432231d59646ddf67c8d969c6d
2020-05-11 20:24:47 +08:00
paulhu
e5e8ae9e1b Address aosp/1272946 leftover comment
Verify that entitlement check bypass with TETHER_ERROR_NO_ERROR
response.

Bug: 152829363
Test: atests CtsTetheringTest
Change-Id: I6272d7b297bdf0e641612a09ffe12942cc2b42e1
2020-05-11 15:27:35 +08:00
Lucas Lin
ea89469f83 Merge "Refine NetworkCallbackTest" 2020-05-08 09:33:45 +00:00
lucaslin
5d57ec4a8f Refine NetworkCallbackTest
In R, to avoid data overages due to apps not detecting a
meteredness change, when a wifi network changes from unmetered
to metered the network will go down and will be replaced with a
new network. It will make NetworkCallbackTest fail because the
original design is getting the active network in setUp(). So once
the wifi reconnects, the network which is got in setUp() will be
meaningless and make the test fail due to network mismatches.
The new changes are:
1. Moving some initial pre-configurations into setUp().
2. Override the onCapabilitiesChanged() to check if network has
   changed to metered or not.
3. Add unregisterNetworkCallback() into iMyService.aidl so that
   NetworkCallbackTest can call it to unregister the network
   callback.
4. Enlarge the timeout of connecting network and receiving
   callback to prevent network cannot reconnect in time or
   callback cannot be received in a short time.

Bug: 153485744
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I1aa0e107cf6797b06dee4a15896c63321d822156
Merged-In: I1aa0e107cf6797b06dee4a15896c63321d822156
2020-05-08 08:01:34 +00:00
markchien
f941ae9c03 Tag CtsTetheringTest for sim card required
Bug: 155598732
Test: atest CtsTetheringTest
Change-Id: I79f841682049707d7cc26bf1ecc3e5affc86d196
2020-05-06 14:55:29 +08:00
Yan Yan
2e10c55003 Merge "Initial CL for testing IkeSession creation" 2020-05-01 05:58:18 +00:00
evitayan
653d7ebb44 Initial CL for testing IkeSession creation
This commit:
-Extend TunUtils for processing IKE packets
-Add IkeSessionBaseTest containing common functionality for all IkeSession tests
-Add end-to-end test for IKEv2 PSK verifying creating IKE SA, creating child SAs
 and closing sessions
-Add basic tests for error scenarios

Bug: 148689509
Test: atest CtsIkeTestCases
Change-Id: Ie6c18591ffcc883abbf0484d9a59dfda61b33257
2020-04-30 18:56:12 -07:00
Dominic Lemire
cae5079d9d Fix error message in RestrictBackgroundNetworkTest
Fixed the error message when the expected number of broadcasts is exceeded.

Bug: 147139427

Change-Id: I7e69dca81abdb29a9eb7d110266edbe483e17a01
2020-04-30 05:47:29 +00:00
Remi NGUYEN VAN
6c63b1eaac Merge "Force reconnect in connectToWifi" 2020-04-28 07:10:15 +00:00