Commit b593838f authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[iOS] Improve log statement when waitForMainTabCount fails.

Makes waitForMainTabCount: print the actual tab count when it fails.

Bug: none
Change-Id: I63e3b26b33c0cede5c8bec72b4f35b738314fa6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942341
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727458}
parent ff041a41
......@@ -427,19 +427,25 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
}
- (void)waitForMainTabCount:(NSUInteger)count {
NSString* errorString = [NSString
stringWithFormat:@"Failed waiting for main tab count to become %" PRIuNS,
count];
__block NSUInteger actualCount = [ChromeEarlGreyAppInterface mainTabCount];
NSString* conditionName = [NSString
stringWithFormat:@"Waiting for main tab count to become %" PRIuNS, count];
// Allow the UI to become idle, in case any tabs are being opened or closed.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
GREYCondition* tabCountCheck = [GREYCondition
conditionWithName:errorString
conditionWithName:conditionName
block:^{
return [ChromeEarlGreyAppInterface mainTabCount] == count;
actualCount = [ChromeEarlGreyAppInterface mainTabCount];
return actualCount == count;
}];
bool tabCountEqual = [tabCountCheck waitWithTimeout:kWaitForUIElementTimeout];
NSString* errorString = [NSString
stringWithFormat:@"Failed waiting for main tab count to become %" PRIuNS
"; actual count: %" PRIuNS,
count, actualCount];
EG_TEST_HELPER_ASSERT_TRUE(tabCountEqual, errorString);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment