File tree Expand file tree Collapse file tree 5 files changed +13
-3
lines changed Expand file tree Collapse file tree 5 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ @interface FIRStorage () {
43
43
// / Stored Auth reference, if it exists. This needs to be stored for `copyWithZone:`.
44
44
id <FIRAuthInterop> _Nullable _auth;
45
45
id <FIRAppCheckInterop> _Nullable _appCheck;
46
+ BOOL _usesEmulator;
46
47
NSTimeInterval _maxUploadRetryTime;
47
48
NSTimeInterval _maxDownloadRetryTime;
48
49
NSTimeInterval _maxOperationRetryTime;
@@ -333,6 +334,7 @@ - (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port {
333
334
@" reference or trying to load data." ];
334
335
}
335
336
337
+ _usesEmulator = YES ;
336
338
_scheme = @" http" ;
337
339
_host = host;
338
340
_port = @(port);
@@ -360,6 +362,7 @@ - (void)ensureConfigured {
360
362
bucket: _storageBucket
361
363
auth: _auth
362
364
appCheck: _appCheck];
365
+ _fetcherServiceForApp.allowLocalhostRequest = _usesEmulator;
363
366
}
364
367
}
365
368
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ - (void)testSuccessfulFetchWithEmulator {
108
108
[self expectationWithDescription: @" testSuccessfulFetchWithEmulator" ];
109
109
110
110
[self .storage useEmulatorWithHost: @" localhost" port: 8080 ];
111
+ self.fetcherService .allowLocalhostRequest = YES ;
111
112
self.fetcherService .testBlock =
112
113
[FIRStorageTestHelpers successBlockWithURL: @" http://localhost:8080/v0/b/bucket/o/object" ];
113
114
@@ -117,7 +118,7 @@ - (void)testSuccessfulFetchWithEmulator {
117
118
fetcherService: self .fetcherService
118
119
dispatchQueue: self .dispatchQueue
119
120
completion: ^(NSError *error) {
120
- XCTAssertEqual (error, nil );
121
+ XCTAssertNil (error);
121
122
[expectation fulfill ];
122
123
}];
123
124
[task enqueue ];
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ - (void)testSuccessfulFetchWithEmulator {
116
116
[self expectationWithDescription: @" testSuccessfulFetchWithEmulator" ];
117
117
118
118
[self .storage useEmulatorWithHost: @" localhost" port: 8080 ];
119
+ self.fetcherService .allowLocalhostRequest = YES ;
119
120
self.fetcherService .testBlock =
120
121
[FIRStorageTestHelpers successBlockWithURL: @" http://localhost:8080/v0/b/bucket/o/object" ];
121
122
@@ -126,6 +127,7 @@ - (void)testSuccessfulFetchWithEmulator {
126
127
fetcherService: self .fetcherService
127
128
dispatchQueue: self .dispatchQueue
128
129
completion: ^(FIRStorageMetadata *metadata, NSError *error) {
130
+ XCTAssertNil (error);
129
131
[expectation fulfill ];
130
132
}];
131
133
[task enqueue ];
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ - (void)testDefaultListWithEmulator {
140
140
XCTestExpectation *expectation = [self expectationWithDescription: @" testDefaultListWithEmulator" ];
141
141
142
142
[self .storage useEmulatorWithHost: @" localhost" port: 8080 ];
143
+ self.fetcherService .allowLocalhostRequest = YES ;
143
144
self.fetcherService .testBlock = [FIRStorageTestHelpers
144
145
successBlockWithURL: @" http://localhost:8080/v0/b/bucket/o?prefix=object/&delimiter=/" ];
145
146
@@ -151,6 +152,7 @@ - (void)testDefaultListWithEmulator {
151
152
pageSize: nil
152
153
previousPageToken: nil
153
154
completion: ^(FIRStorageListResult *result, NSError *error) {
155
+ XCTAssertNil (error);
154
156
[expectation fulfill ];
155
157
}];
156
158
[task enqueue ];
Original file line number Diff line number Diff line change @@ -94,8 +94,10 @@ + (GTMSessionFetcherTestBlock)successBlockWithMetadata:(nullable FIRStorageMetad
94
94
return [FIRStorageTestHelpers blockForData: data URL: nil statusCode: 200 ];
95
95
}
96
96
97
- + (GTMSessionFetcherTestBlock)successBlockWithURL : (NSString *)url ;
98
- { return [FIRStorageTestHelpers blockForData: nil URL: url statusCode: 200 ]; }
97
+ + (GTMSessionFetcherTestBlock)successBlockWithURL : (NSString *)url {
98
+ NSData *data = [@" {}" dataUsingEncoding: NSUTF8StringEncoding];
99
+ return [FIRStorageTestHelpers blockForData: data URL: url statusCode: 200 ];
100
+ }
99
101
100
102
+ (GTMSessionFetcherTestBlock)unauthenticatedBlock {
101
103
NSData *data = [kUnauthenticatedResponseString dataUsingEncoding: NSUTF8StringEncoding];
You can’t perform that action at this time.
0 commit comments