Commit 2e7b930c authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

[AF][IOS] Unify Autofill settings strings on all platforms (part 2)

- Updates existing strings and adds new ones related to the new Autofill
  addresses and payment methods settings in components/autofill_strings to
  share on all platforms.
- Makes visual changes to the addresses and payment methods settings pages
  on iOS by adding a message under toggle that controls Autofill for that
  type.

TBR=sebsg@

Bug: 873215
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I8fe68a0f1776151f062006e95219a4ad41d8bb63
Reviewed-on: https://chromium-review.googlesource.com/1180556
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarFabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585314}
parent ca9f19b4
...@@ -448,27 +448,39 @@ ...@@ -448,27 +448,39 @@
<message name="IDS_AUTOFILL_ADDRESSES" desc="Title for the list of addresses that chrome has saved for use in filling in forms."> <message name="IDS_AUTOFILL_ADDRESSES" desc="Title for the list of addresses that chrome has saved for use in filling in forms.">
Addresses Addresses
</message> </message>
<message name="IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_SUBLABEL" desc="Sublabel for a toggle that allows users to control whether addresses should be saved and forms should be autofilled with them.">
Includes information like phone numbers, email addresses, and shipping addresses
</message>
<message name="IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_SUBLABEL" desc="Sublabel for a toggle that allows users to control whether credit cards should be saved and forms should be autofilled with it.">
Makes it faster to pay for things online
</message>
<if expr="not is_ios"> <if expr="not is_ios">
<then> <then>
<message name="IDS_AUTOFILL_PAYMENT_METHODS" desc="Title for the list of saved payment methods that can be used to fill in forms. Sentence-Cased."> <message name="IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE" desc="Title for the Autofill settings page that allows user to manage their list of saved addresses and Autofill preferences for addresses. Sentence-Cased.">
Addresses and more
</message>
<message name="IDS_AUTOFILL_PAYMENT_METHODS" desc="Title for the list of saved payment methods that can be used to fill in forms. Also used as the title for the Autofill settings page that allows user to manage their list of saved payment methods and Autofill preferences for payment methods. Sentence-Cased.">
Payment methods Payment methods
</message> </message>
<message name="IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether addresses should be saved and forms should be autofilled with them. Sentence-Cased."> <message name="IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether addresses should be saved and forms should be autofilled with them. Sentence-Cased.">
Save and fill addresses Remember addresses and other information
</message> </message>
<message name="IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether credit cards should be saved and forms should be autofilled with it. Sentence-Cased."> <message name="IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether credit cards should be saved and forms should be autofilled with it. Sentence-Cased.">
Save and fill payment methods Remember payment methods
</message> </message>
</then> </then>
<else> <else>
<message name="IDS_AUTOFILL_PAYMENT_METHODS" desc="Title for the list of saved payment methods that can be used to fill in forms. Title-Cased."> <message name="IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE" desc="Title for the Autofill settings page that allows user to manage their list of saved addresses and Autofill preferences for addresses. Title-Cased.">
Addresses and More
</message>
<message name="IDS_AUTOFILL_PAYMENT_METHODS" desc="Title for the list of saved payment methods that can be used to fill in forms. Also used as the title for the Autofill settings page that allows user to manage their list of saved payment methods and Autofill preferences for payment methods. Title-Cased.">
Payment Methods Payment Methods
</message> </message>
<message name="IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether addresses should be saved and forms should be autofilled with them. Title-Cased."> <message name="IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether addresses should be saved and forms should be autofilled with them. Title-Cased.">
Save and Fill Addresses Remember Addresses and Other Information
</message> </message>
<message name="IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether credit cards should be saved and forms should be autofilled with it. Title-Cased."> <message name="IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_LABEL" desc="Label for a toggle that allows users to control whether credit cards should be saved and forms should be autofilled with it. Title-Cased.">
Save and Fill Payment Methods Remember Payment Methods
</message> </message>
</else> </else>
</if> </if>
......
...@@ -16,14 +16,19 @@ ...@@ -16,14 +16,19 @@
#include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.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/experimental_flags.h"
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h" #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h" #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h" #import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_text_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_text_item.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h" #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -34,11 +39,13 @@ namespace { ...@@ -34,11 +39,13 @@ namespace {
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierSwitches = kSectionIdentifierEnumZero, SectionIdentifierSwitches = kSectionIdentifierEnumZero,
SectionIdentifierSubtitle,
SectionIdentifierCards, SectionIdentifierCards,
}; };
typedef NS_ENUM(NSInteger, ItemType) { typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeAutofillCardSwitch = kItemTypeEnumZero, ItemTypeAutofillCardSwitch = kItemTypeEnumZero,
ItemTypeAutofillCardSwitchSubtitle,
ItemTypeCard, ItemTypeCard,
ItemTypeHeader, ItemTypeHeader,
}; };
...@@ -106,6 +113,10 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -106,6 +113,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
[model addItem:[self cardSwitchItem] [model addItem:[self cardSwitchItem]
toSectionWithIdentifier:SectionIdentifierSwitches]; toSectionWithIdentifier:SectionIdentifierSwitches];
[model addSectionWithIdentifier:SectionIdentifierSubtitle];
[model addItem:[self cardSwitchSubtitleItem]
toSectionWithIdentifier:SectionIdentifierSubtitle];
[self populateCardSection]; [self populateCardSection];
} }
...@@ -138,6 +149,22 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -138,6 +149,22 @@ typedef NS_ENUM(NSInteger, ItemType) {
return switchItem; return switchItem;
} }
- (CollectionViewItem*)cardSwitchSubtitleItem {
CollectionViewTextItem* textItem = [[CollectionViewTextItem alloc]
initWithType:ItemTypeAutofillCardSwitchSubtitle];
textItem.text =
l10n_util::GetNSString(IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_SUBLABEL);
if (experimental_flags::IsSettingsUIRebootEnabled()) {
textItem.textFont = [UIFont systemFontOfSize:kUIKitMultilineDetailFontSize];
textItem.textColor = UIColorFromRGB(kUIKitMultilineDetailTextColor);
} else {
textItem.textFont = [[MDCTypography fontLoader] regularFontOfSize:14];
textItem.textColor = [[MDCPalette greyPalette] tint500];
}
textItem.numberOfTextLines = 0;
return textItem;
}
- (CollectionViewItem*)cardSectionHeader { - (CollectionViewItem*)cardSectionHeader {
SettingsTextItem* header = [self genericHeader]; SettingsTextItem* header = [self genericHeader];
header.text = l10n_util::GetNSString(IDS_AUTOFILL_PAYMENT_METHODS); header.text = l10n_util::GetNSString(IDS_AUTOFILL_PAYMENT_METHODS);
...@@ -259,8 +286,17 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -259,8 +286,17 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (BOOL)collectionView:(UICollectionView*)collectionView - (BOOL)collectionView:(UICollectionView*)collectionView
hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; NSInteger sectionIdentifier =
return type == ItemTypeAutofillCardSwitch; [self.collectionViewModel sectionIdentifierForSection:indexPath.section];
return sectionIdentifier == SectionIdentifierSwitches ||
sectionIdentifier == SectionIdentifierSubtitle;
}
- (BOOL)collectionView:(UICollectionView*)collectionView
shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath {
NSInteger sectionIdentifier =
[self.collectionViewModel sectionIdentifierForSection:indexPath.section];
return sectionIdentifier == SectionIdentifierSubtitle;
} }
#pragma mark - UICollectionViewDelegate #pragma mark - UICollectionViewDelegate
......
...@@ -65,15 +65,18 @@ class AutofillCreditCardCollectionViewControllerTest ...@@ -65,15 +65,18 @@ class AutofillCreditCardCollectionViewControllerTest
std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
}; };
// Default test case of no addresses or credit cards. // Default test case of no credit cards.
TEST_F(AutofillCreditCardCollectionViewControllerTest, TestInitialization) { TEST_F(AutofillCreditCardCollectionViewControllerTest, TestInitialization) {
CreateController(); CreateController();
CheckController(); CheckController();
// Expect one header section. // Expect one header section and one subtitle section.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row (the credit card Autofill toggle). // Expect header section to contain one row (the credit card Autofill toggle).
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect subtitle section to contain one row (the credit card Autofill toggle
// subtitle).
EXPECT_EQ(1, NumberOfItemsInSection(1));
} }
// Adding a single credit card results in a credit card section. // Adding a single credit card results in a credit card section.
...@@ -82,10 +85,10 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest, TestOneCreditCard) { ...@@ -82,10 +85,10 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest, TestOneCreditCard) {
CreateController(); CreateController();
CheckController(); CheckController();
// Expect two sections (header and credit cards section). // Expect three sections (header, subtitle, and credit card section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(3, NumberOfSections());
// Expect address section to contain one row (the credit card itself). // Expect credit card section to contain one row (the credit card itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(2));
} }
// Deleting the only credit card results in item deletion and section deletion. // Deleting the only credit card results in item deletion and section deletion.
...@@ -95,10 +98,10 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest, ...@@ -95,10 +98,10 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest,
CreateController(); CreateController();
CheckController(); CheckController();
// Expect two sections (header and credit cards section). // Expect three sections (header, subtitle, and credit card section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(3, NumberOfSections());
// Expect address section to contain one row (the credit card itself). // Expect credit card section to contain one row (the credit card itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(2));
AutofillCreditCardCollectionViewController* view_controller = AutofillCreditCardCollectionViewController* view_controller =
base::mac::ObjCCastStrict<AutofillCreditCardCollectionViewController>( base::mac::ObjCCastStrict<AutofillCreditCardCollectionViewController>(
...@@ -126,14 +129,14 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest, ...@@ -126,14 +129,14 @@ TEST_F(AutofillCreditCardCollectionViewControllerTest,
// This call cause a modification of the PersonalDataManager, so wait until // This call cause a modification of the PersonalDataManager, so wait until
// the asynchronous task complete in addition to waiting for the UI update. // the asynchronous task complete in addition to waiting for the UI update.
delete_item_with_wait(1, 0); delete_item_with_wait(2, 0);
observer.Wait(); // Wait for completion of the asynchronous operation. observer.Wait(); // Wait for completion of the asynchronous operation.
// Exit 'edit' mode. // Exit 'edit' mode.
[view_controller editButtonPressed]; [view_controller editButtonPressed];
// Expect one header section only. // Expect credit card section to have been removed.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
} }
} // namespace } // namespace
...@@ -15,14 +15,19 @@ ...@@ -15,14 +15,19 @@
#include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.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/experimental_flags.h"
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h" #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h" #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h" #import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_text_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_text_item.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h" #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -33,11 +38,13 @@ namespace { ...@@ -33,11 +38,13 @@ namespace {
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierSwitches = kSectionIdentifierEnumZero, SectionIdentifierSwitches = kSectionIdentifierEnumZero,
SectionIdentifierSubtitle,
SectionIdentifierProfiles, SectionIdentifierProfiles,
}; };
typedef NS_ENUM(NSInteger, ItemType) { typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeAutofillAddressSwitch = kItemTypeEnumZero, ItemTypeAutofillAddressSwitch = kItemTypeEnumZero,
ItemTypeAutofillAddressSwitchSubtitle,
ItemTypeAddress, ItemTypeAddress,
ItemTypeHeader, ItemTypeHeader,
}; };
...@@ -75,7 +82,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -75,7 +82,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
[super initWithLayout:layout style:CollectionViewControllerStyleAppBar]; [super initWithLayout:layout style:CollectionViewControllerStyleAppBar];
if (self) { if (self) {
self.collectionViewAccessibilityIdentifier = @"kAutofillCollectionViewId"; self.collectionViewAccessibilityIdentifier = @"kAutofillCollectionViewId";
self.title = l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES); self.title = l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE);
self.shouldHideDoneButton = YES; self.shouldHideDoneButton = YES;
_browserState = browserState; _browserState = browserState;
_personalDataManager = _personalDataManager =
...@@ -105,6 +112,10 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -105,6 +112,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
[model addItem:[self addressSwitchItem] [model addItem:[self addressSwitchItem]
toSectionWithIdentifier:SectionIdentifierSwitches]; toSectionWithIdentifier:SectionIdentifierSwitches];
[model addSectionWithIdentifier:SectionIdentifierSubtitle];
[model addItem:[self addressSwitchSubtitleItem]
toSectionWithIdentifier:SectionIdentifierSubtitle];
[self populateProfileSection]; [self populateProfileSection];
} }
...@@ -137,6 +148,22 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -137,6 +148,22 @@ typedef NS_ENUM(NSInteger, ItemType) {
return switchItem; return switchItem;
} }
- (CollectionViewItem*)addressSwitchSubtitleItem {
CollectionViewTextItem* textItem = [[CollectionViewTextItem alloc]
initWithType:ItemTypeAutofillAddressSwitchSubtitle];
textItem.text =
l10n_util::GetNSString(IDS_AUTOFILL_ENABLE_PROFILES_TOGGLE_SUBLABEL);
if (experimental_flags::IsSettingsUIRebootEnabled()) {
textItem.textFont = [UIFont systemFontOfSize:kUIKitMultilineDetailFontSize];
textItem.textColor = UIColorFromRGB(kUIKitMultilineDetailTextColor);
} else {
textItem.textFont = [[MDCTypography fontLoader] regularFontOfSize:14];
textItem.textColor = [[MDCPalette greyPalette] tint500];
}
textItem.numberOfTextLines = 0;
return textItem;
}
- (CollectionViewItem*)profileSectionHeader { - (CollectionViewItem*)profileSectionHeader {
SettingsTextItem* header = [self genericHeader]; SettingsTextItem* header = [self genericHeader];
header.text = l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES); header.text = l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES);
...@@ -266,8 +293,17 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -266,8 +293,17 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (BOOL)collectionView:(UICollectionView*)collectionView - (BOOL)collectionView:(UICollectionView*)collectionView
hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; NSInteger sectionIdentifier =
return type == ItemTypeAutofillAddressSwitch; [self.collectionViewModel sectionIdentifierForSection:indexPath.section];
return sectionIdentifier == SectionIdentifierSwitches ||
sectionIdentifier == SectionIdentifierSubtitle;
}
- (BOOL)collectionView:(UICollectionView*)collectionView
shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath {
NSInteger sectionIdentifier =
[self.collectionViewModel sectionIdentifierForSection:indexPath.section];
return sectionIdentifier == SectionIdentifierSubtitle;
} }
#pragma mark - UICollectionViewDelegate #pragma mark - UICollectionViewDelegate
......
...@@ -69,10 +69,13 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestInitialization) { ...@@ -69,10 +69,13 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestInitialization) {
CreateController(); CreateController();
CheckController(); CheckController();
// Expect one header section. // Expect one header section and one subtitle section.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row (the address Autofill toggle). // Expect header section to contain one row (the address Autofill toggle).
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect subtitle section to contain one row (the address Autofill toggle
// subtitle).
EXPECT_EQ(1, NumberOfItemsInSection(1));
} }
// Adding a single address results in an address section. // Adding a single address results in an address section.
...@@ -81,10 +84,10 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfile) { ...@@ -81,10 +84,10 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfile) {
CreateController(); CreateController();
CheckController(); CheckController();
// Expect two sections (header and addresses section). // Expect three sections (header, subtitle, and addresses section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(3, NumberOfSections());
// Expect address section to contain one row (the address itself). // Expect address section to contain one row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(2));
} }
// Deleting the only profile results in item deletion and section deletion. // Deleting the only profile results in item deletion and section deletion.
...@@ -93,10 +96,10 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfileItemDeleted) { ...@@ -93,10 +96,10 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfileItemDeleted) {
CreateController(); CreateController();
CheckController(); CheckController();
// Expect two sections (header and addresses section). // Expect three sections (header, subtitle, and addresses section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(3, NumberOfSections());
// Expect address section to contain one row (the address itself). // Expect address section to contain one row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(2));
AutofillProfileCollectionViewController* view_controller = AutofillProfileCollectionViewController* view_controller =
base::mac::ObjCCastStrict<AutofillProfileCollectionViewController>( base::mac::ObjCCastStrict<AutofillProfileCollectionViewController>(
...@@ -124,14 +127,14 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfileItemDeleted) { ...@@ -124,14 +127,14 @@ TEST_F(AutofillProfileCollectionViewControllerTest, TestOneProfileItemDeleted) {
// This call cause a modification of the PersonalDataManager, so wait until // This call cause a modification of the PersonalDataManager, so wait until
// the asynchronous task complete in addition to waiting for the UI update. // the asynchronous task complete in addition to waiting for the UI update.
delete_item_with_wait(1, 0); delete_item_with_wait(2, 0);
observer.Wait(); // Wait for completion of the asynchronous operation. observer.Wait(); // Wait for completion of the asynchronous operation.
// Exit 'edit' mode. // Exit 'edit' mode.
[view_controller editButtonPressed]; [view_controller editButtonPressed];
// Expect one header section only. // Expect address section to have been removed.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
} }
} // namespace } // namespace
...@@ -131,9 +131,9 @@ NSString* GetTextFieldForID(int categoryId) { ...@@ -131,9 +131,9 @@ NSString* GetTextFieldForID(int categoryId) {
// Helper to open the settings page for Autofill profiles. // Helper to open the settings page for Autofill profiles.
- (void)openAutofillProfilesSettings { - (void)openAutofillProfilesSettings {
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel( id<GREYMatcher> addressesButton =
l10n_util::GetNSString( ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE);
IDS_AUTOFILL_ADDRESSES))] [[EarlGrey selectElementWithMatcher:addressesButton]
performAction:grey_tap()]; performAction:grey_tap()];
} }
......
...@@ -592,7 +592,8 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -592,7 +592,8 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
: l10n_util::GetNSString(IDS_IOS_SETTING_OFF); : l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
_autoFillProfileDetailItem = _autoFillProfileDetailItem =
[self detailItemWithType:ItemTypeAutofillProfile [self detailItemWithType:ItemTypeAutofillProfile
text:l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES) text:l10n_util::GetNSString(
IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE)
detailText:detailText detailText:detailText
iconImageName:kSettingsAutofillProfileImageName]; iconImageName:kSettingsAutofillProfileImageName];
......
...@@ -103,7 +103,7 @@ id<GREYMatcher> PaymentMethodsButton() { ...@@ -103,7 +103,7 @@ id<GREYMatcher> PaymentMethodsButton() {
} }
// Matcher for the addresses cell on the main Settings screen. // Matcher for the addresses cell on the main Settings screen.
id<GREYMatcher> AddressesButton() { id<GREYMatcher> AddressesButton() {
return ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES); return ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE);
} }
// Matcher for the Google Chrome cell on the main Settings screen. // Matcher for the Google Chrome cell on the main Settings screen.
id<GREYMatcher> GoogleChromeButton() { id<GREYMatcher> GoogleChromeButton() {
......
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