Commit 02eb6180 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Enables InfobarUIReboot by default.

Enables the InfobarUIReboot flag.
Fixes some eg_tests so they work with the new UI.
Makes some changes to credi_card and autofill tests since the credit card
manager behaves differently when InfobarUIReboot is enabled.

Bug=952345

Change-Id: I9cc8a4cb01d7139251b43348fe41037de00d9743
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096029
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794992}
parent 2002559f
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "components/autofill/core/browser/metrics/form_events.h" #include "components/autofill/core/browser/metrics/form_events.h"
#include "components/autofill/core/browser/mock_autocomplete_history_manager.h" #include "components/autofill/core/browser/mock_autocomplete_history_manager.h"
#include "components/autofill/core/browser/payments/test_credit_card_save_manager.h" #include "components/autofill/core/browser/payments/test_credit_card_save_manager.h"
#include "components/autofill/core/browser/payments/test_credit_card_save_strike_database.h"
#include "components/autofill/core/browser/payments/test_payments_client.h" #include "components/autofill/core/browser/payments/test_payments_client.h"
#include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/test_autofill_client.h" #include "components/autofill/core/browser/test_autofill_client.h"
...@@ -373,6 +374,11 @@ class AutofillManagerTest : public testing::Test { ...@@ -373,6 +374,11 @@ class AutofillManagerTest : public testing::Test {
/*call_parent_methods=*/false); /*call_parent_methods=*/false);
autofill_manager_->SetExternalDelegate(external_delegate_.get()); autofill_manager_->SetExternalDelegate(external_delegate_.get());
std::unique_ptr<TestStrikeDatabase> test_strike_database =
std::make_unique<TestStrikeDatabase>();
strike_database_ = test_strike_database.get();
autofill_client_.set_test_strike_database(std::move(test_strike_database));
// Initialize the TestPersonalDataManager with some default data. // Initialize the TestPersonalDataManager with some default data.
CreateTestAutofillProfiles(); CreateTestAutofillProfiles();
CreateTestCreditCards(); CreateTestCreditCards();
...@@ -633,6 +639,7 @@ class AutofillManagerTest : public testing::Test { ...@@ -633,6 +639,7 @@ class AutofillManagerTest : public testing::Test {
TestPersonalDataManager personal_data_; TestPersonalDataManager personal_data_;
std::unique_ptr<MockAutocompleteHistoryManager> autocomplete_history_manager_; std::unique_ptr<MockAutocompleteHistoryManager> autocomplete_history_manager_;
base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList scoped_feature_list_;
TestStrikeDatabase* strike_database_;
private: private:
int ToHistogramSample(AutofillMetrics::CardUploadDecisionMetric metric) { int ToHistogramSample(AutofillMetrics::CardUploadDecisionMetric metric) {
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
#include "components/infobars/core/infobar_feature.h" #include "components/infobars/core/infobar_feature.h"
const base::Feature kIOSInfobarUIReboot{"InfobarUIReboot", const base::Feature kIOSInfobarUIReboot{"InfobarUIReboot",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
...@@ -124,6 +124,7 @@ source_set("eg2_tests") { ...@@ -124,6 +124,7 @@ source_set("eg2_tests") {
"//components/translate/core/common:common", "//components/translate/core/common:common",
"//ios/chrome/app/strings:ios_strings_grit", "//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser:chrome_url_constants", "//ios/chrome/browser:chrome_url_constants",
"//ios/chrome/browser/ui/infobars:feature_flags",
"//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/popup_menu:constants",
"//ios/chrome/browser/ui/translate:legacy_translate_constants", "//ios/chrome/browser/ui/translate:legacy_translate_constants",
"//ios/chrome/browser/ui/translate:translate_ui_constants", "//ios/chrome/browser/ui/translate:translate_ui_constants",
......
...@@ -169,7 +169,9 @@ source_set("eg2_tests") { ...@@ -169,7 +169,9 @@ source_set("eg2_tests") {
"//base/test:test_support", "//base/test:test_support",
"//components/autofill/ios/browser:autofill_test_bundle_data", "//components/autofill/ios/browser:autofill_test_bundle_data",
"//components/strings:components_strings_grit", "//components/strings:components_strings_grit",
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser/metrics:eg_test_support+eg2", "//ios/chrome/browser/metrics:eg_test_support+eg2",
"//ios/chrome/browser/ui/infobars/banners:public",
"//ios/chrome/test:eg_test_support+eg2", "//ios/chrome/test:eg_test_support+eg2",
"//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2", "//ios/testing/earl_grey:eg_test_support+eg2",
...@@ -178,6 +180,7 @@ source_set("eg2_tests") { ...@@ -178,6 +180,7 @@ source_set("eg2_tests") {
"//net:test_support", "//net:test_support",
"//services/network/public/cpp", "//services/network/public/cpp",
"//testing/gtest", "//testing/gtest",
"//ui/base",
] ]
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
} }
......
...@@ -52,26 +52,7 @@ const base::Feature kInfobarUIRebootOnlyiOS13{"InfobarUIRebootOnlyiOS13", ...@@ -52,26 +52,7 @@ const base::Feature kInfobarUIRebootOnlyiOS13{"InfobarUIRebootOnlyiOS13",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
bool IsInfobarUIRebootEnabled() { bool IsInfobarUIRebootEnabled() {
// Enable Messages to 100% in Dev, Canary and Beta. return base::FeatureList::IsEnabled(kIOSInfobarUIReboot);
switch (GetChannel()) {
case version_info::Channel::BETA:
case version_info::Channel::DEV:
case version_info::Channel::CANARY:
return YES;
case version_info::Channel::UNKNOWN:
case version_info::Channel::STABLE:
break;
}
if (base::FeatureList::IsEnabled(kInfobarUIRebootOnlyiOS13)) {
if (@available(iOS 13, *)) {
return base::FeatureList::IsEnabled(kIOSInfobarUIReboot);
} else {
return NO;
}
} else {
return base::FeatureList::IsEnabled(kIOSInfobarUIReboot);
}
} }
bool IsInfobarOverlayUIEnabled() { bool IsInfobarOverlayUIEnabled() {
......
...@@ -450,6 +450,7 @@ source_set("eg2_tests") { ...@@ -450,6 +450,7 @@ source_set("eg2_tests") {
"//components/version_info:version_info", "//components/version_info:version_info",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser:chrome_url_constants", "//ios/chrome/browser:chrome_url_constants",
"//ios/chrome/browser/ui/infobars/banners:public",
"//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/popup_menu:constants",
"//ios/chrome/browser/ui/util:multiwindow_util", "//ios/chrome/browser/ui/util:multiwindow_util",
"//ios/chrome/test:eg_test_support+eg2", "//ios/chrome/test:eg_test_support+eg2",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#import "ios/chrome/browser/ui/infobars/banners/infobar_banner_constants.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.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_matchers.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h"
...@@ -34,9 +35,12 @@ const char kTestURL[] = ...@@ -34,9 +35,12 @@ const char kTestURL[] =
// Returns matcher for Blocked Popup infobar. // Returns matcher for Blocked Popup infobar.
id<GREYMatcher> PopupBlocker() { id<GREYMatcher> PopupBlocker() {
NSString* blockerText = base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( return grey_allOf(
IDS_IOS_POPUPS_BLOCKED_MOBILE, base::UTF8ToUTF16("1"))); grey_accessibilityID(kInfobarBannerViewIdentifier),
return grey_accessibilityLabel(blockerText); grey_accessibilityLabel(
base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(
IDS_IOS_POPUPS_BLOCKED_MOBILE, base::UTF8ToUTF16("1")))),
nil);
} }
} // namespace } // namespace
......
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