Commit Graph

13 Commits

Author SHA1 Message Date
Chalard Jean
ceaf7d0edc Move util classes to their destination package
Test: FrameworksWifiTests FrameworksNetTests
Change-Id: I93e9cfd968e08f983e3fd9f7196c455c79a0f32d
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17
2020-12-16 08:50:20 +09:00
Lorenzo Colitti
a726723ffb Add logging to TestableNetworkCallback.
This is not super useful because it cannot identify different
NetworkCallback objects from each other, but I've found it to be
better than nothing.

Test: manual
Change-Id: Ib402161f361c0f9fb68701bf171cbc99f598dafd
2020-12-14 14:43:42 +09:00
Remi NGUYEN VAN
539aece60f Add autoStart parameter to TapPacketReader rule
Setting autoStart to false allows tests to manually start the
TapPacketReader rule, either via method call (allowing callers to
specify their own Handler) or an annotation.

Bug: 168868607
Test: atest NetworkStackIntegrationTests using autoStart = false
Change-Id: Ic295d659250795c45181dc3c0ac0aaacba854f0b
2020-10-02 15:14:21 +09:00
Remi NGUYEN VAN
b904113030 Add TapPacketReaderRule
This test rule allows tests to easily create a tap interface, a
TapPacketReader on it, and tear them down after the test.

Bug: 168868607
Test: atest NetworkStackIntegrationTests
Change-Id: Ibc167f5c9a8a1b295e8f6c8384a55a1e3410fcdc
2020-09-30 17:59:41 +09:00
Remi NGUYEN VAN
3b1e9265eb Add TapPacketReader#startAsyncForTest, poll
Add a startAsyncForTest method to attempt to start the TapPacketReader
on its handler thread. The method will not report failures to start
(especially failures to create the socket), so it is only added in
TapPacketReader for test code, and not FdEventsReader which would be in
production code.

Rename popPacket to poll, keeping the old version as deprecated
for compatibility. "pop" normally refers to removing a packet from the
top of a LIFO stack, so it is not appropriate naming here.

Test: m
Bug: 168868607
Change-Id: I19184aaca018165856d1d5e5d24b976ae75d1664
2020-09-25 12:28:43 +09:00
Remi NGUYEN VAN
a60293a5e9 Add test utilities for shell permission identity
Add utilities allowing to run lambdas with shell permissions, in kotlin
and java tests.

Bug: 168868607
Test: m
Change-Id: Iaab38d498338b9e95d263789119cd0813983087d
2020-09-25 11:42:38 +09:00
Chiachang Wang
dea21b79a3 Add eventuallyExpect overload
eventuallyExpect is inline function with reified type which
is not accessible from java. Add an open overloaded method to
support the usage.

Bug: 162323152
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Test: atest TestableNetworkCallbackTest
Change-Id: Ifd2256e08d7e5d092d57594350ac8ed1c1727afb
2020-09-02 17:46:28 +08:00
Chalard Jean
d59af18458 Remove backward compatibility flag
Kotlin updates to 1.4 and fixes an issue where @JvmOverload methods
were not final.
See https://kotlinlang.org/docs/reference/compatibility-guide-14.html#generated-overloads-for-jvmoverloads-on-open-methods-should-be-final

Remove the backward compatibility flag by special-casing the method
that needs to be overridden at this time, which gets rid of the
local concern.

Bug: 166499531
Test: Builds, atest ConnectivityServiceTest
Change-Id: Ia13c67876f99dafd77d890e82d62453713b7b5fe
2020-08-28 16:56:55 +09:00
Remi NGUYEN VAN
edb36498eb Merge changes from topic "metrics_cts_tests"
* changes:
  Add utilities to test tap interface networks
  Add PacketFilter utilities for DNS testing
2020-08-24 07:13:40 +00:00
Remi NGUYEN VAN
7995b438eb Add utilities to test tap interface networks
Add an ArpResponder based on a generic PacketResponder class, and a
TestHttpServer based on NanoHttpd.

Test: tests based on these utilities
Bug: 160617623
Bug: 160656765
Change-Id: I50b872a8b23e8df997e8f62f0adc7c0256c4d74d
2020-08-14 12:54:41 +09:00
Chalard Jean
b1856fe06b Rename utils to remove the Kt suffix
Nobody cares what language this is written in

Test: builds
Change-Id: I3ed3bce276479fd503e716a06fd4912da8c49eda
2020-07-31 15:24:34 +09:00
Chalard Jean
e06c5c8fc0 Fix issues reported by checkstyle
Test: builds
Change-Id: I41979cc8096a682c6844df0825ee56ab00a828b5
2020-07-31 09:58:14 +09:00
Chalard Jean
48c6c7d838 Move utilities to libs/net
These files used to be in the network stack directory, but the libs
directory is a much more suitable place for them.

Also fix a typo : ConcurrentIntepreter → ConcurrentInterpreter

Also move {FdEvents,Packet}Reader to internal annotations. That's
what they should have been using in the first place anyway.

Note that this does not fix preupload issues reported by
checkstyle to make review easier. The fixes are in a followup
patch to this one.

Test: checkbuild
Change-Id: I675077fd42cbb092c0e6bd56571f2fc022e582fd
2020-07-30 22:10:51 +09:00