The method buildTemplateMobileWithRatType is updated to take
metered as a parameter so the callers should be updated to
the new version.
Bug: 183776809
Test: atest FrameworksNetTest
Change-Id: I859514b93705f9ee4f9ae4b0bcddcb61005a78ff
Merged-In: I859514b93705f9ee4f9ae4b0bcddcb61005a78ff
The previous design just set a valid private DNS and checked
whether onCapabilitiesChanged() has received and
NetworkCapabilities#isPrivateDnsBroken is false. It cannot ensure
that the private DNS is working until the network is validated.
So change the design to waiting the network to be validated after
setting a valid private DNS.
Bug: 196769780
Test: atest CtsNetTestCases:ConnectivityManagerTest
Change-Id: I9c173a70e2b81788efa2ecbf928acda0379846da
This test is flaky due to assertNoCallback(). Because this
method expects no any callback received but the wifi network
may update its capabilities during testing and trigger
onCapabilitiesChanged() to cause test failed. Thus, these
callbacks should be ignored in the tests.
Replace the assertNoCallback to assertNoCallbackThat with
callback type specified to deflake tests.
Also align the available callback verification in the test to
avoid confusion.
Fix: 198367703
Test: atest android.net.cts.ConnectivityManagerTest\
--iterations 20
Change-Id: Ifde5e9730823c3b6f32590cc436cc4ba11d2b36e
Instead of crashing when parceling the NetworkInfo object,
crash at the time the bad call is made.
Bug: 145972387
Test: FrameworksNetTests
Change-Id: If8b5fd3d7b800c97211bcd16c9a8c5812708d4ab
Now, VPN will set underlying networks into NetworkCapabilities
directly. So the declaredUnderlyingNetworks can also be set
directly when creating a NetworkAgentInfo.
Bug: 191918368
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I507072d00ae1eb0c391e5261ab93e359b9c4cb5c
Previously, the caller can only know about the transport type of
the underlying network. The information might not be enough if
the device support WiFi STA+STA.
Thus, provide an API for the caller to get the correct underlying
network.
Bug: 191918368
Test: atest FrameworksNetTests:NetworkCapabilitiesTest
Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f
In coverage tests this seems to randomly fail, which suggests
some delay. Have a constant for timeout and increase its value
significantly where it makes no functional difference.
Test: FrameworksNetTests
Change-Id: I035d865f01688daf3bce30c5130ce550fa84b885
"when" is not thread-safe, as it relies on global state to find which
mock was called with the method to mock in its parameters.
This causes flakes where non-test code that interacts with the mock may
be called from another thread between the contents of "when" and the
"when" method another thread, causing UnfinishedStubbingExceptions or
other test errors. In particular
ConnectivityService#getNetworkCapabilitiesInternal was seen to be
wrongly identified as a mocking site for Dependencies.
Replace all usages with doReturn().when(mock).method() syntax, which has
better thread safety since global state is not necessary to tie the
mock, mocked method and return value.
Bug: 195626111
Test: atest ConnectivityServiceTest
Change-Id: I57c5ffb3b3f799fc59c3af4ccb323fb5d6794fad
Currently, there are some test for classes that are not in
connectivity module. If the platform code has a new change
that the test depends on it, then the test cannot verify the
behavior since the change does not exist in module branch.
This change moves the test for non-module classes out of
FrameworksNetTestsLib so that it doesn't go into coverage tests.
Then add those tests to FrameworksNetTests and use a variable
to enable/disable FrameworksNetTests which could minimize merge
conflicts.
Bug: 201265286
Test: make FrameworksNetTests
Change-Id: Ia9669da2c4d79054710e7f4173bc960e3f77f45a
The helper method in CtsNetUtils will not restore the private
dns hostname back if the device private dns mode is not strict
mode. It does not cause function break since the host
configuration is useful only when the private dns mode is in
strict mode. But tests should restore the setting back to its
old state to prevent break other tests or erase setttings.
Test: atest android.net.cts.ConnectivityManagerTest and
check if the private dns server configuration is
changed or not after testing
Change-Id: I7c85ddac7306c7c3eeac84679d96c4cfb11bd875
The registered listeners are added into internal ArrayMap as a
reference but are not removed when the listeners are
unregistered. The actions for registration should be done in
pairs.
Test: atest FrameworksNetTests
Change-Id: Id9e674f5104d1471dd81224b6a271a8a92172e34