Commit Graph

252 Commits

Author SHA1 Message Date
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
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
Sudheer Shanka
0ac91b4737 Ensure location is enabled before getting SSID.
When location is disabled, Wi-Fi scan results and SSID are not available
to apps.

Fixes: 153850762
Fixes: 153396893
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I05285811d7131e116d5e1d072137ed2cf9576d05
Merged-In: I05285811d7131e116d5e1d072137ed2cf9576d05
2020-04-22 14:37:45 -07:00
Sudheer Shanka
a6a1ad183e Fix a regression in how required properties are collected.
+ Enable app standby mode before running the tests.

Fixes: 147459100
Fixes: 117169751
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: cts-tradefed run singleCommand cts-on-gsi --skip-device-info \
      --skip-preconditions -m CtsHostsideNetworkTests \
      -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
Merged-In: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
2020-04-22 13:59:46 -07:00
Sudheer Shanka
39cc315273 Fix Error Prone errors
Soong wasn't including android_app or android_test sources in the
javac-check target used for the Error Prone build, which allowed
some Error Prone errors to get in.  Fix them so Error Prone can be
re-enabled for these targets.

Fixes:
cts/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java:61: error: [CollectionIncompatibleType] Argument '~requiredProperty.getValue()' should not be passed to this method; its type int is not compatible with its collection's type argument Property

Bug: 146455923
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I7c5bf823bf371902285ce3ee3929796fa40c653b
Merged-In: I48b1ccb61c807d0b41a165298ef5981258d6656e
2020-04-22 13:52:12 -07:00
Sudheer Shanka
1206400ccf Reland "Pull service dumps to help debug test failures."
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

This reverts commit 89099548f8.

Bug: 137859686
Change-Id: I7bb2a7e4b2dca3696761e7c030f3380b9226b676
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-22 12:27:50 -07:00
Tony Huang
89099548f8 Revert "Pull service dumps to help debug test failures."
This reverts commit e3711ae317.

Reason for revert: Might cause build break on errorprone branch

Change-Id: Iddece3edf4b1e96fafb8b36282f58410a2476025
2020-04-22 04:31:43 +00:00
Sudheer Shanka
e3711ae317 Pull service dumps to help debug test failures.
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

Bug: 137859686
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I93317c201a0ea06732e29154ab7e140735381f59
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-21 14:29:19 +00:00
Dan Shi
d24f495dc4 Remove tests from vts suite
After vts-core is renamed to vts, the CTS tests won't be needed in vts
suite.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL removes all CTS tests in vts suite,
as vts is renamed to vts10. This CL won't change test logic or behavior.

Change-Id: Idc9e9cc1d1080ff689823671a736bbb78bd7a740
Merged-In: Idc9e9cc1d1080ff689823671a736bbb78bd7a740
2020-04-07 17:00:46 -07:00
Dan Shi
210a4a7e55 Add vts10 suite to existing vts tests
This is to prepare renaming vts to vts10.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL adds all tests in vts to a new
suite vts10. vts10 will be the new name of existing vts suite. This CL
won't change test logic or behavior.

Change-Id: Ic250f04f0424d0a586c183d571b0ad57c56a03d0
Merged-In: Icfbc0ef0d40b908dc9ef664bedf3ead563ff9855
Merged-In: Ibb8ca5e3b9d1cc7247f57d0d89bd15b9f52fec92
Merged-In: Ia9af1fbddc66d3c94976a58c36d274425f1fe461
2020-03-26 05:20:00 +00:00
Automerger Merge Worker
b29ba93dcd Merge "Add a CTS test for private DNS on VPNs." into qt-dev am: 17311d9af6 am: fe44dd21ba am: 523cc30322
Change-Id: If38d0c7e8b878e76ff4a52fcdd441b002ce9ddf0
2019-12-13 01:41:48 +00:00
Lorenzo Colitti
3b160e2385 Add a CTS test for private DNS on VPNs.
Bug: 122652057
Test: atest com.android.cts.net.HostsideVpnTests passes with fix, fails without it
Change-Id: Ifa2710aed7e773a24786cc3e4912f126547dfe0b
2019-12-12 19:41:01 +09:00
Jeff Vander Stoep
c9068f1b87 getConnectionOwnerUid: add test for b/141603906
Test: on Marlin and Blueline run
    cts-tradefed run cts -m CtsHostsideNetworkTests \
    -t com.android.cts.net.HostsideVpnTests#testB141603906
