OSDN Git Service

Fix ConnectivityServiceTest testRequestBenchmark
authorHugo Benichi <hugobenichi@google.com>
Tue, 15 Nov 2016 02:25:52 +0000 (11:25 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Thu, 26 Jan 2017 09:52:14 +0000 (18:52 +0900)
commitb038044758b2699f22b1215fe3a7ac4ed9a7a15a
tree1ba8c4e0e7b90bff7069d578063db742218ebe6b
parent06124cc892091a4f251112c39aba43e05345ac7b
Fix ConnectivityServiceTest testRequestBenchmark

This patch fixes flakyness of testRequestBenchmark by adjusting time
limit for callback registration from 100ms to 180ms, and time limits for
onAvailable and onLost triggers from 30ms to 40ms.

With these timeouts the test succeeds 100% over 5000 iterations.

When using 150ms for registration timeout, running the test 5000 times
fails 2 times.

When using 30ms for onLost timeout, running the test 5000 times fails
1 times.

In addition, this patch also cleans testRequestBenchmark and uses the
more stable SystemClock.elapsedRealtime() for duration measurements.

Test: $ runtest frameworks-net
Bug: 32561414

(cherry picked from commit 38be57b438a0c1754091f045317db2049304e16f)

Change-Id: I196ab9ef7f5abe456a783eed65db09279d2ecb8c
tests/net/java/com/android/server/ConnectivityServiceTest.java