diff --git a/QiniuSDKTests/QNAutoZoneTest.m b/QiniuSDKTests/QNAutoZoneTest.m index 5c07fb6e..67643af7 100644 --- a/QiniuSDKTests/QNAutoZoneTest.m +++ b/QiniuSDKTests/QNAutoZoneTest.m @@ -76,15 +76,23 @@ - (void)testClearAutoZoneCache { AGWW_WAIT_WHILE(x == 0, 100.0); XCTAssertEqual(0, c, @"c: %d", c); - QNZonesInfo *info = [autoZone getZonesInfoWithToken:tok]; - XCTAssertTrue(info != nil , @"info is nil"); - XCTAssertTrue(!info.isTemporary , @"info is temporary"); + QNZonesInfo *infoBefore = [autoZone getZonesInfoWithToken:tok]; + XCTAssertTrue(infoBefore != nil , @"info is nil"); + // 清理缓存 [QNAutoZone clearCache]; - info = [autoZone getZonesInfoWithToken:tok]; - XCTAssertTrue(info != nil , @"after clear: info is nil"); - XCTAssertTrue(info.isTemporary , @"after clear: info is not temporary"); + x = 0; + c = 0; + [autoZone preQuery:tok on:^(int code, QNResponseInfo *info, QNUploadRegionRequestMetrics *metrics) { + x = 1; + c = code; + }]; + + QNZonesInfo *infoAfter = [autoZone getZonesInfoWithToken:tok]; + + XCTAssertTrue(infoAfter != nil , @"after clear: info is nil"); + XCTAssertTrue(infoBefore != infoAfter , @"after clear: info is not temporary"); } - (void)testHttp { diff --git a/QiniuSDKTests/QNNetworkStatusTest.m b/QiniuSDKTests/QNNetworkStatusTest.m index 052b74f0..9f09f33e 100644 --- a/QiniuSDKTests/QNNetworkStatusTest.m +++ b/QiniuSDKTests/QNNetworkStatusTest.m @@ -72,12 +72,6 @@ - (void)testNetworkStatusCompare { dispatch_group_leave(group); }); - dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^{ - for (int i=0; i<100000; i++) { - [kQNNetworkStatusManager performSelector:@selector(recoverNetworkStatusFromDisk)]; - } - }); - dispatch_group_wait(group, dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC)); }