diff --git a/ios/chrome/browser/ui/settings/privacy/BUILD.gn b/ios/chrome/browser/ui/settings/privacy/BUILD.gn index 771c821c62524c..e756f1e313e293 100644 --- a/ios/chrome/browser/ui/settings/privacy/BUILD.gn +++ b/ios/chrome/browser/ui/settings/privacy/BUILD.gn @@ -146,6 +146,7 @@ source_set("unit_tests") { "//ios/chrome/browser/ui/table_view:utils", "//ios/chrome/browser/ui/table_view/cells", "//ios/chrome/test:test_support", + "//ios/components/security_interstitials/https_only_mode:feature", "//ios/web/public/test", "//testing/gtest", "//third_party/ocmock:ocmock", diff --git a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm index f7cb5c52eb6485..349c906da063f6 100644 --- a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm @@ -32,6 +32,7 @@ #include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" +#import "ios/components/security_interstitials/https_only_mode/feature.h" #include "ios/web/public/test/web_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" @@ -63,6 +64,8 @@ typedef NS_ENUM(NSUInteger, PrivacyTableViewControllerTestConfig) { PrivacyTableViewControllerTestConfigEnhancedProtectionEnabled = 1 << 0, // Tests should run with Third-party intents in Incognito flag enabled. PrivacyTableViewControllerTestConfig3PIntentsInIncognitoEnabled = 1 << 1, + // Tests should run with HTTPS-Only Mode flag enabled. + PrivacyTableViewControllerTestConfigHttpsOnlyModeSettingEnabled = 1 << 2, }; // `ScopedFeatureList` wrapper so `PrivacyTableViewControllerTest` can ensure @@ -110,6 +113,15 @@ typedef NS_ENUM(NSUInteger, PrivacyTableViewControllerTestConfig) { enabledDisabledFeatures.second.push_back(kIOS3PIntentsInIncognito); } + if (GetParam() & + PrivacyTableViewControllerTestConfigHttpsOnlyModeSettingEnabled) { + enabledDisabledFeatures.first.push_back( + security_interstitials::features::kHttpsOnlyMode); + } else { + enabledDisabledFeatures.second.push_back( + security_interstitials::features::kHttpsOnlyMode); + } + return enabledDisabledFeatures; } diff --git a/ios/components/security_interstitials/https_only_mode/feature.cc b/ios/components/security_interstitials/https_only_mode/feature.cc index 79f261d6adb42a..93b03fdb66512f 100644 --- a/ios/components/security_interstitials/https_only_mode/feature.cc +++ b/ios/components/security_interstitials/https_only_mode/feature.cc @@ -8,7 +8,7 @@ namespace security_interstitials { namespace features { const base::Feature kHttpsOnlyMode{"HttpsOnlyMode", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; } // namespace features } // namespace security_interstitials diff --git a/ios/components/security_interstitials/https_only_mode/feature.h b/ios/components/security_interstitials/https_only_mode/feature.h index 8ba9d64c352806..2d17ddff14a38a 100644 --- a/ios/components/security_interstitials/https_only_mode/feature.h +++ b/ios/components/security_interstitials/https_only_mode/feature.h @@ -10,7 +10,8 @@ namespace security_interstitials { namespace features { -// Enables HTTPS-Only mode upgrades on iOS. +// Enables the HTTPS-Only mode UI setting on iOS. The user has to enable +// the UI setting under "Privacy and Security" to use HTTPS-Only Mode. extern const base::Feature kHttpsOnlyMode; } // namespace features