summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2021-03-05 05:18:27 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-03-05 05:18:27 +0000
commitfc71616a48edd9d40cb468f3b670d45ea702e2a4 (patch)
tree9b61b98b58a1652518b348bf805dbca6a9862ac5
parent03297aacc6658191c93dc3009951c0da0e79c076 (diff)
parent547c982b975f4e4d3a3f075602ef67544b8c7e26 (diff)
Merge "Fix CaptivePortalTest before R" am: 41dd05fdfb am: 547c982b97
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1618939 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ib5bf1fc2b06fb5339ffd9b43d0eda893a4bbc4bd
-rw-r--r--tests/net/common/java/android/net/CaptivePortalTest.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/net/common/java/android/net/CaptivePortalTest.java b/tests/net/common/java/android/net/CaptivePortalTest.java
index 4cdf6a2a4b36..15d3398d43c0 100644
--- a/tests/net/common/java/android/net/CaptivePortalTest.java
+++ b/tests/net/common/java/android/net/CaptivePortalTest.java
@@ -25,6 +25,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.testutils.DevSdkIgnoreRule;
+import com.android.testutils.DevSdkIgnoreRule.IgnoreAfter;
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
import org.junit.Rule;
@@ -53,6 +54,12 @@ public class CaptivePortalTest {
public void appRequest(final int request) throws RemoteException {
mCode = request;
}
+
+ // This is only @Override on R-
+ public void logEvent(int eventId, String packageName) throws RemoteException {
+ mCode = eventId;
+ mPackageName = packageName;
+ }
}
private interface TestFunctor {
@@ -91,14 +98,24 @@ public class CaptivePortalTest {
assertEquals(result.mCode, CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED);
}
- /**
- * Test testLogEvent is expected to do nothing but shouldn't crash, because the API logEvent
- * has been deprecated.
- */
+ @IgnoreUpTo(Build.VERSION_CODES.R)
@Test
public void testLogEvent() {
+ /**
+ * From S testLogEvent is expected to do nothing but shouldn't crash (the API
+ * logEvent has been deprecated).
+ */
final MyCaptivePortalImpl result = runCaptivePortalTest(c -> c.logEvent(
0,
TEST_PACKAGE_NAME));
}
+
+ @IgnoreAfter(Build.VERSION_CODES.R)
+ @Test
+ public void testLogEvent_UntilR() {
+ final MyCaptivePortalImpl result = runCaptivePortalTest(c -> c.logEvent(
+ 42, TEST_PACKAGE_NAME));
+ assertEquals(result.mCode, 42);
+ assertEquals(result.mPackageName, TEST_PACKAGE_NAME);
+ }
}