Bug: 141603906
Change-Id: I759bc2295b2060e4575d61718c551d201a6455be
2019-10-08 10:41:45 +02:00
Julien Desprez
7b48d84ed5 Merge "[Cherry pick] Mark module as "secondary_user" since it uncovered bug before" am: 9c9dde65ba
am: d30bab3710

Change-Id: I86f7186964eb9dd70cd7b442768095fc806afb7a
2019-06-25 01:00:59 -07:00
Julien Desprez
14fae15d0a [Cherry pick] Mark module as "secondary_user" since it uncovered bug before
This will allow running this module against a secondary
user in continuous infra to uncover bugs.

Test: run cts-unit-tests
Bug: 130892086
Change-Id: I063a0d29163567ec2cf97d2e4469e88e7203e852
Merged-In: Ic8af2e3e77e24db340b2894c2d36e3501962952c
2019-06-24 09:15:51 -07:00
Sudheer Shanka
b357138cb6 Merge "Skip battery saver related tests on unsupported devices." into qt-dev
am: f8eb2722ff

Change-Id: Ibc940cd7806bada010838ea09989fa1a1c05233b
2019-06-14 10:35:32 -07:00
Sudheer Shanka
802549c8de Skip battery saver related tests on unsupported devices.
Bug: 133761301
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ifec84425febf38d732367fae6b43fa80c427c79f
2019-06-07 10:14:08 -07:00
Hui Yu
a6bb88ebc1 Merge "Make sure app_idle_constants is set during setup." into qt-dev
am: dc7e2bb71c

Change-Id: Id524c3206efbc09ecf422b837b92891c8baafde5
2019-05-03 09:34:37 -07:00
Kweku Adams
eb7b9bab13 Merge "Testing Data Saver changed broadcast on unsupported devices." into qt-dev
am: 42f325acb9

Change-Id: If94305b8d2a8b877af585f0c209538b2b2827a7a
2019-05-03 07:52:00 -07:00
Hui Yu
dc7e2bb71c Merge "Make sure app_idle_constants is set during setup." into qt-dev 2019-05-02 22:51:17 +00:00
Sasha Smundak
153173af0b Merge "Convert hostsidetests/net/**/Android.mk file to Android.bp" am: 9bca8f5c35
am: 69de989faf

Change-Id: I9a37e90afe4f6682187f9c5937cc552067ab9f7c
2019-04-30 10:36:46 -07:00
Sasha Smundak
b3af5c95b2 Convert hostsidetests/net/**/Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332514
Test: atest CtsHostsideNetworkTests
(same failures as in baseline)
Change-Id: I5b6a22263331b19570b42f156d7ad5d59f8208b4
2019-04-29 13:18:42 -07:00
Kweku Adams
3a88dd4732 Testing Data Saver changed broadcast on unsupported devices.
Bug: 114131539
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I3e8f9297ca49ee86bd26bb3d7a094c38b6203118
2019-04-29 11:25:14 -07:00
Hui Yu
022058ec74 Make sure app_idle_constants is set during setup.
Set app_idle_constants in NetPolicyTestsPreparer is not always successful(suspect timing issue).
Set app_idle_constants in AbstractRestrictBackgroundNetworkTestCase again to make sure.

Bug: 115393390
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_whenCharging

