20
20
#import < XCTest/XCTest.h>
21
21
22
22
#include < memory>
23
+ #include < vector>
23
24
24
25
#import " Firestore/Source/API/FIRDocumentReference+Internal.h"
25
26
#import " Firestore/Source/API/FSTUserDataConverter.h"
29
30
#import " Firestore/Source/Model/FSTFieldValue.h"
30
31
#import " Firestore/Source/Model/FSTMutation.h"
31
32
#import " Firestore/Source/Model/FSTMutationBatch.h"
32
- #import " Firestore/Source/Remote/FSTRemoteEvent.h"
33
33
#import " Firestore/Source/Remote/FSTRemoteStore.h"
34
34
35
35
#import " Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
40
40
#include " Firestore/core/src/firebase/firestore/model/document_key.h"
41
41
#include " Firestore/core/src/firebase/firestore/model/precondition.h"
42
42
#include " Firestore/core/src/firebase/firestore/remote/datastore.h"
43
+ #include " Firestore/core/src/firebase/firestore/remote/remote_event.h"
43
44
#include " Firestore/core/src/firebase/firestore/util/async_queue.h"
44
45
#include " Firestore/core/src/firebase/firestore/util/executor_libdispatch.h"
45
46
#include " Firestore/core/src/firebase/firestore/util/hard_assert.h"
57
58
using firebase::firestore::model::TargetId;
58
59
using firebase::firestore::remote::Datastore;
59
60
using firebase::firestore::remote::GrpcConnection;
61
+ using firebase::firestore::remote::RemoteEvent;
60
62
using firebase::firestore::util::AsyncQueue;
61
63
using firebase::firestore::util::ExecutorLibdispatch;
62
64
@@ -79,17 +81,17 @@ - (void)expectListenEventWithDescription:(NSString *)description;
79
81
80
82
@property (nonatomic , weak , nullable ) XCTestCase *testCase;
81
83
@property (nonatomic , strong ) NSMutableArray <NSObject *> *writeEvents;
82
- @property (nonatomic , strong ) NSMutableArray <NSObject *> *listenEvents;
83
84
@property (nonatomic , strong ) NSMutableArray <XCTestExpectation *> *writeEventExpectations;
84
85
@property (nonatomic , strong ) NSMutableArray <XCTestExpectation *> *listenEventExpectations;
85
86
@end
86
87
87
- @implementation FSTRemoteStoreEventCapture
88
+ @implementation FSTRemoteStoreEventCapture {
89
+ std::vector<RemoteEvent> _listenEvents;
90
+ }
88
91
89
92
- (instancetype )initWithTestCase : (XCTestCase *_Nullable)testCase {
90
93
if (self = [super init ]) {
91
94
_writeEvents = [NSMutableArray array ];
92
- _listenEvents = [NSMutableArray array ];
93
95
_testCase = testCase;
94
96
_writeEventExpectations = [NSMutableArray array ];
95
97
_listenEventExpectations = [NSMutableArray array ];
@@ -134,8 +136,8 @@ - (DocumentKeySet)remoteKeysForTarget:(TargetId)targetId {
134
136
return DocumentKeySet{};
135
137
}
136
138
137
- - (void )applyRemoteEvent : (FSTRemoteEvent * )remoteEvent {
138
- [ self .listenEvents addObject: remoteEvent] ;
139
+ - (void )applyRemoteEvent : (const RemoteEvent & )remoteEvent {
140
+ _listenEvents. push_back ( remoteEvent) ;
139
141
XCTestExpectation *expectation = [self .listenEventExpectations objectAtIndex: 0 ];
140
142
[self .listenEventExpectations removeObjectAtIndex: 0 ];
141
143
[expectation fulfill ];
0 commit comments