|
19 | 19 | import static com.google.firebase.firestore.testutil.TestUtil.key;
|
20 | 20 | import static org.mockito.Mockito.mock;
|
21 | 21 |
|
22 |
| -import androidx.annotation.Nullable; |
23 | 22 | import com.google.android.gms.tasks.Task;
|
24 | 23 | import com.google.firebase.database.collection.ImmutableSortedSet;
|
25 | 24 | import com.google.firebase.firestore.core.DocumentViewChange;
|
26 | 25 | import com.google.firebase.firestore.core.DocumentViewChange.Type;
|
27 | 26 | import com.google.firebase.firestore.core.ViewSnapshot;
|
28 |
| -import com.google.firebase.firestore.local.QueryData; |
29 | 27 | import com.google.firebase.firestore.model.Document;
|
30 | 28 | import com.google.firebase.firestore.model.DocumentKey;
|
31 | 29 | import com.google.firebase.firestore.model.DocumentSet;
|
32 | 30 | import com.google.firebase.firestore.model.ResourcePath;
|
33 | 31 | import com.google.firebase.firestore.model.value.ObjectValue;
|
34 |
| -import com.google.firebase.firestore.remote.WatchChangeAggregator; |
35 | 32 | import java.util.ArrayList;
|
36 |
| -import java.util.HashMap; |
37 | 33 | import java.util.List;
|
38 | 34 | import java.util.Map;
|
39 | 35 | import org.junit.Assert;
|
@@ -133,41 +129,12 @@ public static QuerySnapshot querySnapshot(
|
133 | 129 | documentChanges,
|
134 | 130 | isFromCache,
|
135 | 131 | mutatedKeys,
|
136 |
| - true, |
| 132 | + /* synced= */ true, |
| 133 | + /* didSyncStateChange= */ true, |
137 | 134 | /* excludesMetadataChanges= */ false);
|
138 | 135 | return new QuerySnapshot(query(path), viewSnapshot, FIRESTORE);
|
139 | 136 | }
|
140 | 137 |
|
141 |
| - /** |
142 |
| - * An implementation of TargetMetadataProvider that provides controlled access to the |
143 |
| - * `TargetMetadataProvider` callbacks. Any target accessed via these callbacks must be registered |
144 |
| - * beforehand via `setSyncedKeys()`. |
145 |
| - */ |
146 |
| - public static class TestTargetMetadataProvider |
147 |
| - implements WatchChangeAggregator.TargetMetadataProvider { |
148 |
| - final Map<Integer, ImmutableSortedSet<DocumentKey>> syncedKeys = new HashMap<>(); |
149 |
| - final Map<Integer, QueryData> queryData = new HashMap<>(); |
150 |
| - |
151 |
| - @Override |
152 |
| - public ImmutableSortedSet<DocumentKey> getRemoteKeysForTarget(int targetId) { |
153 |
| - return syncedKeys.get(targetId) != null |
154 |
| - ? syncedKeys.get(targetId) |
155 |
| - : DocumentKey.emptyKeySet(); |
156 |
| - } |
157 |
| - |
158 |
| - @Nullable |
159 |
| - @Override |
160 |
| - public QueryData getQueryDataForTarget(int targetId) { |
161 |
| - return queryData.get(targetId); |
162 |
| - } |
163 |
| - |
164 |
| - /** Sets or replaces the local state for the provided query data. */ |
165 |
| - public void setSyncedKeys(QueryData queryData, ImmutableSortedSet<DocumentKey> keys) { |
166 |
| - this.queryData.put(queryData.getTargetId(), queryData); |
167 |
| - this.syncedKeys.put(queryData.getTargetId(), keys); |
168 |
| - } |
169 |
| - } |
170 |
| - |
171 | 138 | public static <T> T waitFor(Task<T> task) {
|
172 | 139 | if (!task.isComplete()) {
|
173 | 140 | Robolectric.flushBackgroundThreadScheduler();
|
|
0 commit comments