Change-Id: I41148bc7eea0825537133f0471ceefeb5b05d763
2019-04-26 17:07:34 -07:00
Lorenzo Colitti
5abd1ff346 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
(cherry picked from commit ad17ee9e92)
2019-04-26 12:52:28 -07:00
Varun Anand
5d3ac8f9e1 CTS tests related to VPN meteredness.
(cherry picked from commit d1008aa730)

Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests

Change-Id: I2dea70c1c432d05b1a22c945f1e3e17166e4132d
Merged-In: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-15 07:55:58 -07:00
Varun Anand
7973b17dd7 Merge "CTS tests related to VPN meteredness." am: 1806a7da53
am: dd6406d69d

Change-Id: I87ddf706b507fc0c9f8004b130b555c3905d99b1
2019-04-15 07:11:29 -07:00
Varun Anand
1806a7da53 Merge "CTS tests related to VPN meteredness." 2019-04-15 13:45:57 +00:00
Lorenzo Colitti
72914e4469 Merge "Add instant and ABI XML tags for hostside networking tests." am: 75c73cda26
am: c40bdf2fce

Change-Id: I82ad420b23f4c332d0463e154c135e19081cba98
2019-04-12 05:44:24 -07:00
Varun Anand
d1008aa730 CTS tests related to VPN meteredness.
Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests
Change-Id: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-11 14:32:21 -07:00
Lorenzo Colitti
ad17ee9e92 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
2019-04-11 20:43:59 +09:00
Lorenzo Colitti
f0d0a9e352 Merge "Add test coverage for ICMP echo constants." am: 718025ed2c am: 0f6be092bb
am: b452497881

Change-Id: Ic0189e07e2745b721a307754a7bcc6574878ac32
2019-04-01 09:11:18 -07:00
Lorenzo Colitti
950e10572b Add test coverage for ICMP echo constants.
Bug: 129251251
Test: atest android.net.ipv6.cts.PingTest com.android.cts.net.HostsideVpnTests
Change-Id: Icca18e0870588ca250225ce79cf30dbd8c361e84
2019-03-30 02:11:46 +09:00
Junyu Lai
06db529877 Merge changes Ic19b3b64,I26ca370f am: c5ceda2354 am: f29182d403
am: 6188ebe70d

Change-Id: I7aa0abf2308ede2025bb8bfdf044fd37275f6afb
2019-03-24 19:30:34 -07:00
junyulai
27e1316c33 Add cts test cases for NetworkCallback.onBlockedStatusChanged
Bug: 118862340
Test: atest HostsideNetworkCallbackTests

Change-Id: Ic19b3b648a94adf4449393beb9b30ad7a7dc2283
2019-03-22 19:17:01 +08:00
junyulai
d05db41eb7 Export API of listening for network change events in app2
Currently, due to foreground app will never get blocked by
NetworkPolicyManagerService, so onBlockedStatusChanged cannot be
tested under cts net app.

Thus, listen for network change events in app2 allows subsequent
tests on NetworkCallbacks.

Bug: 118862340
Test: m -j cts
Change-Id: I26ca370fc6ae4dd3f32ce6cf448bae83f3fbfbcc
2019-03-22 10:19:38 +08:00
Brett Chabot
44a06a7fbd Migrate remaining cts to androidx.test.
See go/jetpack-test-android-migration

Exempt-From-Owner-Approval: automated package name refactoring; already
reviewed+merged internally
Test: m cts

Change-Id: I6877435bf0436b8ef1dd252b225eac2908e78b71
Merged-In: I092c369229f8cb4c13827cbad4fd162622ac7849
2019-03-03 18:22:22 -08:00
Yichun Li
c3baf72520 Merge "Backfill OWNERS for CTS module CtsHostsideNetworkTests" 2019-03-01 22:57:28 +00:00
Yichun Li
0c6f9ef7c8 Backfill OWNERS for CTS module CtsHostsideNetworkTests
You're receiving this CL because you're the owner of CtsHostsideNetworkTests as per http://go/cts-test-owners. Please refer to the following doc for more details on why we are backfilling OWNERS file: http://go/backfill-cts-owners.

