Re-enable some of the upstream's HttpsUpgradesBrowserTest.

We were disabling these too aggressively. Re-enabling the ones that
don't fail with special interest in CaptivePortal tests due verify our
patch in ShouldExcludeNavigationFromUpgrades function
in HttpsUpgradesInterceptor doesn't interfere with the upstream's
captive portal code.

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/6a80cd70fe4032a33af8a2367630469991bceb9f

commit 6a80cd70fe4032a33af8a2367630469991bceb9f
Author: Mustafa Emre Acer <meacer@chromium.org>
Date:   Thu Jun 27 19:57:29 2024 +0000

    [HTTPS Upgrades] Disable for captive portal login URLs

    When Chrome detects that it's behind a captive portal, it automatically
    opens a new tab or popup pointing to the captive portal's login URL.
    Presently, HTTPS Upgrades treats this a normal tab and attempts to
    upgrade it.

    Most captive portals don't allow HTTPS requests to go through
    before the user logs in, so HTTPS Upgrades will fall back to the http
    URL as usual. However, some portals allow HTTPS. This may cause
    an empty page to be displayed to the user if the request is upgraded,
    e.g. to https://www.gstatic.com/generate_204.

    This CL disables upgrades on the first navigation to the captive
    portal login URL when a portal is detected, and the HTTPS-First Mode
    interstitial is not enabled.

    Bug: 343947168
This commit is contained in:
mkarolin
2024-08-07 21:32:00 -04:00
parent 50974497cf
commit 18e2621958
2 changed files with 58 additions and 1 deletions
@@ -5,11 +5,22 @@
#include "net/base/features.h"
// Prevent re-dfining ExpectTotalCount.
#include "base/test/metrics/histogram_tester.h"
// Prevent re-defining InitWithFeatures definition.
#include "base/test/scoped_feature_list.h"
#define InitWithFeatures(...) \
InitWithFeaturesAndDisable(net::features::kBraveHttpsByDefault, __VA_ARGS__)
// Add one to total count for Brave extension
// (chrome-extension://mnojpmjdmbbfmejpflffifhffcmidifd/) background page.
#define ExpectTotalCount(NAME, COUNT) \
ExpectTotalCount( \
NAME, std::string_view(NAME) == kNavigationRequestSecurityLevelHistogram \
? COUNT + 1 \
: COUNT)
#include "src/chrome/browser/ssl/https_upgrades_browsertest.cc"
#undef ExpectTotalCount
#undef InitWithFeatures
+47 -1
View File
@@ -1086,7 +1086,53 @@
-ProfileTypeChoiceUIPixelTest.InvokeUi_default/TS
# These tests fail because we are modifying the HttpsUpgrades feature.
-HttpsUpgradesBrowserTest.*
-HttpsUpgradesBrowserTest.AllowlistEntryExpires/*
-HttpsUpgradesBrowserTest.BadHttpsFollowedByGoodHttps/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.BadHttpsFollowedByGoodHttps/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.BrokenSSLOnUpgrade_SecurityLevelWarning/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.BrokenSSLOnUpgrade_SecurityLevelWarning/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.CloseInterstitialTab/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.CloseInterstitialTab/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.EnterpriseAllowlistDisablesHttpsFirstModeForSiteEngagament/AllAutoHFM
-HttpsUpgradesBrowserTest.EnterpriseAllowlistDisablesHttpsFirstModeForSiteEngagament/HttpsFirstModeWithSiteEngagement
-HttpsUpgradesBrowserTest.EnterpriseAllowlistDisablesUpgrades/*
-HttpsUpgradesBrowserTest.ExemptNetErrorOnUpgrade_ShouldNotFallback/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.ExemptNetErrorOnUpgrade_ShouldNotFallback/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.HttpPageHttpPost_NotUpgraded/*
-HttpsUpgradesBrowserTest.HttpParentHttpSubframeNavigation_NotUpgraded/*
-HttpsUpgradesBrowserTest.HttpsToHttpRedirect_ShouldUpgrade/*
-HttpsUpgradesBrowserTest.HttpsUpgradeWithBrokenSSL_ShouldTriggerSSLInterstitial/*
-HttpsUpgradesBrowserTest.IncognitoHasSeparateAllowlist/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.IncognitoInterstitialVariation/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.InterstitialBypassed_HttpFallbackLoaded/*
-HttpsUpgradesBrowserTest.InterstitialFallbackMaintainsHistory/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.InterstitialFallbackMaintainsHistory/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.InterstitialGoBack/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.InterstitialGoBack/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.InterstitialLearnMoreLink/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.InterstitialLearnMoreLink/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.Localhost_ShouldNotUpgrade/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.NetErrorOnUpgrade_SecurityLevelWarning/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.NetErrorOnUpgrade_SecurityLevelWarning/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.NetErrorOnUpgrade_ShouldInterstitial/*
-HttpsUpgradesBrowserTest.NonUniqueHost_RecordsMetrics/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.PreferHstsOverHttpsFirstMode/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.RedirectLoop_ShouldInterstitial/*
-HttpsUpgradesBrowserTest.RevisitingBumpsExpiration/*
-HttpsUpgradesBrowserTest.SlowHttps_ShouldInterstitial/*
-HttpsUpgradesBrowserTest.TogglingSettingClearsAllowlist/AllFeatures
-HttpsUpgradesBrowserTest.TogglingSettingClearsAllowlist/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.URLsAutocompletedWithHttpSchemeAreUpgraded/*
-HttpsUpgradesBrowserTest.URLsTypedWithHttpSchemeNoUpgrades/*
-HttpsUpgradesBrowserTest.URLsTypedWithHttpSchemeNoUpgradesAllowlist/*
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_BrokenSSL_ShouldInterstitial/*
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_BrokenSSL_ShouldInterstitial_TypicallySecureUser/*
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_BrokenSSL_SiteEngagementHeuristic_ShouldIgnoreUrlsWithNonDefaultPorts/*
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_BrokenSSL_SiteEngagementHeuristic_ShouldInterstitial/*
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_NonUniqueHostname_ShouldNotInterstitial_TypicallySecureUser/HttpsFirstBalancedMode
-HttpsUpgradesBrowserTest.UrlWithHttpScheme_ShouldUpgrade/*
-HttpsUpgradesBrowserTest.UrlWithHttpsScheme_ShouldLoad/HttpsFirstModeIncognito
-HttpsUpgradesBrowserTest.crbug1431026/*
-HttpsUpgradesPrefsBrowserTest.PrefStatesRecorded
-HttpsUpgradesPrefsIncognitoEnabledBrowserTest.PrefStatesRecorded