aboutsummaryrefslogtreecommitdiff
path: root/robolectric
diff options
context:
space:
mode:
authorGoogler <noreply@google.com>2024-04-09 14:48:10 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-09 14:48:49 -0700
commitd525b84ecbd51c5c280e00af844b000986efd481 (patch)
treede4b3f2903a8b0c48c8d658f99713d32de962201 /robolectric
parentc4ee6e00019aae33fc3bae87b1ece6216282562f (diff)
downloadrobolectric-d525b84ecbd51c5c280e00af844b000986efd481.tar.gz
Add isDataRoamingEnabled to the ShadowTelephonyManager.
This change allows us to toggle isDataRoamingEnabled to match the real TelephonyManger, for the sake of testing. PiperOrigin-RevId: 623287070
Diffstat (limited to 'robolectric')
-rw-r--r--robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
index 460ceca99..6da61d037 100644
--- a/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
@@ -1503,4 +1503,13 @@ public class ShadowTelephonyManagerTest {
assertThat(tm.getSubscriptionId()).isEqualTo(123);
}
+
+ @Test
+ @Config(minSdk = Q)
+ public void setDataRoamingEnabledChangesIsDataRoamingEnabled() {
+ shadowOf(telephonyManager).setDataRoamingEnabled(false);
+ assertThat(telephonyManager.isDataRoamingEnabled()).isFalse();
+ shadowOf(telephonyManager).setDataRoamingEnabled(true);
+ assertThat(telephonyManager.isDataRoamingEnabled()).isTrue();
+ }
}