Test: Ignored
Bug: 126563878
Change-Id: Ib239888264404f6acd265f9923d8c2c4eb988797
2019-03-01 10:37:11 -08:00
Brett Chabot
29235ec92f Migrate cts/hostsidetests to androidx.test
See go/jetpack-test-android-migration

Test: make cts; atest CtsDexMetadataHostTestCases
CtsAppSecurityHostTestCases
Exempt-From-Owner-Approval: mechanical automated package name refactoring
Change-Id: I87228b09384f759d0702270ca26ed9010072e6bf
2019-02-27 00:30:28 +00:00
Sudheer Shanka
2186a943d3 Add permissions needed for WifiManager.getConnectionInfo().getSSID().
Fixes: 124383293
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I3145e4ba1e768b7bb3c89867e36b506a90b87506
2019-02-15 18:03:10 -08:00
Pavel Grafov
6b35917311 Merge "Cleanup leftover commented code." am: 89268e42f2 am: da8ad481d3
am: 6fe1ac0066

Change-Id: I574b525b90709c3f1256c60a5f0dfb41b6c4c69a
2019-01-31 02:36:01 -08:00
Pavel Grafov
93281da1c3 Merge "CTS test for VpnService.isAlwaysOn & .isLockdownEnabled." am: 30667cf8c0 am: ec4f77d275
am: 1c2ee40dcd

Change-Id: I6416bb47b1793995155c41dfa9728615e78b9418
2019-01-30 13:55:09 -08:00
Pavel Grafov
063552f8c9 Cleanup leftover commented code.
Test: builds
Bug: none
Change-Id: Ic14227d0ddccbd04e13c7a61197765eab2555cbe
2019-01-30 21:44:39 +00:00
Pavel Grafov
49e9a78dcb CTS test for VpnService.isAlwaysOn & .isLockdownEnabled.
Test cases that expect to get "true" returned are part of
devicepolicy tests since it is hard to set up always-on
configuration without device/profile owner.

Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Test: atest HostsideVpnTests#testIsAlwaysOnIsLockdown
Bug: 72628179
Change-Id: I7fceab93a1d2d0255611f7a788391540e0dddccb
2019-01-30 18:50:15 +00:00
Amith Yamasani
614733dab6 Merge "Foreground Service Location tests" 2019-01-29 20:07:13 +00:00
Amith Yamasani
1a2ad39b55 Foreground Service Location tests
Create multiple foreground services and make
sure the process state reflects which FG service
type is running.

Also fix an existing test with hardcoded proc
state.

Bug: 111453223
Test: atest CtsAppTestCases
      atest CtsHostsideNetworkTests

Change-Id: I309083d13452df58f6dc8e7089328acf260a2ed0
2019-01-28 22:11:30 -08:00
Irina Dumitrescu
24e2819d22 Merge "CTS test for setting HTTP proxy on a VPN network." am: 1ca625c2cb am: 0e603d64bf
am: 8c37a098cb

Change-Id: I61d8913e679ab73c61d951a9603b1823c5172f08
2019-01-25 07:15:07 -08:00
Irina Dumitrescu
3e84aa2e36 CTS test for setting HTTP proxy on a VPN network.
Bug: 76001058
Test: adb shell settings put global stay_on_while_plugged_in 7 && atest HostsideVpnTests
Change-Id: Ifa64d640f15bb68736b8c12f70e58a180bd80869
2019-01-24 19:10:21 +00:00
Juju Sung
6772e96931 Merge "Fix lowMemoryKill with app2.MyService" into pie-cts-dev am: 86ca1697d0 am: 5e7629b84a
am: fc407c45a7

Change-Id: If047ee41d0f3283c4e802d555453270f114b1dfd
2018-12-25 00:35:43 -08:00