diff options
author | Shiwangi Shah <shiwangishah@google.com> | 2022-08-15 11:34:28 +0000 |
---|---|---|
committer | Shiwangi Shah <shiwangishah@google.com> | 2022-08-24 10:56:06 +0000 |
commit | 534b0cd005f195b15ee566aea6ef77667d77f4cb (patch) | |
tree | 24d3119ae81d0f8eb245c639878e7b170b9fdc79 /sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java | |
parent | 3062c23ce9c4d4d4980bd98f682ed30752e3df9d (diff) | |
download | AdServices-534b0cd005f195b15ee566aea6ef77667d77f4cb.tar.gz |
Add SdkSandboxController
An instance of this controller is attached to the SandboxedSdkProvider
when it is being created.
The controller will have other APIs to interact with the sandbox and
support sdk to sdk communication within the sandbox.
Bug: b/237375522
Test: atest. E2E test will be added later as part of b/240671642
Change-Id: I64039e4b6102c5740203274cc535ec25fb477928
Diffstat (limited to 'sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java')
-rw-r--r-- | sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java b/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java index d26907a3bd..4812515bd5 100644 --- a/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java +++ b/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java @@ -23,6 +23,7 @@ import android.app.sdksandbox.SandboxedSdk; import android.app.sdksandbox.SharedPreferencesKey; import android.app.sdksandbox.SharedPreferencesUpdate; import android.app.sdksandbox.testutils.FakeSharedPreferencesSyncCallback; +import android.app.sdksandbox.testutils.StubSdkToServiceLink; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; @@ -134,7 +135,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue(); assertThat(mRemoteCode.mSuccessful).isTrue(); } @@ -156,7 +158,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode1, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch1.await(1, TimeUnit.MINUTES)).isTrue(); assertThat(mRemoteCode1.mSuccessful).isTrue(); mService.loadSdk( @@ -169,7 +172,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode2, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch2.await(1, TimeUnit.MINUTES)).isTrue(); assertThat(mRemoteCode2.mSuccessful).isFalse(); assertThat(mRemoteCode2.mErrorCode) @@ -182,6 +186,7 @@ public class SdkSandboxTest { RemoteCode mRemoteCode1 = new RemoteCode(latch1); CountDownLatch latch2 = new CountDownLatch(1); RemoteCode mRemoteCode2 = new RemoteCode(latch2); + StubSdkToServiceLink sdkToServiceLink = new StubSdkToServiceLink(); mService.loadSdk( CLIENT_PACKAGE_NAME, new Binder(), @@ -192,7 +197,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode1, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + sdkToServiceLink); mService.loadSdk( CLIENT_PACKAGE_NAME, new Binder(), @@ -203,7 +209,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode2, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + sdkToServiceLink); assertThat(latch1.await(1, TimeUnit.MINUTES)).isTrue(); assertThat(mRemoteCode1.mSuccessful).isTrue(); assertThat(latch2.await(1, TimeUnit.MINUTES)).isTrue(); @@ -224,7 +231,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue(); CountDownLatch surfaceLatch = new CountDownLatch(1); @@ -258,7 +266,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue(); CountDownLatch surfaceLatch = new CountDownLatch(1); @@ -309,7 +318,8 @@ public class SdkSandboxTest { null, new Bundle(), new RemoteCode(new CountDownLatch(1)), - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); final StringWriter stringWriter = new StringWriter(); mService.dump(new FileDescriptor(), new PrintWriter(stringWriter), new String[0]); @@ -431,7 +441,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue(); assertThat(mRemoteCode.mSandboxLatencyInfo.getLatencySystemServerToSandbox()) .isEqualTo( @@ -478,7 +489,8 @@ public class SdkSandboxTest { null, new Bundle(), mRemoteCode, - SANDBOX_LATENCY_INFO); + SANDBOX_LATENCY_INFO, + new StubSdkToServiceLink()); assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue(); CountDownLatch surfaceLatch = new CountDownLatch(1); |