summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Burr <wgb@google.com>2024-02-12 17:36:22 +0000
committerWill Burr <wgb@google.com>2024-02-12 18:13:54 +0000
commita89c89d6265d3127aedf9874226ef2fcc9c04b44 (patch)
tree9fbee1ba7ef618ee8b5acb6b08ce2609c713ee38
parent8f097512047a2e9067e2de64a4b48a637063a8bb (diff)
downloadAdServices-a89c89d6265d3127aedf9874226ef2fcc9c04b44.tar.gz
DO NOT MERGE: Fix skipping when SDK sandbox is disabled
Catch the AssertionError thrown when load SDK fails. Currently we attempt to catch an exception which will not cover the AssertionError. Bug: 323185449 Test: atest CtsSdkSandboxWebkitTestCases (on Go device) Change-Id: Id026a967100e03d657e5bfaae8801fb4e245c24e Merged-In: Id026a967100e03d657e5bfaae8801fb4e245c24e
-rw-r--r--sdksandbox/tests/testutils/testscenario/testrule/src/android/app/sdksandbox/testutils/testscenario/SdkSandboxScenarioRule.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/sdksandbox/tests/testutils/testscenario/testrule/src/android/app/sdksandbox/testutils/testscenario/SdkSandboxScenarioRule.java b/sdksandbox/tests/testutils/testscenario/testrule/src/android/app/sdksandbox/testutils/testscenario/SdkSandboxScenarioRule.java
index 85cb3fcffa..45c44c32f7 100644
--- a/sdksandbox/tests/testutils/testscenario/testrule/src/android/app/sdksandbox/testutils/testscenario/SdkSandboxScenarioRule.java
+++ b/sdksandbox/tests/testutils/testscenario/testrule/src/android/app/sdksandbox/testutils/testscenario/SdkSandboxScenarioRule.java
@@ -246,7 +246,8 @@ public class SdkSandboxScenarioRule implements TestRule {
// the getLoadSdkErrorCode call will likely fail as the callback would not have
// resolved yet.
throw e;
- } catch (Exception e) {
+ } catch (AssertionError | Exception e) {
+ // The {@link FakeLoadSdkCallback} will throw an AssertionError if load SDK failed.
Assume.assumeTrue(
"Skipping test because Sdk Sandbox is disabled",
callback.getLoadSdkErrorCode()