Checking that the network was successfully restricted before starting
the activities in ConnOnActivityStartTest. This avoids races between uid
state changes and device state changes in NPMS code that lead to
unpredictable UnknownHostException flakes in the first iteration.
Moving the java cache clearing to happen immediately before the check,
so no side effect from different code can impact the DNS query.
Increasing the socket-timeout to mitigate socket timeout failures.
Changing the default test URL to generate a 204 to avoid any extraneous
errors that may arise in doing other I/O, and switching to the canonical
connectivity check URL on the android.com domain.
Enabling support for passing down a custom url to use for testing
network connectivity using the runner options. This will enable easily
switching between different URLs for debugging when required.
Using a dedicated data class to encapsulate information to be returned
from test app to the instrumentation app.
This makes the logic more resilient, readable and maintainable.
Test: atest CtsHostsideNetworkTests:HostsideConnOnActivityStartTest --\
--test-arg com.android.compatibility.common.tradefed.testtype.JarHostTest:\
set-option:com.android.cts.net.HostsideConnOnActivityStartTest:\
custom-url:"https\://www.example.com"
Bug: 330406935
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:04c638ee3a5bab7895817ebfc0d3f6a69b1ee26d)
Merged-In: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4
Change-Id: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4
Suprabh Shuklaauthored and Android Build Cherrypicker Workercommited 2024-04-02 05:51:41 +00:00
Developers often forget to unregister requests in tests, and cleanup
code also makes tests more verbose.
Add a rule that unregisters callbacks automatically when after each test
method.
Replace current usage of connectToCell with this rule, as well as
network callback usage in CaptivePortalTest (which is one example that
did not unregister its callback).
Test: atest
Change-Id: Ie3b9c5cf529004b7b3af04bc13a7e69acfbbaa18
The test expects the absence of default network changes. However,
fluctuations in network capability during the test can introduce
flakiness. To enhance test stability, specify a callback for
deflaking.
Test: atest CtsHostsideNetworkTests
Bug: 329188322
Change-Id: I9ea2d5a03981f3a6584964d5a5a11e80f293edd2
The feature is now turned on so the tests can be re-enabled.
This reverts commit 6266342327.
Test: atest CtsHostsideNetworkTests
Bug: 304347838
Change-Id: I85f462e75931240bde8b0dd956c0011ec8435b8f
Apps will now lose network access once they are in top-sleeping or
higher process state. Adding some cts tests to ensure correct behavior.
The tests are using temporarily using junit Assume to skip if the
feature flag is enabled to enable a following code migration.
Test: atest CtsHostsideNetworkTests
BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing method
Bug: 304347838
Change-Id: Iba7c7bd01309fa7a301fdc1524033f0fad5ae512
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.
For more details please refer to the link below,
<add g3 doc link>
Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5
The definition of background can be fluid and ambiguous. Refactored all
code to be explicit about process states when making assertions.
No functional change is expected to tests.
Test: atest CtsHostsideNetworkTests
Bug: 304347838
Change-Id: Ibc614d74f46d436cad4586c1d309bbb3648b8eb1
Merged-In: Ibc614d74f46d436cad4586c1d309bbb3648b8eb1
currently we have:
org.junit.ComparisonFailure: expected:<[]bic> but was:<[cu]bic>
at org.junit.Assert.assertEquals(Assert.java:117)
but this is the reverse of the intended error:
org.junit.ComparisonFailure: expected:<[cu]bic> but was:<bic>
at org.junit.Assert.assertEquals(Assert.java:117)
method signature:
public static void assertEquals(Object expected, Object actual)
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I322ea162f2818aaa1beba5c1b9febcf97d29eea1
Maciej Żenczykowskicommited 2024-01-18 23:43:00 +00:00
The test relies on the tethering module code. Test is supposed to run on the matching version of module prebuilt. Add mtcs tag to ensure this.
Bug: 316939964
Change-Id: I2b4d212a7dadf11e847abc5b6855442fdcc87a7c
Otherwise, the app idle state could interfere
with the test verifications.
Bug: 317204099
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I057546082ffc2f6f5c8da8928824a5261d0f8c7f
On low-performance devices, this test case will activate LOW_POWER_STANDBY mode during the test, which should not be initiated in this test case.
The LOW_POWER_STANDBY mode blocks APK from accessing the network, resulting in test failures.
BUG:301027368
Signed-off-by: Wenbin.Chen <wenbin.chen@amlogic.com>
Change-Id: I1085addd22f4f3b709e1875049633832c5dac852
Test: CtsHostsideNetworkTests#com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Wenbin.Chenauthored and chen wenbincommited 2023-11-15 02:48:09 +00:00
For Power Saver tests, verify not only the network connectivity of
restricted apps, but also error cause.
Bug: 288340533
Test: atest
CtsHostsideNetworkTests: com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I122b62891175cd4a035f3c51c5b6073b34f8fd82
When 'set-inactive' command is used, it is possible for the
test app to get into the NEVER bucket as it wouldn't be
recorded as used by the user in some cases.
Bug: 298816567
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: If2667a07629b38395d0fed99771488d0900caf18
The Next app is only necessary in development branches and right now the
in-development SDK is V.
Test: TH
Change-Id: I6aa72d70bc124ae7cf40962b172965d1f0fdb437
This test assumes the data saver mode is initially disabled, but WearOS enables the mode on boot. This change fixes the precondition in the setUp method.
Test: run cts -m CtsHostsideNetworkTests
Bug: 280542664
(cherry picked from https://android-review.googlesource.com/q/commit:2cdeffc7e97a915a847cfc40d89e091aeadf20b3)
Merged-In: Ibcceaf0f44821100c861ef7b3c61d0888ae30481
Change-Id: Ibcceaf0f44821100c861ef7b3c61d0888ae30481
Kefan Tuauthored and Android Build Cherrypicker Workercommited 2023-08-04 22:02:25 +00:00
When the device is charging, any `am set-inactive` commands would be
effectively no-ops. So, explicitly take the test app out of the app
idle state after changing the charging state.
Bug: 288220398
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueTest.java
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9290fb85fe3c16c1a424ffe32769c5b2927b4b74)
Merged-In: I152af12b404ac607fff794a527f45a0aad640d4f
Change-Id: I152af12b404ac607fff794a527f45a0aad640d4f
Sudheer Shankaauthored and Android Build Cherrypicker Workercommited 2023-07-18 22:42:57 +00:00
With installing test apps per test class instead of test cases,
the total execution time tests are improved from 1m56s to 1m34s
in local trials.
Notes: 1. This is a demonstration CL to other Hostside*Tests to show
how to make app2 can be installed per test class.
2. The method that executed per test class should not shadow
the method in the base class, see the doc of @BeforeClass.
Test: atest HostsideConnOnActivityStartTest
Bug: 289002798
Change-Id: Ia9875f0a9fdcb4fb4c55736034b56aad0491d451