Commit f213ba29 authored by Eric Aleshire's avatar Eric Aleshire Committed by Commit Bot

Fix spelling of CHROME_EG_ASSERT_ON_ERROR to CHROME_EG_ASSERT_NO_ERROR.

Bug: 922813
Change-Id: I4743041c76c56cca59cadc207d400b538db37c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1580592Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: ericale <ericale@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653593}
parent c68bf7d0
......@@ -151,13 +151,13 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
kSelectedTabHistogramName, TabUsageRecorder::IN_MEMORY, 1, failureBlock);
// Evict the tab.
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
GREYAssertTrue(chrome_test_util::IsIncognitoMode(),
@"Failed to switch to incognito mode");
// Switch back to the normal tabs. Should be on tab one.
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
[ChromeEarlGrey waitForWebViewContainingText:kURL1FirstWord];
......@@ -219,11 +219,11 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
// Evict the tab. Create a dummy tab so that switching back to normal mode
// does not trigger a reload immediately.
[ChromeEarlGrey openNewTab];
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
[ChromeEarlGrey waitForIncognitoTabCount:1];
// Switch back to the normal tabs. Should be on tab one.
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
chrome_test_util::SelectTabAtIndexInCurrentMode(0);
[ChromeEarlGrey waitForWebViewContainingText:kURL1FirstWord];
......@@ -258,13 +258,13 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
@"Fail to state tabs as cold start tabs");
// Open two incognito tabs with urls, clearing normal tabs from memory.
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
[ChromeEarlGrey waitForIncognitoTabCount:2];
// Switch back to the normal tabs.
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
[ChromeEarlGrey waitForWebViewContainingText:kURL2FirstWord];
......@@ -314,13 +314,13 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
@"Fail to simulate tab backgrounding.");
// Open incognito and clear normal tabs from memory.
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
GREYAssertTrue(chrome_test_util::IsIncognitoMode(),
@"Failed to switch to incognito mode");
histogramTester.ExpectTotalCount(kEvictedTabReloadTime, 0, failureBlock);
// Switch back to the normal tabs.
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
[ChromeEarlGrey waitForWebViewContainingText:kURL2FirstWord];
......@@ -352,8 +352,8 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
[ChromeEarlGrey closeAllTabsInCurrentMode];
GURL URL = web::test::HttpServer::MakeUrl(kTestUrl1);
NewMainTabWithURL(URL, kURL1FirstWord);
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
[ChromeEarlGrey waitForWebViewContainingText:kURL1FirstWord];
[ChromeEarlGrey waitForMainTabCount:1];
......@@ -386,7 +386,7 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
[ChromeEarlGrey openNewTab];
[ChromeEarlGrey openNewTab];
chrome_test_util::LoadUrl(slowURL);
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
web::test::SetUpHttpServer(std::make_unique<web::DelayedResponseProvider>(
std::make_unique<HtmlResponseProvider>(responses), kSlowURLDelay));
......@@ -438,7 +438,7 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
NewMainTabWithURL(slowURL, "Slow");
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
web::test::SetUpHttpServer(std::make_unique<web::DelayedResponseProvider>(
std::make_unique<HtmlResponseProvider>(responses), kSlowURLDelay));
......@@ -488,8 +488,8 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
};
NewMainTabWithURL(slowURL, responses[slowURL]);
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsMenuPrivacyButton()];
......@@ -518,7 +518,7 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
[ChromeEarlGrey openNewTab];
chrome_test_util::LoadUrl(slowURL);
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
web::test::SetUpHttpServer(std::make_unique<web::DelayedResponseProvider>(
std::make_unique<HtmlResponseProvider>(responses), kSlowURLDelay));
......@@ -608,8 +608,8 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
NSUInteger tabIndex = chrome_test_util::GetMainTabCount() - 1;
[ChromeEarlGrey openNewTab];
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
chrome_test_util::SelectTabAtIndexInCurrentMode(tabIndex);
[ChromeEarlGrey waitForWebViewContainingText:"arrived"];
......@@ -656,8 +656,8 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
[ChromeEarlGrey waitForWebViewContainingText:"Whee"];
NSUInteger tabIndex = chrome_test_util::GetMainTabCount() - 1;
[ChromeEarlGrey openNewTab];
CHROME_EG_ASSERT_ON_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_ON_ERROR(SwitchToNormalMode());
CHROME_EG_ASSERT_NO_ERROR(OpenNewIncognitoTabUsingUIAndEvictMainTabs());
CHROME_EG_ASSERT_NO_ERROR(SwitchToNormalMode());
chrome_test_util::SelectTabAtIndexInCurrentMode(tabIndex);
[ChromeEarlGrey waitForWebViewContainingText:"Whee"];
......
......@@ -200,7 +200,7 @@ void SignOut() {
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
}
} // namespace
......
......@@ -222,7 +222,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
[[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
// Undo the sign-in and dismiss the Sign In screen.
......@@ -232,7 +232,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
performAction:grey_tap()];
// |identity| shouldn't be signed in.
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
}
// Signs in to an account and then taps the Advanced link to go to settings.
......@@ -275,7 +275,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
GREYAssertTrue(sync_service->HasFinishedInitialSetup(),
......
......@@ -97,7 +97,7 @@ void AssertURLIs(const GURL& expectedURL) {
"http://ios/testing/data/http_server_files/two_pages.pdf");
[ChromeEarlGrey loadURL:URL];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Initial y scroll positions are set to make room for the toolbar.
// TODO(crbug.com/618887) Replace use of specific values when API which
......@@ -138,12 +138,12 @@ void AssertURLIs(const GURL& expectedURL) {
selectElementWithMatcher:WebViewScrollView(
chrome_test_util::GetCurrentWebState())]
performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Test that the toolbar is still visible even after attempting to hide it
// on swipe up.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Reenable synchronization.
if (@available(iOS 12, *)) {
......@@ -172,18 +172,18 @@ void AssertURLIs(const GURL& expectedURL) {
// Test that the toolbar is hidden after a user swipes up.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Test that the toolbar is visible after a user swipes down.
[[EarlGrey
selectElementWithMatcher:WebViewScrollView(
chrome_test_util::GetCurrentWebState())]
performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Test that the toolbar is hidden after a user swipes up.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
}
// Tests that link clicks from a chrome:// to chrome:// link result in the
......@@ -227,12 +227,12 @@ void AssertURLIs(const GURL& expectedURL) {
// Scroll to hide the UI.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Test that the toolbar is visible when moving from one chrome:// link to
// another chrome:// link.
GREYAssert(TapWebViewElementWithId("version"), @"Failed to tap \"version\"");
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Tests hiding and showing of the header with a user scroll on a long page.
......@@ -245,16 +245,16 @@ void AssertURLIs(const GURL& expectedURL) {
web::test::SetUpSimpleHttpServer(responses);
[ChromeEarlGrey loadURL:URL];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Simulate a user scroll down.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Simulate a user scroll up.
[[EarlGrey
selectElementWithMatcher:WebViewScrollView(
chrome_test_util::GetCurrentWebState())]
performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Tests that reloading of a page shows the header even if it was not shown
......@@ -275,12 +275,12 @@ void AssertURLIs(const GURL& expectedURL) {
// Hide the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
GREYAssert(TapWebViewElementWithId("link"), @"Failed to tap \"link\"");
// Main test is here: Make sure the header is still visible!
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Test to make sure the header is shown when a Tab opened by the current Tab is
......@@ -316,7 +316,7 @@ void AssertURLIs(const GURL& expectedURL) {
// Hide the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Open new window.
GREYAssert(TapWebViewElementWithId("link1"), @"Failed to tap \"link1\"");
......@@ -329,7 +329,7 @@ void AssertURLIs(const GURL& expectedURL) {
// Hide the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Close the tab by tapping link2.
NSError* error = nil;
......@@ -349,7 +349,7 @@ void AssertURLIs(const GURL& expectedURL) {
// Make sure the toolbar is on the screen.
[ChromeEarlGrey waitForMainTabCount:1];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Tests that the header is shown when a regular page (non-native page) is
......@@ -379,24 +379,24 @@ void AssertURLIs(const GURL& expectedURL) {
[ChromeEarlGrey waitForWebViewContainingText:"link1"];
// Dismiss the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Navigate to the other page.
GREYAssert(TapWebViewElementWithId("link1"), @"Failed to tap \"link1\"");
[ChromeEarlGrey waitForWebViewContainingText:"link2"];
// Make sure toolbar is shown since a new load has started.
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
// Dismiss the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Go back.
GREYAssert(TapWebViewElementWithId("link2"), @"Failed to tap \"link2\"");
// Make sure the toolbar has loaded now that a new page has loaded.
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Tests that the header is shown when a native page is loaded from a page where
......@@ -418,13 +418,13 @@ void AssertURLIs(const GURL& expectedURL) {
// Dismiss the toolbar.
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
// Go back to NTP, which is a native view.
GREYAssert(TapWebViewElementWithId("link"), @"Failed to tap \"link\"");
// Make sure the toolbar is visible now that a new page has loaded.
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
// Tests that the header is shown when loading an error page in a native view
......@@ -445,11 +445,11 @@ void AssertURLIs(const GURL& expectedURL) {
[ChromeEarlGrey loadURL:URL];
HideToolbarUsingUI();
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:NO]);
GREYAssert(TapWebViewElementWithId("link"), @"Failed to tap \"link\"");
AssertURLIs(ErrorPageResponseProvider::GetDnsFailureUrl());
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
}
@end
......@@ -103,14 +103,14 @@ id<GREYMatcher> RequiredSelectorEditorFieldMatcher(int string_id) {
[super setUp];
_profile = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:_profile]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:_profile]);
_creditCard1 = autofill::test::GetCreditCard();
_creditCard1.set_billing_address_id(_profile.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:_creditCard1]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:_creditCard1]);
_creditCard2 = autofill::test::GetCreditCard2();
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:_creditCard2]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:_creditCard2]);
[ChromeEarlGrey
loadURL:web::test::HttpServer::MakeUrl(kPaymentRequestDemoPage)];
......
......@@ -56,7 +56,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
// Tests canMakePayment() when visa is required and user has a visa instrument.
- (void)testCanMakePaymentIsSupported {
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kCanMakePaymentPage)];
......@@ -68,7 +68,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
// Tests canMakePayment() when visa is required, user has a visa instrument, and
// user is in incognito mode.
- (void)testCanMakePaymentIsSupportedInIncognitoMode {
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
// Open an Incognito tab.
[ChromeEarlGreyUI openToolsMenu];
......@@ -119,7 +119,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs();
prefs->SetBoolean(payments::kCanMakePaymentEnabled, false);
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kCanMakePaymentPage)];
......@@ -137,7 +137,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs();
prefs->SetBoolean(payments::kCanMakePaymentEnabled, false);
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
// Open an Incognito tab.
......@@ -203,7 +203,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
waitForWebViewContainingTexts:
{"NotAllowedError", "Not allowed to check whether can make payment"}];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
// Query visa payment method.
......@@ -269,7 +269,7 @@ const char kCanMakePaymentMethodIdentifierPage[] =
waitForWebViewContainingTexts:
{"NotAllowedError", "Not allowed to check whether can make payment"}];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[self addCreditCard:autofill::test::GetCreditCard()]); // visa.
// Query basic-card payment method with "supportedNetworks": ["visa"] in the
......
......@@ -169,11 +169,11 @@ const char kNoShippingPage[] =
// Promise returned by response.complete() with an appropriate response message.
- (void)testOpenAndPay {
autofill::AutofillProfile profile = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:profile]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:profile]);
autofill::CreditCard card = autofill::test::GetCreditCard();
card.set_billing_address_id(profile.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kNoShippingPage)];
......
......@@ -77,7 +77,7 @@ std::unique_ptr<autofill::AutofillProfile> _profile;
[super setUp];
_profile = std::make_unique<autofill::AutofillProfile>(
autofill::test::GetFullProfile());
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:*_profile]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:*_profile]);
// Allow canMakePayment to return a truthful value by default.
PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs();
......@@ -181,7 +181,7 @@ std::unique_ptr<autofill::AutofillProfile> _profile;
// All local cards have "unknown" card type by design.
autofill::CreditCard card = autofill::test::GetCreditCard();
card.set_billing_address_id(_profile->guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kDebitPage)];
......
......@@ -38,22 +38,22 @@ using payments::JourneyLogger;
- (void)addProfiles {
_profile1 = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:_profile1]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:_profile1]);
_profile2 = autofill::test::GetFullProfile2();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:_profile2]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:_profile2]);
}
- (void)addCard1 {
_creditCard1 = autofill::test::GetCreditCard();
_creditCard1.set_billing_address_id(_profile1.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:_creditCard1]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:_creditCard1]);
}
- (void)addCard2 {
_creditCard2 = autofill::test::GetCreditCard2();
_creditCard2.set_billing_address_id(_profile2.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:_creditCard2]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:_creditCard2]);
}
#pragma mark - Tests
......
......@@ -81,13 +81,13 @@ id<GREYMatcher> PaymentMethodCellMatcher(
- (void)addProfile {
_profile = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:_profile]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:_profile]);
}
- (void)addLocalCard {
_localCard = autofill::test::GetCreditCard(); // Visa.
_localCard.set_billing_address_id(_profile.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:_localCard]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:_localCard]);
}
- (void)addServerCardWithType:(autofill::CreditCard::CardType)cardType {
......
......@@ -63,10 +63,10 @@ const char kRequestEmailPage[] =
- (void)testPaymentResponseNoShipping {
// Create a billing address and a card that uses it.
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kNoShippingPage)];
......@@ -124,16 +124,16 @@ const char kRequestEmailPage[] =
- (void)testPaymentResponseFreeShipping {
// Create a billing address and a card that uses it.
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
// Create a shipping address with a higher frecency score, so that it is
// selected as the default shipping address.
autofill::AutofillProfile shippingAddress = autofill::test::GetFullProfile2();
shippingAddress.set_use_count(2000);
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:shippingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:shippingAddress]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFreeShippingPage)];
......@@ -183,11 +183,11 @@ const char kRequestEmailPage[] =
- (void)testPaymentResponseAllContactDetails {
// Create a billing address and a card that uses it.
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kContactDetailsPage)];
......@@ -219,11 +219,11 @@ const char kRequestEmailPage[] =
- (void)testPaymentResponseOneContactDetail {
// Create a billing address and a card that uses it.
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kRequestEmailPage)];
......
......@@ -50,11 +50,11 @@ id<GREYMatcher> PriceCellMatcher(NSString* accessibilityLabel) {
[super setUp];
autofill::AutofillProfile profile = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:profile]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:profile]);
autofill::CreditCard localCard = autofill::test::GetCreditCard(); // Visa.
localCard.set_billing_address_id(profile.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:localCard]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:localCard]);
}
#pragma mark - Tests
......
......@@ -59,10 +59,10 @@ const char kContactDetailsFreeShippingPage[] =
// Sets up a credit card with an associated billing address.
- (void)setUpCreditCard {
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
}
// Completes the Payment Request.
......@@ -96,11 +96,11 @@ const char kContactDetailsFreeShippingPage[] =
// Setup a credit card with an associated billing address.
autofill::AutofillProfile billingAddress = autofill::test::GetFullProfile();
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:billingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:billingAddress]);
autofill::CreditCard card = autofill::test::GetCreditCard(); // visa
card.set_billing_address_id(billingAddress.guid());
CHROME_EG_ASSERT_ON_ERROR([self addCreditCard:card]);
CHROME_EG_ASSERT_NO_ERROR([self addCreditCard:card]);
// Check that the initial use stats were set correctly.
autofill::CreditCard* initialCard =
......@@ -143,7 +143,7 @@ const char kContactDetailsFreeShippingPage[] =
// selected as the default shipping address.
autofill::AutofillProfile shippingAddress = autofill::test::GetFullProfile2();
shippingAddress.set_use_count(3);
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:shippingAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:shippingAddress]);
// Check that the initial use stats were set correctly.
autofill::AutofillProfile* initialShipping =
......@@ -175,7 +175,7 @@ const char kContactDetailsFreeShippingPage[] =
// selected as the default shipping address.
autofill::AutofillProfile contactAddress = autofill::test::GetFullProfile2();
contactAddress.set_use_count(3);
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:contactAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:contactAddress]);
// Check that the initial use stats were set correctly.
autofill::AutofillProfile* initialContact =
......@@ -207,7 +207,7 @@ const char kContactDetailsFreeShippingPage[] =
// the default shipping and contact address.
autofill::AutofillProfile multiAddress = autofill::test::GetFullProfile2();
multiAddress.set_use_count(3);
CHROME_EG_ASSERT_ON_ERROR([self addAutofillProfile:multiAddress]);
CHROME_EG_ASSERT_NO_ERROR([self addAutofillProfile:multiAddress]);
// Check that the initial use stats were set correctly.
autofill::AutofillProfile* initialAddress =
......
......@@ -79,7 +79,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -105,7 +105,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -138,7 +138,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
grey_accessibilityLabel(identity2.userEmail),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_nil()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......@@ -178,7 +178,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
grey_accessibilityLabel(identity2.userEmail),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_nil()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......@@ -205,7 +205,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Check that the user is signed out and the Main Settings screen is shown.
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -234,7 +234,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:chrome_test_util::
SettingsAccountsCollectionView()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......
......@@ -63,7 +63,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in.
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
......@@ -84,7 +84,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in.
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
......
......@@ -87,7 +87,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
[SigninEarlGreyUI signinWithIdentity:identity];
// Check |identity| is signed-in.
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
}
......@@ -123,7 +123,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......@@ -163,7 +163,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......@@ -194,7 +194,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
SetEarlGreySynchronizationEnabled(YES);
[SigninEarlGreyUI confirmSigninConfirmationDialog];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:managed_identity]);
// Switch Sync account to |identity|.
......@@ -211,7 +211,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON);
SetEarlGreySynchronizationEnabled(YES);
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
......@@ -246,7 +246,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
performAction:grey_tap()];
// Check that there is no signed in user.
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
}
// Tests that signing out of a managed account from the Settings works
......@@ -269,7 +269,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
SetEarlGreySynchronizationEnabled(YES);
[SigninEarlGreyUI confirmSigninConfirmationDialog];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
// Go to Accounts Settings and tap the sign out button.
......@@ -290,7 +290,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
performAction:grey_tap()];
// Check that there is no signed in user.
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
}
// Tests that signing in, tapping the Settings link on the confirmation screen
......@@ -323,7 +323,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
IDS_IOS_SETTINGS_TITLE);
[[EarlGrey selectElementWithMatcher:settings_matcher]
assertWithMatcher:grey_notVisible()];
CHROME_EG_ASSERT_ON_ERROR(
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
}
......@@ -436,7 +436,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
onElementWithMatcher:chrome_test_util::SettingsAccountsCollectionView()]
performAction:grey_tap()];
TapButtonWithLabelId(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[[EarlGrey selectElementWithMatcher:SecondarySignInButton()]
performAction:grey_tap()];
[SigninEarlGreyUI selectIdentityWithEmail:identity1.userEmail];
......@@ -461,7 +461,7 @@ void WaitForMatcher(id<GREYMatcher> matcher) {
TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_ON_ERROR([SigninEarlGreyUtils checkSignedOut]);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
}
// Opens the sign in screen from the bookmarks and then cancel it by tapping on
......
......@@ -197,7 +197,7 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider {
[[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
infinitePendingProvider->Abort();
}
......@@ -237,7 +237,7 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider {
[[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGreyUI waitForToolbarVisible:YES]);
infinitePendingProvider->Abort();
}
......
......@@ -10,9 +10,9 @@
// Wraps an expression that returns an NSError*, asserting if an error is
// returned. Used in EG test code to assert if app helpers fail. For example:
// CHROME_EG_ASSERT_ON_ERROR(helperReturningNSError());
// CHROME_EG_ASSERT_ON_ERROR([ChromeEarlGrey helperReturningNSError]);
#define CHROME_EG_ASSERT_ON_ERROR(expression) \
// CHROME_EG_ASSERT_NO_ERROR(helperReturningNSError());
// CHROME_EG_ASSERT_NO_ERROR([ChromeEarlGrey helperReturningNSError]);
#define CHROME_EG_ASSERT_NO_ERROR(expression) \
{ \
NSError* error = expression; \
GREYAssert(error == nil || [error isKindOfClass:[NSError class]], \
......
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