diff options
author | murgatroid99 <mlumish@google.com> | 2015-08-24 14:40:45 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-08-24 14:40:45 -0700 |
commit | 2e49a355b64e2fec5f00995b8ba2dba1afef9700 (patch) | |
tree | bcd93416f1b1f2a875a9e68678480bb48bc91347 /src/objective-c | |
parent | 81b4fcbe84ad644ddd2ff6c293610415859bec03 (diff) |
Fixed KVO test
Diffstat (limited to 'src/objective-c')
-rw-r--r-- | src/objective-c/tests/GRPCClientTests.m | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m index fa604211e2..09a55e0704 100644 --- a/src/objective-c/tests/GRPCClientTests.m +++ b/src/objective-c/tests/GRPCClientTests.m @@ -79,7 +79,7 @@ static ProtoMethod *kUnaryCallMethod; - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { _callback(keyPath, object, change); - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + [object removeObserver:self forKeyPath:keyPath]; } @end @@ -219,16 +219,16 @@ static ProtoMethod *kUnaryCallMethod; __weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."]; __weak XCTestExpectation *metadata = [self expectationWithDescription:@"Metadata changed."]; - PassthroughObserver *observer = [[PassthroughObserver alloc] initWithCallback:^(NSString *keypath, id object, NSDictionary * change) { - if (keypath == @"responseHeaders") { - [expectation fulfill]; - } - }] - GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress path:kEmptyCallMethod.HTTPPath requestsWriter:[GRXWriter writerWithValue:[NSData data]]]; + PassthroughObserver *observer = [[PassthroughObserver alloc] initWithCallback:^(NSString *keypath, id object, NSDictionary * change) { + if ([keypath isEqual: @"responseHeaders"]) { + [metadata fulfill]; + } + }]; + [call addObserver:observer forKeyPath:@"responseHeaders" options:0 context:NULL]; id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { |