diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index ecb13032cde183..cd9722316ff706 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -47,9 +47,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_icon_view.h" -#include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" #include "chrome/browser/ui/views/page_info/page_info_bubble_view_base.h" -#include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" @@ -58,7 +56,6 @@ #include "chrome/test/base/ui_test_utils.h" #include "components/google/core/common/google_util.h" #include "components/omnibox/browser/omnibox_prefs.h" -#include "components/page_info/features.h" #include "components/permissions/permission_util.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_types.h" @@ -2013,17 +2010,6 @@ class SafeBrowsingBlockingPageDelayedWarningBrowserTest ->AddDangerousUrl(url, threat_type); } - std::u16string GetSecuritySummaryTextFromPageInfo() { - auto* page_info = PageInfoBubbleView::GetPageInfoBubbleForTesting(); - if (base::FeatureList::IsEnabled(page_info::kPageInfoV2Desktop)) { - auto* summary_label = page_info->GetViewByID( - PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_SUMMARY_LABEL); - return static_cast(summary_label)->GetText(); - } - - return page_info->GetWindowTitle(); - } - protected: #if BUILDFLAG(ENABLE_EXTENSIONS) // Installs an extension and returns its ID. @@ -2674,7 +2660,7 @@ IN_PROC_BROWSER_TEST_P( auto* page_info = OpenPageInfo(browser()); ASSERT_TRUE(page_info); EXPECT_EQ( - GetSecuritySummaryTextFromPageInfo(), + page_info->GetWindowTitle(), l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE)); // When the Safety Tip is showing, the security level should be downgraded, as @@ -2781,7 +2767,7 @@ IN_PROC_BROWSER_TEST_P( PageInfoBubbleViewBase::GetShownBubbleType()); auto* page_info = OpenPageInfo(browser()); ASSERT_TRUE(page_info); - EXPECT_EQ(GetSecuritySummaryTextFromPageInfo(), + EXPECT_EQ(page_info->GetWindowTitle(), l10n_util::GetStringFUTF16(IDS_PAGE_INFO_SAFETY_TIP_LOOKALIKE_TITLE, u"google.com")); } diff --git a/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc b/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc index 8550e4f56d2bfc..b8057dacf50d7a 100644 --- a/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc +++ b/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc @@ -10,12 +10,10 @@ #include "chrome/browser/ui/hats/mock_hats_service.h" #include "chrome/browser/ui/page_info/page_info_dialog.h" #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" -#include "chrome/browser/ui/views/page_info/page_info_new_bubble_view.h" #include "chrome/common/chrome_features.h" #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/page_info/features.h" #include "content/public/test/browser_test.h" using ::testing::_; @@ -48,21 +46,16 @@ class TrustSafetySentimentServiceBrowserTest : public InProcessBrowserTest { base::RunLoop().RunUntilIdle(); } - PageInfo* GetPresenter() { - auto* bubble = PageInfoBubbleView::GetPageInfoBubbleForTesting(); - return base::FeatureList::IsEnabled(page_info::kPageInfoV2Desktop) - ? static_cast(bubble)->presenter_.get() - : static_cast(bubble)->presenter_.get(); - } - void ChangePermission() { PageInfo::PermissionInfo permission; permission.type = ContentSettingsType::NOTIFICATIONS; permission.setting = ContentSetting::CONTENT_SETTING_BLOCK; permission.default_setting = ContentSetting::CONTENT_SETTING_ASK; + permission.source = content_settings::SettingSource::SETTING_SOURCE_USER; - GetPresenter()->OnSitePermissionChanged(permission.type, permission.setting, - permission.is_one_time); + static_cast( + PageInfoBubbleView::GetPageInfoBubbleForTesting()) + ->OnPermissionChanged(permission); } void OpenEnoughNewTabs() { diff --git a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h index 92dc27b00edca0..f734a05e314efe 100644 --- a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h +++ b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h @@ -48,7 +48,6 @@ class PageInfoNewBubbleView : public PageInfoBubbleViewBase, friend class PageInfoBubbleViewBrowserTest; friend class PageInfoBubbleViewDialogBrowserTest; friend class test::PageInfoBubbleViewTestApi; - friend class TrustSafetySentimentServiceBrowserTest; // PageInfoBubbleViewBase: gfx::Size CalculatePreferredSize() const override; diff --git a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc index 23b4a2c7e1df00..1fce5860e28b97 100644 --- a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc @@ -365,6 +365,13 @@ class SafetyTipPageInfoBubbleViewBrowserTest return AreLookalikeWarningsEnabled() ? IsUIShowing() : !IsUIShowing(); } + const std::u16string GetPageInfoBubbleViewSummaryText() { + auto* label = + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_SUMMARY_LABEL); + return static_cast(label)->GetText(); + } + std::u16string GetSafetyTipSummaryText() { auto* page_info = PageInfoBubbleView::GetPageInfoBubbleForTesting(); if (base::FeatureList::IsEnabled(page_info::kPageInfoV2Desktop)) { @@ -703,9 +710,8 @@ IN_PROC_BROWSER_TEST_P(SafetyTipPageInfoBubbleViewBrowserTest, TriggerWarningFromBlocklist(browser(), kNavigatedUrl, WindowOpenDisposition::CURRENT_TAB); ASSERT_NO_FATAL_FAILURE(CheckNoButtons()); - auto* page_info = PageInfoBubbleView::GetPageInfoBubbleForTesting(); EXPECT_EQ( - page_info->GetWindowTitle(), + GetSafetyTipSummaryText(), l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE)); } diff --git a/components/page_info/features.cc b/components/page_info/features.cc index 018829bd81c29f..93f11b3d00a94a 100644 --- a/components/page_info/features.cc +++ b/components/page_info/features.cc @@ -18,7 +18,7 @@ const base::Feature kPageInfoStoreInfo{"PageInfoStoreInfo", #if !defined(OS_ANDROID) const base::Feature kPageInfoV2Desktop{"PageInfoV2Desktop", - base::FEATURE_ENABLED_BY_DEFAULT}; + base::FEATURE_DISABLED_BY_DEFAULT}; #endif const base::Feature kPageInfoAboutThisSite{"PageInfoAboutThisSite", diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index bc2c25a7ceb9b7..6f4b6e8637a65b 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json @@ -5769,6 +5769,24 @@ ] } ], + "PageInfoV2Desktop": [ + { + "platforms": [ + "chromeos", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "PageInfoV2Desktop" + ] + } + ] + } + ], "PaintPreviewShowOnStartup": [ { "platforms": [