Make ASNetworkImageNode test wait (#2406)

This commit is contained in:
Adlai Holler 2016-10-17 11:28:48 -07:00 committed by GitHub
parent ae9e128214
commit 925e343e32

View File

@ -37,9 +37,18 @@
- (void)testThatProgressBlockIsSetAndClearedCorrectlyOnVisibility
{
node.URL = [NSURL URLWithString:@"http://imageA"];
// Enter preload range, wait for download start.
[[[downloader expect] andForwardToRealObject] downloadImageWithURL:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY downloadProgress:OCMOCK_ANY completion:OCMOCK_ANY];
[node enterInterfaceState:ASInterfaceStatePreload];
[downloader verifyWithDelay:5];
// Make the node visible.
[[downloader expect] setProgressImageBlock:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0];
[node enterInterfaceState:ASInterfaceStateInHierarchy];
[downloader verify];
// Make the node invisible.
[[downloader expect] setProgressImageBlock:[OCMArg isNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0];
[node exitInterfaceState:ASInterfaceStateInHierarchy];
[downloader verify];