Commit b300dc5f authored by Eugene But's avatar Eugene But Committed by Commit Bot

Remove CHROME_EG_ASSERT_NO_ERROR macro usage in some eg test helpers.

CHROME_EG_ASSERT_NO_ERROR is unnecessary anymore, because helpes can
assert with correct file name and line number.

Bug: 963613
Change-Id: I04d3a567ef8e8c4aa496dd5b2b6e716273f1a40f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1653731
Commit-Queue: Eugene But <eugenebut@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668599}
parent fa6f36cf
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import "ios/chrome/browser/autofill/automation/automation_action.h" #import "ios/chrome/browser/autofill/automation/automation_action.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import <EarlGrey/EarlGrey.h>
#include "base/guid.h" #include "base/guid.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
...@@ -215,8 +214,7 @@ ...@@ -215,8 +214,7 @@
web::WebState* web_state = chrome_test_util::GetCurrentWebState(); web::WebState* web_state = chrome_test_util::GetCurrentWebState();
// Wait for the element to be visible on the page. // Wait for the element to be visible on the page.
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey waitForWebStateContainingElement:selector];
[ChromeEarlGrey waitForWebStateContainingElement:selector]);
// Potentially scroll into view if below the fold. // Potentially scroll into view if below the fold.
[[EarlGrey selectElementWithMatcher:web::WebViewInWebState(web_state)] [[EarlGrey selectElementWithMatcher:web::WebViewInWebState(web_state)]
...@@ -440,8 +438,7 @@ ...@@ -440,8 +438,7 @@
} }
// Wait for the element to be visible on the page. // Wait for the element to be visible on the page.
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey waitForWebStateContainingElement:selector];
[ChromeEarlGrey waitForWebStateContainingElement:selector]);
NSString* expectedType = base::SysUTF8ToNSString([self NSString* expectedType = base::SysUTF8ToNSString([self
getStringFromDictionaryWithKey:"expectedAutofillType" getStringFromDictionaryWithKey:"expectedAutofillType"
...@@ -498,8 +495,7 @@ ...@@ -498,8 +495,7 @@
} }
// Wait for the element to be visible on the page. // Wait for the element to be visible on the page.
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey waitForWebStateContainingElement:selector];
[ChromeEarlGrey waitForWebStateContainingElement:selector]);
int selectedIndex = [self getIntFromDictionaryWithKey:"index" error:&error]; int selectedIndex = [self getIntFromDictionaryWithKey:"index" error:&error];
if (error) { if (error) {
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "ios/chrome/browser/metrics/tab_usage_recorder_test_util.h" #include "ios/chrome/browser/metrics/tab_usage_recorder_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import <EarlGrey/EarlGrey.h> #import <EarlGrey/EarlGrey.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
...@@ -65,8 +64,7 @@ NSError* OpenNewIncognitoTabUsingUIAndEvictMainTabs() { ...@@ -65,8 +64,7 @@ NSError* OpenNewIncognitoTabUsingUIAndEvictMainTabs() {
grey_accessibilityID(kToolsMenuNewIncognitoTabId); grey_accessibilityID(kToolsMenuNewIncognitoTabId);
[[EarlGrey selectElementWithMatcher:new_incognito_tab_button_matcher] [[EarlGrey selectElementWithMatcher:new_incognito_tab_button_matcher]
performAction:grey_tap()]; performAction:grey_tap()];
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey waitForIncognitoTabCount:(nb_incognito_tab + 1)];
[ChromeEarlGrey waitForIncognitoTabCount:(nb_incognito_tab + 1)]);
ConditionBlock condition = ^bool { ConditionBlock condition = ^bool {
return [ChromeEarlGrey isIncognitoMode]; return [ChromeEarlGrey isIncognitoMode];
}; };
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
#import "ios/chrome/browser/ui/payments/payment_request_egtest_base.h" #import "ios/chrome/browser/ui/payments/payment_request_egtest_base.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import <EarlGrey/EarlGrey.h> #import <EarlGrey/EarlGrey.h>
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
#include "ios/chrome/browser/payments/ios_payment_request_cache_factory.h" #include "ios/chrome/browser/payments/ios_payment_request_cache_factory.h"
#import "ios/chrome/test/app/chrome_test_util.h" #import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/testing/nserror_util.h" #import "ios/testing/nserror_util.h"
#import "ios/web/public/test/http_server/http_server.h" #import "ios/web/public/test/http_server/http_server.h"
...@@ -130,8 +128,7 @@ const NSTimeInterval kPDMMaxDelaySeconds = 10.0; ...@@ -130,8 +128,7 @@ const NSTimeInterval kPDMMaxDelaySeconds = 10.0;
- (void)waitForWebViewContainingTexts:(const std::vector<std::string>&)texts { - (void)waitForWebViewContainingTexts:(const std::vector<std::string>&)texts {
for (const std::string& text : texts) for (const std::string& text : texts)
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey waitForWebStateContainingText:text];
[ChromeEarlGrey waitForWebStateContainingText:text]);
} }
- (autofill::PersonalDataManager*)personalDataManager { - (autofill::PersonalDataManager*)personalDataManager {
...@@ -141,8 +138,11 @@ const NSTimeInterval kPDMMaxDelaySeconds = 10.0; ...@@ -141,8 +138,11 @@ const NSTimeInterval kPDMMaxDelaySeconds = 10.0;
- (void)loadTestPage:(const std::string&)page { - (void)loadTestPage:(const std::string&)page {
std::string fullPath = base::StringPrintf( std::string fullPath = base::StringPrintf(
"https://components/test/data/payments/%s", page.c_str()); "https://components/test/data/payments/%s", page.c_str());
CHROME_EG_ASSERT_NO_ERROR( [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(fullPath)];
[ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(fullPath)]); // TODO(crbug.com/973440): Tests immediately tap on page elements without
// waiting for page to render. -drainUntilIdle call is incorrect (but
// functional) way to wait for page content.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
} }
- (void)payWithCreditCardUsingCVC:(NSString*)cvc { - (void)payWithCreditCardUsingCVC:(NSString*)cvc {
......
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