Commit 63a7dac8 authored by Maksym Onufriienko's avatar Maksym Onufriienko Committed by Commit Bot

Moved signin_test_util#SignOutAndClearAccounts to chrome_earl_grey

This change requires for /ios_internal repository(submit only after this cl)
https://chrome-internal-review.googlesource.com/c/chrome/ios_internal/+/1284283

This is part of EG1 to EG2 migration, which involves moving EarlGrey code from
app-side helpers into test code. For GREYAsserts, the policy is to take assert-
containing-helpers, modify them to return NSError* with localizedDescription
containing the assert failure (in the event of a failure), and then assert
on the result of the helper on the test side.

Bug: 922813
Change-Id: I42086810e5efe23139210fa1e198c14665f903bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606248
Commit-Queue: Maksym Onufriienko <monufriienko@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659657}
parent cda9fd5e
......@@ -159,6 +159,13 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// Sets value for content setting.
+ (NSError*)setContentSettings:(ContentSetting)setting WARN_UNUSED_RESULT;
#pragma mark - Sign Utilities
// Signs the user out, clears the known accounts entirely and checks whether
// the accounts were correctly removed from the keychain. Returns nil on
// success, or else an NSError indicating why the operation failed.
+ (NSError*)signOutAndClearAccounts WARN_UNUSED_RESULT;
@end
#endif // IOS_CHROME_TEST_EARL_GREY_CHROME_EARL_GREY_H_
......@@ -26,6 +26,7 @@
#import "ios/chrome/test/app/history_test_util.h" // nogncheck
#include "ios/chrome/test/app/navigation_test_util.h" // nogncheck
#import "ios/chrome/test/app/settings_test_util.h" // nogncheck
#import "ios/chrome/test/app/signin_test_util.h" // nogncheck
#import "ios/chrome/test/app/static_html_view_test_util.h" // nogncheck
#import "ios/chrome/test/app/tab_test_util.h" // nogncheck
#import "ios/web/public/test/earl_grey/js_test_util.h" // nogncheck
......@@ -421,11 +422,23 @@ id ExecuteJavaScript(NSString* javascript,
}
#pragma mark - Settings Utilities
+ (NSError*)setContentSettings:(ContentSetting)setting {
chrome_test_util::SetContentSettingsBlockPopups(setting);
return nil;
}
#pragma mark - Sign Utilities
+ (NSError*)signOutAndClearAccounts {
bool success = chrome_test_util::SignOutAndClearAccounts();
if (!success) {
return testing::NSErrorWithLocalizedDescription(
@"Real accounts couldn't be cleared.");
}
return nil;
}
@end
#endif // defined(CHROME_EARL_GREY_1)
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