It's sometimes not clear that tests call ensureWifiConnected
but no wifi enabled. It's hard to clarify design with wifi
stack, so add the gotten wifi info in the log to help on
debugging.
Bug: 252869312
Test: atest CtsNetTestCases
Change-Id: I3bc74dd38dd5a36a93510fc5d70c0fa00b66e842
as this does not appear to be used anywhere anymore
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6905c6fdb4daf48df07e758481368d441637ad13
as this does not appear to be used anywhere anymore
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I95939b0b6c66f41f776ca31ea7178bb30241b81f
These methods have been migrated to the shorter and better
provisioned expect<> family of methods.
Test: Builds
Change-Id: I60c77bfeabe373557d61f0f8d0295b385fe5271e
Sometimes the tests are run under high load, e.g. immediately
after boot while all apps that listen for the boot completed
broadcast run their listeners. Under these circumstances,
40ms of leeway is tight ; on recent Android devices HZ is
commonly 100 too, meaning a general time unit of 60 will give
a little bit of air.
The drawback in this is that the test is less stringent on
TrackRecord, which as a multi-thread primitive should have
really tight tests to make sure that a non-threading primitive
(e.g. a polling implementation) doesn't pass. This patch makes
the testing on that front a little bit less reliable.
Note that this patch won't actually fix all flakes in that it
isn't really possible to guarantee the device will have any
CPU time to run the test at all anyway, but this should make
most failures go away.
Also, the argument for the time unit is never used, and can
be removed ; at least, the possibility of the timeArg() func
not using the same value as the sleep directive is scary, so
that possibility should be removed. If the time unit argument
is ever needed it can be added back, but considering the arg
has been available for years and never used, it's unlikely.
Test: NetworkStaticLibTests
Fixes: 254188131
Change-Id: Ia7a4fe775942484dcd7dc223c7710e82a8329beb
This already has all necessary methods, it only needs to
declare it implements the interface.
Test: ConnectivityServiceTest
Change-Id: I8de643f2b8de9765c25c3efe934c94549f341a51
"callback" is redundant – it's a TestCallback object and
it takes a type of callback anyway.
"assertNextIs" is shorter than expectCallback, and more
directly explicit than "expect", but it's also 3 words
and very different from previous usage.
Using expect() is a little bit less in-your-face obvious,
but it's simple, familiar, and short.
Test: CtsNetTestCases
FrameworksNetIntegrationTests
FrameworksNetTests
NetworkStackTests
Bug: 157405399
Change-Id: I6c8c85a8be3895dd8f0ef681faa4a8b2b4f2f493
In Java, "poll" methods return null when the collection is
empty. Respect this convention.
Bug: 157405399
Test: FrameworksNetTests
Change-Id: I3b17908f9ce1f60b18908605a645da3199c010b9
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:
BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower
See https://errorprone.info/bugpatterns for more
information on the checks.
Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I772563b5e54b468a755520d2ed9b78bcb5fc3ad6
The default timeout for expectEventually is 30 seconds, so this
test used to take one minute. With this change, it now only takes
50ms, with virtually no change in safety.
Test: NetworkStaticLibTests
Change-Id: Id8d6a738ea6a70f7d901a7659b2160c2f3d7d2c0
This tests a utility in f/l/n, so it should live together with
it and not in the network stack tests
Test: NetworkStaticLibTests NetworkStackTests
Change-Id: I90d12933e3a82eba4b565022d3df1e7c1d503f56
The timeout is used in the test should be WIFI_CONNECT_TIMEOUT_MS
but log shows WIFI_CONNECT_INTERVAL_MS instead. The debug log is
confusing. Correct it to right variable.
Test: atest CtsNetTestCases
Change-Id: I4cedaa6e03aea6cc02a07bdbea2f0b1e7f5076e1
In particular this moves NetworkCapabilies#
appendStringRepresentationOfBitMaskToStringBuilder to this
class. It also moves some other NetworkCapabilitiesUtils
methods that are better homed in this new class.
Test: new test in this patch
Change-Id: I16374d7ca1da92052bb814bde796602d62f5c42e
TestableNetworkCallback is using on both unit and cts tests with
same timeout 200ms. For unit tests, most of objects are mock, so
the callback should respond quickly and this interval is fine.
But for cts tests, they are running on the real system and the
callback time will depend on the system which may be over 200 ms
sometimes if the system is busy or has performance problems. So
enlarge the Network Callback default timeout to 500ms that can
reduce the test flake on cts tests. To ensure there is no impact
on no callback check, add the no callback timeout 200ms which is
the same timeout as before.
Bug: 245000567
Test: Run the FrameworksNetTests CtsNetTestCases and check
no running time increase.
Change-Id: I31f8bc08f65a622f6ab9b6c7f0577f0b107440c1
See 5.12+ kernel's include/uapi/linux/bpf.h
(note that since bpf is 64-bit, int and long are the same thing)
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib340a619645ad5ab8e41ff76cb7b51671f496bc5
This re-submit aosp/1387135 but define TYPE_CNAME locally to
prevent from using non-finalize API.
Bug: 139774492
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.DnsPacketUtilsTest
Change-Id: Ib2e98292be994ca09845c6857b8884f9bcdaba80
These are allocated in order by the kernel, if we go
over 2 billion, we've got other problems... besides
U32 to S32 conversion will work just fine anyway.
(apparently this field is never accessed, as the test only looks at family)
Bug: 245472520
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I879c1637a87587b7bc1c13013ea9c5e655c141eb
Revert "[ST02.1] Add TYPE_CNAME constant to DnsResolver"
Revert submission 1387135-st02
Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process
Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets
Change-Id: I9f8de47c9ba9fb4db7cf3695966f222f68a9a290