Commit graph android_packages_modules_Co.../tests/cts/hostside
Message SHA1
Remove the redundant sleep after turning on the screen.
We are checking for network access in onResume(), which
wouldn't be called until the screen is on. So, there
shouldn't be a need for the extra sleep after turning
on the screen.

Also, remove redundant waits after the last try when
doing verifications as the test is anyway to going to
fail at this point.

Bug: 231440256
Test: atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
Change-Id: I28429c929142a95c19b1f8a5b7d28b9c8c4a45b9
Merged-In: I28429c929142a95c19b1f8a5b7d28b9c8c4a45b9

Sudheer Shanka   commited 2022-05-23 20:10:06 +00:00
c2edb9cbc4
Keep the screen on while the test activity is on top.
Bug: 231440256
Test: atest com.android.cts.net.HostsideConnOnActivityStartTest
Change-Id: Ibb0cc4c8a7cc2338ca938c775706f6b779fa96d3
Merged-In: Ibb0cc4c8a7cc2338ca938c775706f6b779fa96d3

Sudheer Shanka   commited 2022-05-23 20:07:54 +00:00
d1affb65da
Merge "Avoid unregistering the same receiver more than once."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-07 00:07:22 +00:00
e5a9ad96c5
Avoid unregistering the same receiver more than once.
Bug: 231496005
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Iba17daa70f14bdee1d1a7d32cb9dc64623ba1d24
Merged-In: Iba17daa70f14bdee1d1a7d32cb9dc64623ba1d24

