diff options
author | Samiul Islam <samiul@google.com> | 2022-08-26 13:35:25 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-08-26 13:35:25 +0000 |
commit | ffe0d5f31006d378b9e19347bac988f7825f8807 (patch) | |
tree | cff8bda6db3e221eee39ab5c9588dd8b7a5efea3 /sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java | |
parent | 825986aaca2fbeca2546f480925ea4443603736e (diff) | |
parent | d2ed09aa6ea14804cbe5fd12583be9ede51b3280 (diff) | |
download | AdServices-ffe0d5f31006d378b9e19347bac988f7825f8807.tar.gz |
Merge changes from topics "presubmit-am-3267dfb6a3774de3a8d02d2f98d3babf", "presubmit-am-cc616a505da446e4afe85a4490678d8f" into tm-mainline-prod
* changes:
Add API for removing keys from pool of keys being synced
Reduce the scope of ISharedPreferencesSyncCallback
Diffstat (limited to 'sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java')
-rw-r--r-- | sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java b/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java index 1ad3a034ea..6d0022ba7d 100644 --- a/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java +++ b/sdksandbox/tests/unittest/src/com/android/sdksandbox/SdkSandboxTest.java @@ -22,7 +22,6 @@ import android.app.sdksandbox.LoadSdkException; 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; @@ -333,7 +332,7 @@ public class SdkSandboxTest { @Test public void testSyncDataFromClient_StoresInClientSharedPreference() throws Exception { - mService.syncDataFromClient(TEST_UPDATE, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(TEST_UPDATE); // Verify that ClientSharedPreference contains the synced data SharedPreferences pref = getClientSharedPreference(); @@ -362,7 +361,7 @@ public class SdkSandboxTest { new SharedPreferencesKey( "arrayList", SharedPreferencesKey.KEY_TYPE_STRING_SET)); final SharedPreferencesUpdate update = new SharedPreferencesUpdate(keysToSync, bundle); - mService.syncDataFromClient(update, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(update); // Verify that ClientSharedPreference contains the synced data SharedPreferences pref = getClientSharedPreference(); @@ -379,13 +378,13 @@ public class SdkSandboxTest { @Test public void testSyncDataFromClient_KeyCanBeUpdated() throws Exception { // Preload some data - mService.syncDataFromClient(TEST_UPDATE, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(TEST_UPDATE); // Now send in a new update final Bundle newData = getBundleFromMap(Map.of(KEY_TO_UPDATE, "update")); final SharedPreferencesUpdate newUpdate = new SharedPreferencesUpdate(List.of(KEY_WITH_TYPE_TO_UPDATE), newData); - mService.syncDataFromClient(newUpdate, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(newUpdate); // Verify that ClientSharedPreference contains the synced data SharedPreferences pref = getClientSharedPreference(); @@ -396,12 +395,12 @@ public class SdkSandboxTest { @Test public void testSyncDataFromClient_KeyCanBeRemoved() throws Exception { // Preload some data - mService.syncDataFromClient(TEST_UPDATE, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(TEST_UPDATE); // Now send in a new update final SharedPreferencesUpdate newUpdate = new SharedPreferencesUpdate(TEST_UPDATE.getKeysInUpdate(), new Bundle()); - mService.syncDataFromClient(newUpdate, new FakeSharedPreferencesSyncCallback()); + mService.syncDataFromClient(newUpdate); // Verify that ClientSharedPreference contains the synced data SharedPreferences pref = getClientSharedPreference(); @@ -409,16 +408,6 @@ public class SdkSandboxTest { } @Test - public void testSyncDataFromClient_CallbackIsCalled() throws Exception { - // Preload some data - final FakeSharedPreferencesSyncCallback callback = new FakeSharedPreferencesSyncCallback(); - mService.syncDataFromClient(TEST_UPDATE, callback); - - // Verify that ClientSharedPreference contains the synced data - assertThat(callback.isSuccessful()).isTrue(); - } - - @Test public void testLatencyMetrics_loadSdk_success() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final RemoteCode mRemoteCode = new RemoteCode(latch); |