Commit 6163e501 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Revert "Add AX ID for Cancel and Done button on Translate Language Picker."

This reverts commit b9e3aebd.

Reason for revert: I think this is breaking TranslateTestCase.testLanguageDetectionInfobar. I cannot reproduce the error locally.

Original change's description:
> Add AX ID for Cancel and Done button on Translate Language Picker.
> 
> Currently, the test uses the following matchers to find the cancel and
> done button on language picker:
> 
> grey_allOf(chrome_test_util::ButtonWithAccessibilityLabel(@"Cancel"),
>                     grey_userInteractionEnabled(), nil);
> 
> This is not bullet proof and may break any time, and this CL fixes the
> issue by adding AX ID to both the cancel and done buttons.
> 
> Bug: 750344
> Change-Id: I4fda45961b684b877adf29a5bf0fee6e03f1ba8d
> Reviewed-on: https://chromium-review.googlesource.com/594831
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#490840}

TBR=eugenebut@chromium.org,liaoyuke@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 750344
Change-Id: Ibb4f68af8e0c502000d063d6b19ff185fc1b1a42
Reviewed-on: https://chromium-review.googlesource.com/597627Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491327}
parent ad18a3e1
...@@ -7,12 +7,6 @@ ...@@ -7,12 +7,6 @@
#include "ios/chrome/browser/infobars/infobar_controller.h" #include "ios/chrome/browser/infobars/infobar_controller.h"
// The accessibility identifier of the cancel button on language picker view.
extern NSString* const kLanguagePickerCancelButtonId;
// The accessibility identifier of the done button on language picker view.
extern NSString* const kLanguagePickerDoneButtonId;
@interface BeforeTranslateInfoBarController : InfoBarController @interface BeforeTranslateInfoBarController : InfoBarController
@end @end
......
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
NSString* const kLanguagePickerCancelButtonId = @"LanguagePickerCancelButton";
NSString* const kLanguagePickerDoneButtonId = @"LanguagePickerDoneButton";
namespace { namespace {
CGFloat kNavigationBarHeight = 44; CGFloat kNavigationBarHeight = 44;
...@@ -305,12 +302,10 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; ...@@ -305,12 +302,10 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
initWithBarButtonSystemItem:UIBarButtonSystemItemDone initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self target:self
action:@selector(languageSelectionDone)]; action:@selector(languageSelectionDone)];
[doneButton setAccessibilityIdentifier:kLanguagePickerDoneButtonId];
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self target:self
action:@selector(dismissLanguageSelectionView)]; action:@selector(dismissLanguageSelectionView)];
[cancelButton setAccessibilityIdentifier:kLanguagePickerCancelButtonId];
UINavigationItem* item = [[UINavigationItem alloc] initWithTitle:@""]; UINavigationItem* item = [[UINavigationItem alloc] initWithTitle:@""];
[item setRightBarButtonItem:doneButton]; [item setRightBarButtonItem:doneButton];
[item setLeftBarButtonItem:cancelButton]; [item setLeftBarButtonItem:cancelButton];
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#import "components/translate/ios/browser/js_translate_manager.h" #import "components/translate/ios/browser/js_translate_manager.h"
#import "components/translate/ios/browser/language_detection_controller.h" #import "components/translate/ios/browser/language_detection_controller.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/translate/before_translate_infobar_controller.h"
#include "ios/chrome/browser/translate/chrome_ios_translate_client.h" #include "ios/chrome/browser/translate/chrome_ios_translate_client.h"
#import "ios/chrome/test/app/chrome_test_util.h" #import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/app/tab_test_util.h" #import "ios/chrome/test/app/tab_test_util.h"
...@@ -108,6 +107,20 @@ NSString* GetTranslateInfobarSwitchLabel(const std::string& language) { ...@@ -108,6 +107,20 @@ NSString* GetTranslateInfobarSwitchLabel(const std::string& language) {
IDS_TRANSLATE_INFOBAR_ALWAYS_TRANSLATE, base::UTF8ToUTF16(language))); IDS_TRANSLATE_INFOBAR_ALWAYS_TRANSLATE, base::UTF8ToUTF16(language)));
} }
// Returns a matcher for the button with label "Cancel" in the language picker.
// TODO(crbug.com/750344): Change the matcher to use accessibility ID.
id<GREYMatcher> LanguagePickerCancelButton() {
return grey_allOf(chrome_test_util::ButtonWithAccessibilityLabel(@"Cancel"),
grey_userInteractionEnabled(), nil);
}
// Returns a matcher for the button with label "Done" in the language picker.
// TODO(crbug.com/750344): Change the matcher to use accessibility ID.
id<GREYMatcher> LanguagePickerDoneButton() {
return grey_allOf(chrome_test_util::ButtonWithAccessibilityLabel(@"Done"),
grey_userInteractionEnabled(), nil);
}
#pragma mark - TestResponseProvider #pragma mark - TestResponseProvider
// A ResponseProvider that provides html responses of texts in different // A ResponseProvider that provides html responses of texts in different
...@@ -602,8 +615,9 @@ using translate::LanguageDetectionController; ...@@ -602,8 +615,9 @@ using translate::LanguageDetectionController;
selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel(
kFrench)] performAction:grey_tap()]; kFrench)] performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( // The language picker uses the system accessibility labels (thus no
kLanguagePickerCancelButtonId)] // IDS_CANCEL here).
[[EarlGrey selectElementWithMatcher:LanguagePickerCancelButton()]
assertWithMatcher:grey_notNil()]; assertWithMatcher:grey_notNil()];
// Change the language using the picker. // Change the language using the picker.
...@@ -614,8 +628,7 @@ using translate::LanguageDetectionController; ...@@ -614,8 +628,7 @@ using translate::LanguageDetectionController;
[[EarlGrey selectElementWithMatcher:languageMatcher] [[EarlGrey selectElementWithMatcher:languageMatcher]
performAction:grey_tap()]; performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:LanguagePickerDoneButton()]
kLanguagePickerDoneButtonId)]
performAction:grey_tap()]; performAction:grey_tap()];
[[EarlGrey [[EarlGrey
selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel(
......
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