@@ -311,56 +311,20 @@ - (void)testRequestTemporaryFullAccuracyWithInvalidArgument {
311
311
#pragma mark - Test open setting related methods
312
312
313
313
- (void )testOpenAppSettings {
314
- if (@available (iOS 10 , *))
315
- {
316
- id mockApplication = OCMClassMock ([UIApplication class ]);
317
- OCMStub ([mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]
318
- options: @{}
319
- completionHandler: ([OCMArg invokeBlockWithArgs: @(YES ), nil ])]);
320
- OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
321
-
322
-
323
- FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openAppSettings"
324
- arguments: @{}];
325
-
326
- XCTestExpectation *expectation = [self expectationWithDescription: @" openAppSettings should return yes." ];
327
- GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
328
- [plugin handleMethodCall: call result: ^(id _Nullable result) {
329
- XCTAssertTrue (result);
330
- [expectation fulfill ];
331
- }];
332
-
333
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
334
- return ;
335
- }
336
-
337
- if (@available (iOS 8 , *)) {
338
- id mockApplication = OCMClassMock ([UIApplication class ]);
339
- OCMStub ([(UIApplication *)mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]]).andReturn (YES );
340
- OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
341
-
342
-
343
- FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openAppSettings"
344
- arguments: @{}];
345
-
346
- XCTestExpectation *expectation = [self expectationWithDescription: @" openAppSettings should return yes." ];
347
- GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
348
- [plugin handleMethodCall: call result: ^(id _Nullable result) {
349
- XCTAssertTrue (result);
350
- [expectation fulfill ];
351
- }];
352
-
353
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
354
- return ;
355
- }
356
-
314
+ id mockApplication = OCMClassMock ([UIApplication class ]);
315
+ OCMStub ([mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]
316
+ options: @{}
317
+ completionHandler: ([OCMArg invokeBlockWithArgs: @(YES ), nil ])]);
318
+ OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
319
+
320
+
357
321
FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openAppSettings"
358
322
arguments: @{}];
359
323
360
324
XCTestExpectation *expectation = [self expectationWithDescription: @" openAppSettings should return yes." ];
361
325
GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
362
326
[plugin handleMethodCall: call result: ^(id _Nullable result) {
363
- XCTAssertFalse (result);
327
+ XCTAssertTrue (result);
364
328
[expectation fulfill ];
365
329
}];
366
330
@@ -369,61 +333,24 @@ - (void)testOpenAppSettings {
369
333
}
370
334
371
335
- (void )testOpenLocationSettings {
372
- if (@available (iOS 10 , *))
373
- {
374
- id mockApplication = OCMClassMock ([UIApplication class ]);
375
- OCMStub ([mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]
376
- options: @{}
377
- completionHandler: ([OCMArg invokeBlockWithArgs: @(YES ), nil ])]);
378
- OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
379
-
380
-
381
- FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openLocationSettings"
382
- arguments: @{}];
383
-
384
- XCTestExpectation *expectation = [self expectationWithDescription: @" openLocationSettings should return yes." ];
385
- GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
386
- [plugin handleMethodCall: call result: ^(id _Nullable result) {
387
- XCTAssertTrue (result);
388
- [expectation fulfill ];
389
- }];
390
-
391
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
392
- return ;
393
- }
394
-
395
- if (@available (iOS 8 , *)) {
396
- id mockApplication = OCMClassMock ([UIApplication class ]);
397
- OCMStub ([(UIApplication *)mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]]).andReturn (YES );
398
- OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
399
-
400
-
401
- FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openLocationSettings"
402
- arguments: @{}];
403
-
404
- XCTestExpectation *expectation = [self expectationWithDescription: @" openLocationSettings should return yes." ];
405
- GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
406
- [plugin handleMethodCall: call result: ^(id _Nullable result) {
407
- XCTAssertTrue (result);
408
- [expectation fulfill ];
409
- }];
410
-
411
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
412
- return ;
413
- }
414
-
336
+ id mockApplication = OCMClassMock ([UIApplication class ]);
337
+ OCMStub ([mockApplication openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]
338
+ options: @{}
339
+ completionHandler: ([OCMArg invokeBlockWithArgs: @(YES ), nil ])]);
340
+ OCMStub (ClassMethod ([mockApplication sharedApplication ])).andReturn (mockApplication);
341
+
342
+
415
343
FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName: @" openLocationSettings"
416
344
arguments: @{}];
417
345
418
346
XCTestExpectation *expectation = [self expectationWithDescription: @" openLocationSettings should return yes." ];
419
347
GeolocatorPlugin *plugin = [[GeolocatorPlugin alloc ] init ];
420
348
[plugin handleMethodCall: call result: ^(id _Nullable result) {
421
- XCTAssertFalse (result);
349
+ XCTAssertTrue (result);
422
350
[expectation fulfill ];
423
351
}];
424
352
425
353
[self waitForExpectationsWithTimeout: 5.0 handler: nil ];
426
- return ;
427
354
}
428
355
429
356
@end
0 commit comments