Commit Graph

739 Commits

Author SHA1 Message Date
Neil Fuller
a8574413ed Add CTS tests for LocalSocket read/write timeouts
The behavior was not previous covered and broke in N
due to commit c80af6d8. There is an associated fix
in frameworks/base.

Some refactoring of existing tests to reduce
duplication and tidy up sockets after tests.

Test: Ran the new CTS test (before and after related fix)
Bug: 31205169
(cherry picked from commit 52376fc1c8)

Change-Id: I9ee96a91abbdaaba64c2f6daf49c92d1b23352e2
2016-08-31 18:18:02 +01:00
Felipe Leme
9c1322683f Improvements on retry mechanism on network tests:
- Retry on all cases (not only when expecting connected).
- Uses exponential back-off for timeout.

BUG: 27803922
Fixes: 30509643

Change-Id: I42454f43158598a72e30f290c27c5a02e80ea6d2
2016-08-01 17:23:29 -07:00
Felipe Leme
e928006e67 Cover more PendingIntent whitelist scenarios.
BUG: 29480440
Change-Id: I961b765f40135efc06fbb3e5a4a94e8e333453da
2016-06-28 09:07:53 -07:00
Phil Weaver
79fad1a209 Merge "CTS: Only listen to wifi events when toggling wifi" into nyc-dev 2016-06-23 01:48:11 +00:00
Phil Weaver
0d7d1da503 CTS: Only listen to wifi events when toggling wifi
When counting all connectivity changed events, we were failing
on devices with sim cards because we were counting both wifi and
mobile connectivity changes the same. Since the test only
toggles wifi, changing the listener only to pay attention to wifi
changes.

Bug: 29346253
Change-Id: I1ed3b976bc21419218c780d4afc4a5e73f128496
2016-06-22 16:50:38 -07:00
Jun Tahara
86ba00d2a9 Merge \\\\\"Remove non-CTS packets assertion code\\\\\" into marshmallow-cts-dev am: 0ba763ab98 am: 6ce150c6ae am: 5c4a3982a8 am: fd1fb4d863
am: 995005d649

Change-Id: I40f34d7a22b09a4ef5a4190f2a236b643062f306
2016-06-22 00:20:07 +00:00
Jun Tahara
fd1fb4d863 Merge \\\"Remove non-CTS packets assertion code\\\" into marshmallow-cts-dev am: 0ba763ab98 am: 6ce150c6ae
am: 5c4a3982a8

Change-Id: Idcd4a248c8f74e095ba4162d8a468dbd962c8163
2016-06-22 00:14:51 +00:00
Jun Tahara
6ce150c6ae Merge \"Remove non-CTS packets assertion code\" into marshmallow-cts-dev
am: 0ba763ab98

Change-Id: I9d9549d4388af53475a0457f7be1d55d88d5e72d
2016-06-22 00:09:33 +00:00
Lorenzo Colitti
abc35d5527 Clear local test results across DNS lookups.
If InetAddress.getAllByName("ipv6.google.com") throws
UnknownHostException, the test silently ignores it. This
causes a misleading failure, because the test then reuses the
addrs variable that is left over from the previous DNS query
for "www.google.com", and fails because it has an IPv4 address.

Fixes: 12210306
Bug: 29231261
Change-Id: I1dde945765d40a84eba139055306b07ebc97d0ec
2016-06-21 13:39:49 +09:00
Jun Tahara
349f7ed040 Remove non-CTS packets assertion code
Symptom:
testTrafficStatsForLocalhost fails when applications or services
except CTS are using network.

Root cause:
testTrafficStatsForLocalhost can't calculate the number of
non-localhost packets for CTS.
It includes the all of packets for applications/services except CTS
and non-localhost packets for CTS.

Solution:
Remove this assertion and only logging the number of packets.

Change-Id: I49243d59f359f3a543c6bdb46f6a2645cde8f292
2016-06-20 17:50:39 +09:00
Felipe Leme
c3a9008e3d Add non-parcelable extras to notification to make sure it does not crash
the app.