Sudheer Shanka   commited 2022-05-06 22:53:39 +00:00
d1e236eb05
[LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  tests/cts/hostside/app3/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I0f594c539640b9815040bf5082677592574b022d

Bob Badour   commited 2022-05-05 07:11:29 -07:00
2a50c246cd
Add tests for LinkProperties#EXCLUDED_ROUTES
Add CTS tests for LinkProperties#EXCLUDED_ROUTES gated change.
These tests check LinkProperties#getRoutes and
LinkProperties#getAllRoutes behavior depending on whether the gated
change is enabled.

Bug: 186082280
Test: atest HostsideLinkPropertiesGatingTests
Change-Id: Id353714331a19d09022d20f186c8f71343686da7

Taras Antoshchuk   commited 2022-05-03 23:45:33 +02:00
f0c8daa0eb
Merge "Add test dependencies for CtsHostsideNetworkTests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-29 03:07:47 +00:00
5672613027
Merge "Add tests to verify app has network access in onResume."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-04-27 17:47:16 +00:00
310ca20b33
Add tests to verify app has network access in onResume.
We already have tests that verify this but these new tests
launch the activity repeatedly a few times and verify the
network access as there are multiple race conditions
involving AMS, NPMS and the app that could result in an
inconsistent network rules state.

Bug: 226299593
Test: atest atest tests/cts/hostside/src/com/android/cts/net/HostsideConnOnActivityStartTest
Change-Id: I6372820fd2b21ebd759a3c44c7280c6699726bde

Sudheer Shanka   commited 2022-04-22 11:37:59 -07:00
dcde1b0092
Merge "Update TEST_MAPPING file."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-04-21 17:27:38 +00:00
8300421bc5
Merge "Verify the return value of scheduleJob()."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-20 03:07:37 +00:00
a4ea04d869
Merge "Reduce BROADCAST_TIMEOUT_MS."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-04-20 00:34:57 +00:00
74d7554c55
Reduce BROADCAST_TIMEOUT_MS.
We wait for a few seconds before verifying the
test app didn't receive a broadcast because it
is possible the broadcast was just delayed but
we don't necessarily have to wait for too long.

Bug: 201580811
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ie5550742c506753fc994209d4db760c1ee73a2cb

Sudheer Shanka   commited 2022-04-19 14:32:19 -07:00
8526459c86
Verify the return value of scheduleJob().
Bug: 228117528
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ia860a5d68f2661476cf983fe8e4a428c208e5559

Sudheer Shanka   commited 2022-04-19 14:04:21 -07:00
a60493ed81
Throw an error if a shell command results in an error.
Some services will write to the error stream if there is
an issue with handling the shell command but these error
messages are ignored currently as we are only looking at
output stream. So, update it to also consider messages
in the error stream and if the content in error stream
is not empty, then throw an exception.

Bug: 228117528
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I935a74b4a689825de414226a2108f6a836b212ab

Sudheer Shanka   commited 2022-04-14 00:50:11 +00:00
c9769ad10b
Add test dependencies for CtsHostsideNetworkTests
This test need other apks for running the test, but those dependencies
actually defined in suite level of cts but never defined in module level
actually which may lead to test failure due to lack of apks. This CL use
target_required attribute to define the missing test dependencies.

Bug: 227777774
Test: m clean ; atest -c HostsideRestrictBackgroundNetworkTests
Change-Id: I34476d3e261c1d2392405ceeb1459d2f135bbcaf

yangbill   commited 2022-04-13 10:29:46 +08:00
c1b8af215a
Merge "data saver test exception for wear"
Andriy Naborskyy   authored and   Gerrit Code Review   commited 2022-04-05 23:46:28 +00:00
f900a64af4
Update TEST_MAPPING file.
Previously, we were running only HostsideRestrictBackgroundNetworkTests
in presubmit. Updating it to run all the tests in this module.

Test: treehugger
Change-Id: I560fed71ab52457fe079d5340b5d294e16c68f93

Sudheer Shanka   commited 2022-04-05 18:56:41 +00:00
f328d44ef7
Increase the temp-allowlist duration in tests
It is possible there is a delay in app getting to
the background state and then initiating network
activity. We need the app to stay in the
temp allowlist until then.

Fixes: 227418169
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I6a98cc17a40cfb54bf3e12f51b5584159e69be0c

Sudheer Shanka   commited 2022-04-02 21:05:51 +00:00
5b63b6c107
data saver test exception for wear
WearOs should not be treated  as supporting Data Saver mode. Users
can not enable or disable the mode.

Data Saver is used on WearOs for battery improvements with LTE enabled
devices but should not block WiFi or Bluetooth PROXY networks.

Bug: 222086830
Test: run cts CtsHostsideNetworkTests
Change-Id: I8e76f7f9574c1ef2c1bd04ff0be652a74cd241f9
(cherry picked from commit cf709bbae312ad7cd0ffdf64af0a8ce23d8b1610)

Andriy Naborskyy   commited 2022-03-28 19:15:00 +00:00
1b35da1ccb
Merge "cts: Re-launch the desired activity after screen-on on TVs."
Ross Yeh   authored and   Gerrit Code Review   commited 2022-03-10 01:13:37 +00:00
422c7dd460
Dump connectivity trafficcontroller data to diagnose test failures.
Bug: 218308105
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ifafe7c96122cf4197dd2f12569b6bd9788cfa66c

Sudheer Shanka   commited 2022-03-03 22:06:52 +00:00
b52c67d5d7
Merge "Add some debugs to diagnose test failure."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-03-01 01:05:01 +00:00
87db609348
Merge "Fix HostsideVpnTests flakyness"
Taras Antoshchuk   authored and   Gerrit Code Review   commited 2022-02-25 12:02:13 +00:00
116bd6e1a2
Add some debugs to diagnose test failure.
Bug: 218308105
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I096258d8c55cf56478015a655b5f3be19f29ace1
Merged-In: I096258d8c55cf56478015a655b5f3be19f29ace1

Sudheer Shanka   commited 2022-02-23 20:37:30 +00:00
5f09f8da8c
cts: Re-launch the desired activity after screen-on on TVs.
Some TV's do not resume the previous activity coming back from sleep.
Add a case to restart activity.

Derived from
https://android-review.googlesource.com/c/platform/cts/+/1358002
(Bug: 148812676)

Test: Verified existing passing tests continue to pass on TCL Beyond TV
(Pie)

Change-Id: I86fe80c5326065ac349585d1ab95736132ddfb5a

Benjamin Cooley   commited 2022-02-18 16:44:37 +00:00
ccb8daa808
Fix HostsideVpnTests flakyness
VpnTest#checkTrafficOnVpn tests whether IP address is on VPN by
sending udp packet, ping and tcp packet to the address.
In aosp/1941233 the order of checks was changed from udp, ping, tcp
to udp, tcp, ping, which caused flaky behavior of the method.

This CL restores the order of checks as it was prior to aosp/1941233.

Bug: 214558556
Bug: 215903863
Bug: 214398658
Test: atest HostsideVpnTests --iterations 50
Change-Id: I5dc3c217b78746d5e8c13b80e5295eb6ffe5b778

Taras Antoshchuk   commited 2022-02-15 09:14:33 +00:00
7bd33a19c3
Fix HostsideVpnTest#testExcludedRoutes
One of VpnTest#startVpn overloads didn't propagate "excludedRoutes"
param, due to mistake during conflict resolution in aosp/1941233.

Bug: 214398350
Test: atest HostsideVpnTests --iterations
Change-Id: Icbbe7394f1ff1f676cc671a1fa1c4449f4d585e3

Taras Antoshchuk   commited 2022-02-15 09:14:03 +00:00
0817bb2906
Marking test receiver as exported.
In order to follow the new dynamic receiver paradigm introduced in T, receivers will have to be specifically marked as exported or not exported when registering dynamically. Since this is in a test only, and the test says that it needs the broadcast to be in a different process, mark as exported.

Bug: 161145287
Change-Id: I112d56962e3a6c3043240f8dfab058dc5a728ba9
Test: atest HostsideRestrictBackgroundNetworkTests#testAppIdle_toast

Jacob Hobbie   authored and   Michael Groover   commited 2022-02-07 15:40:49 -08:00
4c06b3885d
Update the SDK for the tests with intended target in T+
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

Chiachang Wang   commited 2022-01-20 10:30:19 +08:00
7212fbee14
Use assumeTrue in VpnTest
Test: atest HostsideVpnTests
Change-Id: I399bb4d113e37869be50bfe73cb3d9b4fa2253ef

Taras Antoshchuk   commited 2022-01-12 22:41:35 +00:00
c8b0428da5
Revert "Revert^2 "Revert "Add CTS tests for exclude VPN routes A..."
Revert "Revert "Revert "Revert "Add APIs that allow to exclude r..."

Revert "Revert "Revert "Revert "Add VpnServiceBuilderShim for Vp..."

Revert submission 1941195-revert-1931760-reland-vpn-impl-part-2-WGARECSJEM

Reason for revert: fixed merge conflict with aosp/1938197
Reverted Changes:
Ic25e5e4ea:Revert^2 "Revert "Add CTS tests for exclude VPN ro...
Ic72cafcf5:Revert "Revert "Revert "Add APIs that allow to exc...
I53802190a:Revert "Revert "Revert "Add VpnServiceBuilderShim ...

Change-Id: I5a6ceaae21c563de8bb71338c29973f58178b456

Taras Antoshchuk   commited 2022-01-10 10:20:46 +00:00
d9ba74953b
Revert^2 "Revert "Add CTS tests for exclude VPN routes APIs""
1a6d19e4b8

Change-Id: Ic25e5e4eaf57e033a9304244387e6fba15213d2b

Matt Buckley   commited 2022-01-07 17:44:52 +00:00
01d9abecef
Revert "Revert "Add CTS tests for exclude VPN routes APIs""
This reverts commit f4882153ed.

Reason for revert: failing build target configuration is fixed

Change-Id: Ic8ed8fce72a1c816ee6766f296efaddeafcd2f70

Taras Antoshchuk   commited 2022-01-05 14:00:25 +01:00
1a6d19e4b8
Caps callback should be called when underlying networks are changed
Add a test to check if onCapabilitiesChanged will be called when
the underlying networks are changed.

Bug: 191918368
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: I8dfb16e01199d41b1b65f69e129ec40e37f9ab0f

lucaslin   commited 2022-01-04 15:27:11 +08:00
36faae95ba
Merge changes from topic "revert-1551943-vpn-impl-FKOLCXTDDT"
* changes:
  Revert "Unhide RouteInfo#getType and related fields"
  Revert "Unhide IpPrefix(InetAddress, int)"
  Revert "Add CTS tests for exclude VPN routes APIs"

Ayush Sharma   authored and   Gerrit Code Review   commited 2021-12-16 15:01:30 +00:00
e89170bcb1
Revert "Add CTS tests for exclude VPN routes APIs"
Revert "Add APIs that allow to exclude routes from VPN"

Revert "Suppress NewApi warnings for @SystemApi -> public APIs"

Revert "Add VpnServiceBuilderShim for VpnService.Builder"

Revert submission 1551943-vpn-impl

Reason for revert: <DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=mainline_modules_x86_64-userdebug&lkgb=8007224&lkbb=8008168&fkbb=8007902 >, bug b/210979001
Reverted Changes:
I0e7aa077a:Add VpnServiceBuilderShim for VpnService.Builder
Ib12f5ab39:Suppress NewApi warnings for @SystemApi -> public ...
I59b9185cf:Unhide RouteInfo#getType and related fields
Ie5b62b2b2:Unhide IpPrefix(InetAddress, int)
I993a32d40:Add CTS tests for exclude VPN routes APIs
Ib24b2d3fb:Suppress NewApi warnings for @SystemApi -> public ...
Ic3b10464a:Add APIs that allow to exclude routes from VPN

Change-Id: Ic4f86f405c395f1356de1a6f8cf9e92692d953ce
BUG: 210979001

Ayush Sharma   commited 2021-12-16 14:40:13 +00:00
f4882153ed
Merge changes from topic "vpn-impl"
* changes:
  Add CTS tests for exclude VPN routes APIs
  Unhide IpPrefix(InetAddress, int)
  Unhide RouteInfo#getType and related fields

Taras Antoshchuk   authored and   Gerrit Code Review   commited 2021-12-16 11:13:33 +00:00
8be6ba36dc
Add CTS tests for exclude VPN routes APIs
Add HostsideVpnTests test cases for different combinations of
included/excluded routes in VPN configuration.

Bug: 186082280
Test: atest HostsideVpnTests
Change-Id: I993a32d4066a851eb0c455aff2f599569e958ba7

Taras Antoshchuk   commited 2021-12-13 18:47:58 +01:00
673eb6ecd2
Merge "Stop skipping VPN tests when running ADB over TCP." am: b031a2265e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669610

Change-Id: I7a829bc84282c940abae5e0930a9c2cbe4cc7099

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-11-26 03:47:07 +00:00
8edbc35d56
Merge "Stop skipping VPN tests when running ADB over TCP."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-11-26 03:30:45 +00:00
b031a2265e
Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I745ef4d42ecaf06bb81d9dbe0b7162267fea65a8
Change-Id: I7b2a1fc519124cfc10806dde5fd543504a51e072

Xin Li   commited 2021-11-10 08:06:18 +00:00
e41bbea995
Test if underlying networks are the same as what VpnService sets
If VpnService set null as the underlying networks, then the
underlying networks will be set as system defeult network.
If VpnService set an empty array as the underlying networks, then
the underlying networks of VPN will not be set to any networks.
If VpnService set a network which is not null or an empty array,
then the underlying networks of VPN should be the same as this
one.

Bug: 191918368
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: Ib2d54e53960e5f899cb8d4cfaa6705ca676354ca

lucaslin   commited 2021-10-26 10:55:41 +08:00
cacd5b0d2a
Convert VpnTest to JUnit4
This is to fix the error in errorprone target, the error message
is: [JUnit4ClassUsedInJUnit3] Assume cannot be used inside a
JUnit3 class. Convert your class to JUnit4 style.
The error method is: assumeTrue()

Bug: 191918368
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: Ieb606d2ba31cc19510425114c76fd77417227f2c

lucaslin   commited 2021-10-26 10:55:25 +08:00
d2de904def
Add CtsHostsideNetworkTests deps to sts.
This fixes the missing apk errors when running this module as
part of sts.

Ignore-AOSP-First: Platform changes related to this are not in AOSP yet.
Test: run sts-engbuild-no-spl-lock -m CtsHostsideNetworkTests
Bug: 195961795
Change-Id: I9a9a2d20ce637663790df42e22b0c8023cf7bc3e

Kenneth Magic   commited 2021-08-18 19:38:56 +00:00
da973a6d9d
Stop skipping VPN tests when running ADB over TCP.
We currently skip these tests because when a VPN comes up, all
TCP sockets for UIDs subject to the VPN are closed. This used to
break ADB over TCP, but that was fixed in r.android.com/1554977
by ensuring that netd never kills adb sockets.

Bug: 119382723
Bug: 161861298
Test: test-only change
Change-Id: I54b833a4d1fb51476a22cd7c793ec59b101023f1

Lorenzo Colitti   commited 2021-08-17 15:48:04 +00:00
0c70ae5054
Merge "Verify apps cannot receive ACTION_SNOOZE_WARNING broadcast." into sc-dev
Sudheer Shanka   authored and   Android (Google) Code Review   commited 2021-07-27 05:13:23 +00:00
69fbdff0ed
Verify apps cannot receive ACTION_SNOOZE_WARNING broadcast.
Bug: 177931370
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Platform changes related to this are not in AOSP yet.
Change-Id: I6d525c4d88ba01838d51a873251593281b628898

Sudheer Shanka   commited 2021-07-26 15:51:09 +00:00
7bbbdbd4f9
Change the url in testDownloadWithDownloadManagerDisallowed
In China, "https://www.google.com" will redirect to url
"http://www.google.cn" but cleartext traffic is default disabled
for an app. So the testDownloadWithDownloadManagerDisallowed
would failed by cleartext traffic is not permitted. Thus, change
the url in the test which is reachable in China.

Bug: 192978910
Test: atest HostsideVpnTests#testDownloadWithDownloadManagerDisallowed
Original-Change: https://android-review.googlesource.com/1771008
Merged-In: I992c3240f0e133f5b00468cbe85d1545bcf786b0
Change-Id: I992c3240f0e133f5b00468cbe85d1545bcf786b0

Paul Hu   commited 2021-07-21 10:17:38 +00:00
92c911da01
Change the url in testDownloadWithDownloadManagerDisallowed
In China, "https://www.google.com" will redirect to url
"http://www.google.cn" but cleartext traffic is default disabled
for an app. So the testDownloadWithDownloadManagerDisallowed
would failed by cleartext traffic is not permitted. Thus, change
the url in the test which is reachable in China.

Bug: 192978910
Test: atest HostsideVpnTests#testDownloadWithDownloadManagerDisallowed
Change-Id: I992c3240f0e133f5b00468cbe85d1545bcf786b0

paulhu   commited 2021-07-20 17:44:26 +08:00
971c5fc0f8