You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: remove deprecated wifi management from tests (#2044)
The use of `WifiManager`'s `setWifiEnabled(...)` was originally added to
this code base with the intention of toggling on/off connectivity, to
test offline scenarios. From the beginning, this usage was flawed. The
Android emulator will happily continue to serve traffic through a fake
cellular connection. So, unless you pre-arrange a device to not have any
other source of connetivity than WiFi, the call to `setWifiEnabled(...)`
is useless.
Worse, as of API 29, this method is officially deprecated. Oh well.
As a replacement, use the UIAutomator-based `InternetConnectivity`
utility that had recently been added to this codebase under
`-testutils`. This utility works by clicking the airplane mode button
in the device's settings drop-down.
This change removes the use of a deprecated API, and also improves the
correctness of the offline tests. One that had been `@Ignore`d is
re-enabled.
This commit includes assorted code quality fixes in the effected files,
as well.
Copy file name to clipboardExpand all lines: aws-android-sdk-mobile-client/src/androidTest/java/com/amazonaws/mobile/client/AWSMobileClientOfflineTest.java
Copy file name to clipboardExpand all lines: aws-android-sdk-mobile-client/src/androidTest/java/com/amazonaws/mobile/client/AWSMobileClientTestBase.java
+1-7Lines changed: 1 addition & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,6 @@
18
18
packagecom.amazonaws.mobile.client;
19
19
20
20
importandroid.content.Context;
21
-
importandroid.net.wifi.WifiManager;
22
21
importandroidx.test.core.app.ApplicationProvider;
23
22
importandroid.util.Base64;
24
23
@@ -48,11 +47,6 @@ public static JSONObject getPackageConfigure() {
0 commit comments