[iOS][EG] Rename callback to completion
This patch should have been part of crrev.com/c/2612844. Bug: 1143204, 1146459 Change-Id: I494e6520794936a2f969c18b9d522836ac9365cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613969 Commit-Queue: Eugene But <eugenebut@chromium.org> Auto-Submit: Jérôme Lebel <jlebel@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#841178}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b907026fb2
commit
990ee0968b
ios/chrome/test/earl_grey
@ -244,17 +244,17 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface)
|
||||
NSUUID* uuid = [NSUUID UUID];
|
||||
// Removes all the UI elements.
|
||||
[ChromeTestCaseAppInterface
|
||||
removeInfoBarsAndPresentedStateWithCallbackUUID:uuid];
|
||||
removeInfoBarsAndPresentedStateWithCompletionUUID:uuid];
|
||||
ConditionBlock condition = ^{
|
||||
return [ChromeTestCaseAppInterface isCallbackInvokedWithUUID:uuid];
|
||||
return [ChromeTestCaseAppInterface isCompletionInvokedWithUUID:uuid];
|
||||
};
|
||||
NSString* errorMessage =
|
||||
@"+[ChromeTestCaseAppInterface "
|
||||
@"removeInfoBarsAndPresentedStateWithCallbackUUID:] callback failed";
|
||||
@"removeInfoBarsAndPresentedStateWithCompletionUUID:] completion failed";
|
||||
// Waits until the UI elements are removed.
|
||||
bool callbackInvoked = base::test::ios::WaitUntilConditionOrTimeout(
|
||||
bool completionInvoked = base::test::ios::WaitUntilConditionOrTimeout(
|
||||
base::test::ios::kWaitForUIElementTimeout, condition);
|
||||
GREYAssertTrue(callbackInvoked, errorMessage);
|
||||
GREYAssertTrue(completionInvoked, errorMessage);
|
||||
}
|
||||
|
||||
+ (void)closeAllTabs {
|
||||
|
@ -19,14 +19,15 @@
|
||||
+ (void)resetAuthentication;
|
||||
|
||||
// Removes all infobars and clears any presented state.
|
||||
// See +[ChromeTestCaseAppInterface isCallbackInvokedWithUUID:] to know when
|
||||
// See +[ChromeTestCaseAppInterface isCompletionInvokedWithUUID:] to know when
|
||||
// all views are dismissed.
|
||||
+ (void)removeInfoBarsAndPresentedStateWithCallbackUUID:(NSUUID*)callbackUUID;
|
||||
+ (void)removeInfoBarsAndPresentedStateWithCompletionUUID:
|
||||
(NSUUID*)completionUUID;
|
||||
|
||||
// Returns YES if the callback related to |callbackUUID| has been invoked. Once
|
||||
// this method returns YES, |callbackUUID| is dropped, and a second call will
|
||||
// return NO.
|
||||
+ (BOOL)isCallbackInvokedWithUUID:(NSUUID*)callbackUUID;
|
||||
// Returns YES if the completion related to |completionUUID| has been invoked.
|
||||
// Once this method returns YES, |completionUUID| is dropped, and a second call
|
||||
// will return NO.
|
||||
+ (BOOL)isCompletionInvokedWithUUID:(NSUUID*)completionUUID;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -14,10 +14,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Stores the callback UUIDs when the callback is invoked. The UUIDs can be
|
||||
// checked with +[ChromeTestCaseAppInterface isCallbackInvokedWithUUID:].
|
||||
NSMutableSet* invokedCallbackUUID = nil;
|
||||
|
||||
// Stores the completion UUIDs when the completion is invoked. The UUIDs can be
|
||||
// checked with +[ChromeTestCaseAppInterface isCompletionInvokedWithUUID:].
|
||||
NSMutableSet* invokedCompletionUUID = nil;
|
||||
}
|
||||
|
||||
@implementation ChromeTestCaseAppInterface
|
||||
@ -35,28 +34,29 @@ NSMutableSet* invokedCallbackUUID = nil;
|
||||
chrome_test_util::ResetMockAuthentication();
|
||||
}
|
||||
|
||||
+ (void)removeInfoBarsAndPresentedStateWithCallbackUUID:(NSUUID*)callbackUUID {
|
||||
+ (void)removeInfoBarsAndPresentedStateWithCompletionUUID:
|
||||
(NSUUID*)completionUUID {
|
||||
chrome_test_util::RemoveAllInfoBars();
|
||||
chrome_test_util::ClearPresentedState(^() {
|
||||
if (callbackUUID)
|
||||
[self callbackInvokedWithUUID:callbackUUID];
|
||||
if (completionUUID)
|
||||
[self completionInvokedWithUUID:completionUUID];
|
||||
});
|
||||
}
|
||||
|
||||
+ (BOOL)isCallbackInvokedWithUUID:(NSUUID*)callbackUUID {
|
||||
if (![invokedCallbackUUID containsObject:callbackUUID])
|
||||
+ (BOOL)isCompletionInvokedWithUUID:(NSUUID*)completionUUID {
|
||||
if (![invokedCompletionUUID containsObject:completionUUID])
|
||||
return NO;
|
||||
[invokedCallbackUUID removeObject:callbackUUID];
|
||||
[invokedCompletionUUID removeObject:completionUUID];
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
+ (void)callbackInvokedWithUUID:(NSUUID*)callbackUUID {
|
||||
if (!invokedCallbackUUID)
|
||||
invokedCallbackUUID = [NSMutableSet set];
|
||||
DCHECK(![invokedCallbackUUID containsObject:callbackUUID]);
|
||||
[invokedCallbackUUID addObject:callbackUUID];
|
||||
+ (void)completionInvokedWithUUID:(NSUUID*)completionUUID {
|
||||
if (!invokedCompletionUUID)
|
||||
invokedCompletionUUID = [NSMutableSet set];
|
||||
DCHECK(![invokedCompletionUUID containsObject:completionUUID]);
|
||||
[invokedCompletionUUID addObject:completionUUID];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user