BUG: 29402928
Change-Id: I4fc47535ae14e71c50b25285b2fe5375abdb4f11
2016-06-16 10:03:27 -07:00
TreeHugger Robot
db3485a45e Merge "Log the address of the IPv4 address that causes the test to fail." into nyc-dev 2016-06-09 07:46:17 +00:00
Lorenzo Colitti
1d75845bd5 Log the address of the IPv4 address that causes the test to fail.
Bug: 29231261
Change-Id: I6aac389d2c234091a284486422ee663119d021a9
2016-06-09 14:38:03 +09:00
Felipe Leme
1791555ca8 Merge "Changed network check URL." into nyc-dev 2016-06-06 17:09:36 +00:00
Felipe Leme
829443c140 Changed network check URL.
It cannot use google.com because it's blocked in some countries where
CTS tests are run.

BUG: 29082308

Change-Id: I749659ec2cd33248fddbe5b4ab02bd6e90f24a67
2016-06-06 16:05:57 +00:00
Felipe Leme
d1f3d68694 Skip Doze Mode-related tests when device does not support it.
Fixes: 29072117
Change-Id: I7ca37eae58258c021ed6297a9f1ee3b2749da7d7
2016-06-02 20:16:25 +00:00
Felipe Leme
b9b85ce0cd Add flakyness check when a valid connection is expected.
BUG: 29082308

Change-Id: Iadb9a0bd7fbd307d799af7a7a5dabc0ed000bc6d
2016-06-02 09:08:49 -07:00
Felipe Leme
4188bc32d5 Added test for whitelisting pending intent for Doze Mode.
BUG: 28818704

Change-Id: I927364e78cd73133899d67be23e0b274829686af
2016-05-27 14:21:36 -07:00
Phil Weaver
f057299a13 Merge "CTS coverage: connectivity change, photo, + video" into nyc-dev 2016-05-25 23:06:26 +00:00
TreeHugger Robot
b853005f3c Merge "Use ConnectionManager API to check if network is metered." into nyc-dev 2016-05-25 16:54:26 +00:00
TreeHugger Robot
94636121f1 Merge "Add a test for closing sockets when a VPN comes up." into nyc-dev 2016-05-24 05:38:33 +00:00
Felipe Leme
68471ef930 Use ConnectionManager API to check if network is metered.
Also retry when getActiveNetworkInfo() returns null.

BUG: 28870582
BUG: 28909522
Change-Id: I4a43f171a7d6c73ea50555b66f858a54da65ae58
2016-05-23 11:33:34 -07:00
Phil Weaver
36f05df51f CTS coverage: connectivity change, photo, + video
Confirming that connectivity change broadcasts can be received
when explicitly registering for them in N, and via the manifest
pre-N.

Confirming that new_photo and new_video broadcasts are not received.

Bug: 28122277
Change-Id: Icfc27364a41ee8f4a55920e295ba658a367bb7d2
2016-05-19 13:27:24 -07:00
Marcus Nascimento
b232cf2d49 Merge "Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev am: 92849de21f -s ours" into marshmallow-cts-dev am: a6aa5bce79 am: 9ef251d523 am: 1ad52d8800 am: 01c938ccb7
am: 64f19d0319

* commit '64f19d031975520dc26fbe23c70a826e491032c9':
  Add assertion messages to testStartUsingNetworkFeature_enableHipri.

Change-Id: I222dcf7299db1d2bac9641c5f200f69f87a21905
2016-05-19 18:23:44 +00:00
Marcus Nascimento
01c938ccb7 Merge "Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev am: 92849de21f -s ours" into marshmallow-cts-dev am: a6aa5bce79 am: 9ef251d523
am: 1ad52d8800

* commit '1ad52d8800d39194d738a0d805de134a833b412c':
  Add assertion messages to testStartUsingNetworkFeature_enableHipri.

Change-Id: I5fe5ef00893350a7bf0d52176c0dc451d9e089a9
2016-05-19 18:09:28 +00:00
Marcus Nascimento
9ef251d523 Merge "Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev am: 92849de21f -s ours" into marshmallow-cts-dev
am: a6aa5bce79

* commit 'a6aa5bce79af1d1294ff815a396f1764fc703a27':
  Add assertion messages to testStartUsingNetworkFeature_enableHipri.

Change-Id: Ib12541988e1c5154fd5343d8fec9e6628239238a
2016-05-19 17:54:53 +00:00
Android Merger
a6aa5bce79 Merge "Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev am: 92849de21f -s ours" into marshmallow-cts-dev 2016-05-19 17:28:36 +00:00
Marcus Nascimento
8074918f7f Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev
am: 92849de21f  -s ours

* commit '92849de21f245cd43c4c05b28fbf59ef6feb725a':
  Add assertion messages to testStartUsingNetworkFeature_enableHipri.

Change-Id: Iabea0582c95db8353d3d7e4ec5008a45aa05b403
2016-05-19 17:28:26 +00:00
Daniel Xie
92849de21f Merge "Add assertion messages to testStartUsingNetworkFeature_enableHipri." into lollipop-mr1-cts-dev 2016-05-19 16:39:30 +00:00
TreeHugger Robot
f76c309ebe Merge "Added tests for idle apps and doze mode." into nyc-dev 2016-05-17 22:40:45 +00:00
Aaron Holden
4e0eb2e458 Merge "Remove module-level WifiCheck preparers" into nyc-dev 2016-05-16 22:45:29 +00:00
Lorenzo Colitti
cbcfb98dd8 Add a test for closing sockets when a VPN comes up.
Bug: 28251576
Change-Id: Iab0a8643cff3c54eb04168a7cdfa116c0b8e30b1
2016-05-16 23:10:44 +09:00
Felipe Leme
88debac60e Added tests for idle apps and doze mode.
BUG: 28473659
BUG: 28521946
Change-Id: I4bc9166bf2050136fa86e374aac59f80afd76f1c
2016-05-13 15:08:16 -07:00
Aaron Holden
3361c86147 Remove module-level WifiCheck preparers
As WifiCheck is now declared in the CTS config, remove declarations in
the module configs.

Also downgrade TargetSetupErrors on failure to logged errors

bug:28234985
Change-Id: I2e1a369bc26aeca922686c4c3d8c033bb7f9fbc7
2016-05-11 09:55:44 -07:00
Felipe Leme
ed64e61b5f Covers more corner cases on restricted network modes:
- Tests what happens on foreground applications when a restriction (like
  Data Saver or Battery Saver modes) is turned on (prior tests would
  turn the restriction on *before* switching the app to foreground).
- Tests multiple restrictions simultaneously enabled.

Also improved existing code:

- Fixed background state check.
- Reused some common checks in helper methods.
- Retries checks for process state.

BUG: 28473659

Change-Id: Ifcf9cc6d895ccde0ab5177f9f5d8c347ce53b811
2016-05-09 12:48:29 -07:00
Felipe Leme
6cd41f6d03 Asserts foreground apps always have network access.
BUG: 28473659
Change-Id: Iea6933a4630ff2e9c00a2d2e9e4a6f1a51de70f2
2016-05-06 14:28:03 -07:00
Felipe Leme
aa2e8ea1d8 Assert whitelists are revoked on uninstall.
BUG: 28616418
Change-Id: I909fd4c6024afe5b42560090c6e2f11b43c220de
2016-05-06 09:18:54 -07:00
Felipe Leme
691e85def7 Temporarily disable NetworkInfo check.
There are known issues that cause these check to fail, and the fix has
not been submitted yet.

BUG: 28473659
BUG: 28521946
Change-Id: I26dfbebc2d07396ef89ac78230645e4791c708ee
2016-05-04 18:48:24 +00:00
Felipe Leme
50bce69fab Improved connectivity check by also asserting NetworkInfo states.
BUG: 28473659
BUG: 26571724
Change-Id: Iba687003431ed5c353412268726967a798f538da
2016-05-03 08:29:52 -07:00
Felipe Leme
fa8e24c3e6 Added test for required packages whitelisted for Data Saver Mode.
Also fixed code that checks for whitelist uids, otherwise it would pass
when the required uid is missing but a superset was present (for
example, when asking for 1009 but 10090 was whitelisted).

BUG: 28431507
Change-Id: Iaaa67e586907dba215496460445ad627ba7b63c5
2016-04-29 14:10:12 -07:00
Marcus Nascimento
c847a249c6 Merge "Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev am: ce158e65ae -s ours" into marshmallow-cts-dev am: 90419fc992 am: 4699aa522a am: 69db501b63 am: f9185c256f
am: 8ad4295bec

* commit '8ad4295bec64574b3c05547efc29f225b385e6ce':
  Add assertion message to assertions for testExecute_withMobile.

Change-Id: Id4892624242d707920f285c13dbfd029f7f2cc3d
2016-04-29 11:17:44 +00:00
Marcus Nascimento
f9185c256f Merge "Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev am: ce158e65ae -s ours" into marshmallow-cts-dev am: 90419fc992 am: 4699aa522a
am: 69db501b63

* commit '69db501b632720dda1e5aba0ac8aa676f11247e8':
  Add assertion message to assertions for testExecute_withMobile.

Change-Id: I17fe6ca042b8ec387e082ef475538933e1e9a33c
2016-04-29 11:12:32 +00:00
Marcus Nascimento
4699aa522a Merge "Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev am: ce158e65ae -s ours" into marshmallow-cts-dev
am: 90419fc992

* commit '90419fc99220c249b29a09805c06f9a1fc25f0d1':
  Add assertion message to assertions for testExecute_withMobile.

Change-Id: Ifc327d9165a543b163c954d964c982fdd14ab1af
2016-04-29 11:05:01 +00:00
Android Merger
90419fc992 Merge "Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev am: ce158e65ae -s ours" into marshmallow-cts-dev 2016-04-29 10:59:36 +00:00
Marcus Nascimento
5d6e8323f6 Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev
am: ce158e65ae  -s ours

* commit 'ce158e65aec1b2c9687852872c9fd9ed74585144':
  Add assertion message to assertions for testExecute_withMobile.

Change-Id: I12a3b5e90ce51ebbc233d69126eb78e3a85d6ba3
2016-04-29 10:59:28 +00:00
Daniel Xie
ce158e65ae Merge "Add assertion message to assertions for testExecute_withMobile." into lollipop-mr1-cts-dev 2016-04-28 16:44:37 +00:00
Marcus Nascimento
51eb8c19a0 Add assertion message to assertions for testExecute_withMobile.
Some partner test devices without a SIM Card or with no signal, thus
without mobile network data connection.

Added a message to check signal and SIM card and rerun the test.

Also added a verification that the network type is supported in the
event of a Connectivity Action's timeout. Unsuported network type could
be caused by a network stack crash.

Bug: 28207677
Change-Id: Ibca50359df7d5fb8371f4f4037fc81f029f48b30
2016-04-28 16:40:31 +00:00
TreeHugger Robot
25a61dcae9 Merge "Add more test coverage to ConnectivityManagerTest." into nyc-dev 2016-04-27 10:21:48 +00:00
Marcus Nascimento
335856c1d3 Add assertion messages to testStartUsingNetworkFeature_enableHipri.
testStartUsingNetworkFeature_enableHipri should be able to reconnect to Wifi Network.
Added a prefix to the already defined error message to rerun the test.

The ConnectivityManager's startUsingNetworkFeature will fail without SIM card and/or signal.
Changed the error message to check SIM card and signal and rerun the test.

Bug: 28264205
Change-Id: Ia1b35cab11afa65ae93ea7dab2f7cc3a330d8471
2016-04-26 11:32:30 +01:00
Owain Davies
c403c81218 Merge "Merge "Add assertion message if testDns ipv6 lookup reutrns ipv4." into lollipop-mr1-cts-dev am: b996de8" into marshmallow-cts-dev am: 48216c2 am: 275a0e6 am: 4be27c8 am: 0399523
am: fd3f832

* commit 'fd3f832fcfb9dc4fa3e4d497a97ebdf1636269b2':
  Add assertion message if testDns ipv6 lookup reutrns ipv4.

Change-Id: I774f8188a4329508bd590564859f38b3ec049f7c
2016-04-25 23:48:09 +00:00