Commit Graph

215 Commits

Author SHA1 Message Date
Sudheer Shanka
643abc73d9 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
2020-04-14 21:31:40 +00:00
Sudheer Shanka
9eb1424bcf Merge "Dump debug logs after a test failure before running tearDown()s." into rvc-dev 2020-04-06 19:20:19 +00:00
Sudheer Shanka
1f4e465b5a Dump debug logs after a test failure before running tearDown()s.
Bug: 145420790
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I19516046f05bd4564c57542ae82a82a1cc362f48
2020-04-05 01:57:55 -07:00
Dan Shi
d4bff6cd28 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
2020-04-01 13:30:00 -07:00
Dan Shi
67de87eed0 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: Ia9af1fbddc66d3c94976a58c36d274425f1fe461
2020-03-23 09:34:13 -07:00
Sudheer Shanka
97da47d0dd Merge "Enable verbose logging for the test app." 2020-02-21 18:48:39 +00:00
Sudheer Shanka
bae482a772 Enable verbose logging for the test app.
Bug: 145420790
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I8ba31a365e66bd199f19de1ff77cdf01df89602b
2020-02-17 13:34:09 -08:00
Sudheer Shanka
05f62e1986 Dump usagestats of helper app as well.
Bug: 145420790
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I8dc78cc33900dcb6aa423cc5a7dc2b27d8d4c1ef
2020-02-16 22:34:15 -08:00
Sudheer Shanka
6291996513 Allow network policy test app to query info about the helper app.
Bug: 149569765
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Id01bb6b0ee6fd45d001c75a4dfc8328667c61554
2020-02-14 18:09:01 -08:00
Sudheer Shanka
9a1e3be614 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
2020-02-05 18:09:08 -08:00
Colin Cross
f7d2ff895e 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
cts/tests/location/location_fine/src/android/location/cts/fine/CriteriaTest.java:199: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
cts/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java:948: error: [TryFailThrowable] Catching Throwable/Error masks failures from fail() or assert*() in the try block
cts/tests/location/location_fine/src/android/location/cts/fine/LocationTest.java:402: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
cts/tests/tests/assist/src/android/assist/cts/AssistTestBase.java:613: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue
cts/tests/tests/assist/src/android/assist/cts/AssistTestBase.java:616: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue
cts/tests/tests/media/src/android/media/cts/AudioRecordTest.java:1661: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
cts/tests/tests/media/src/android/media/cts/AudioRecordTest.java:1681: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.

Bug: 146455923
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I48b1ccb61c807d0b41a165298ef5981258d6656e
2019-12-31 09:40:49 -08:00
Automerger Merge Worker
0fdd1ee38b Merge "Add a CTS test for private DNS on VPNs." into qt-dev am: 17311d9af6 am: fe44dd21ba am: 523cc30322 am: b29ba93dcd
Change-Id: I20a4d12beb846fa0d192e6426719c762ffb0c187
2019-12-13 02:27:54 +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
Kweku Adams
1881bc644f Change network parole while charging tests.
The periodic parole window is the 10 minute window that occurs every
24 hours to let RARE apps run. Now that we have the quota system in
place, there's no need to have the periodic parole window. Alarms and
jobs will still be allowed to run when charging. Network will continue
to be restricted for RARE apps even when charging. JobScheduler requests
an exception for RARE jobs in quota, so they will still be able to run.
With this change, idle apps should still not get network when charging
unless JobScheduler requests it, so we have to update the tests.

Bug: 136184981
Test: atest AppStandbyControllerTests
Test: atest CtsAlarmManagerTestCases
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest com.android.server.AlarmManagerServiceTest
Test: atest com.android.server.AppStateTrackerTest
Test: atest com.android.server.job.controllers.QuotaControllerTest
Change-Id: Icd7b6eff8777f9b53a10eca521b73988f58f2d84
2019-10-14 11:37:43 -07:00
Jeffrey Vander Stoep
31e0d78ed5 Merge "getConnectionOwnerUid: add test for b/141603906" am: e8a8d9a26f am: ab361a6fbd am: 90190f2e14
am: 5a8999451e

Change-Id: I94d01773e64292a7e8ce7612fb2bd0dac686b860
2019-10-08 03:45:26 -07: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
Sudheer Shanka
09ae6d2645 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
2019-08-20 10:19:32 -07:00
Sudheer Shanka
9677c19c12 Merge "Skip battery saver related tests on unsupported devices." into qt-dev am: f8eb2722ff
am: bec485ec90

Change-Id: I4423117a8636ce63431873f4f5edf0fe2832f97e
2019-06-14 10:46:35 -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
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
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
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
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
Juju Sung
fc407c45a7 Merge "Fix lowMemoryKill with app2.MyService" into pie-cts-dev am: 86ca1697d0
am: 5e7629b84a

Change-Id: I8c5ab1fb1f60b7dc3d5b3ca7e1c2fabd763659a8
2018-12-25 00:29:49 -08:00