Commit a9df5b29 authored by Livvie Lin's avatar Livvie Lin Committed by Commit Bot

Handle Safety Tip learn more link in page info

Bug: 1007497
Change-Id: I4498d39cabf4736a697294ad027082a53894a623
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857166Reviewed-by: default avatarJoe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Commit-Queue: Livvie Lin <livvielin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706076}
parent d7b531c7
...@@ -186,12 +186,14 @@ base::span<const PermissionsUIInfo> GetContentSettingsUIInfo() { ...@@ -186,12 +186,14 @@ base::span<const PermissionsUIInfo> GetContentSettingsUIInfo() {
std::unique_ptr<PageInfoUI::SecurityDescription> CreateSecurityDescription( std::unique_ptr<PageInfoUI::SecurityDescription> CreateSecurityDescription(
PageInfoUI::SecuritySummaryColor style, PageInfoUI::SecuritySummaryColor style,
int summary_id, int summary_id,
int details_id) { int details_id,
PageInfoUI::SecurityDescriptionType type) {
std::unique_ptr<PageInfoUI::SecurityDescription> security_description( std::unique_ptr<PageInfoUI::SecurityDescription> security_description(
new PageInfoUI::SecurityDescription()); new PageInfoUI::SecurityDescription());
security_description->summary_style = style; security_description->summary_style = style;
security_description->summary = l10n_util::GetStringUTF16(summary_id); security_description->summary = l10n_util::GetStringUTF16(summary_id);
security_description->details = l10n_util::GetStringUTF16(details_id); security_description->details = l10n_util::GetStringUTF16(details_id);
security_description->type = type;
return security_description; return security_description;
} }
...@@ -255,15 +257,18 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -255,15 +257,18 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
case PageInfo::SAFE_BROWSING_STATUS_MALWARE: case PageInfo::SAFE_BROWSING_STATUS_MALWARE:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_MALWARE_SUMMARY, IDS_PAGE_INFO_MALWARE_SUMMARY,
IDS_PAGE_INFO_MALWARE_DETAILS); IDS_PAGE_INFO_MALWARE_DETAILS,
SecurityDescriptionType::SAFE_BROWSING);
case PageInfo::SAFE_BROWSING_STATUS_SOCIAL_ENGINEERING: case PageInfo::SAFE_BROWSING_STATUS_SOCIAL_ENGINEERING:
return CreateSecurityDescription( return CreateSecurityDescription(SecuritySummaryColor::RED,
SecuritySummaryColor::RED, IDS_PAGE_INFO_SOCIAL_ENGINEERING_SUMMARY, IDS_PAGE_INFO_SOCIAL_ENGINEERING_SUMMARY,
IDS_PAGE_INFO_SOCIAL_ENGINEERING_DETAILS); IDS_PAGE_INFO_SOCIAL_ENGINEERING_DETAILS,
SecurityDescriptionType::SAFE_BROWSING);
case PageInfo::SAFE_BROWSING_STATUS_UNWANTED_SOFTWARE: case PageInfo::SAFE_BROWSING_STATUS_UNWANTED_SOFTWARE:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_UNWANTED_SOFTWARE_SUMMARY, IDS_PAGE_INFO_UNWANTED_SOFTWARE_SUMMARY,
IDS_PAGE_INFO_UNWANTED_SOFTWARE_DETAILS); IDS_PAGE_INFO_UNWANTED_SOFTWARE_DETAILS,
SecurityDescriptionType::SAFE_BROWSING);
case PageInfo::SAFE_BROWSING_STATUS_SAVED_PASSWORD_REUSE: case PageInfo::SAFE_BROWSING_STATUS_SAVED_PASSWORD_REUSE:
case PageInfo::SAFE_BROWSING_STATUS_SIGNED_IN_SYNC_PASSWORD_REUSE: case PageInfo::SAFE_BROWSING_STATUS_SIGNED_IN_SYNC_PASSWORD_REUSE:
case PageInfo::SAFE_BROWSING_STATUS_SIGNED_IN_NON_SYNC_PASSWORD_REUSE: case PageInfo::SAFE_BROWSING_STATUS_SIGNED_IN_NON_SYNC_PASSWORD_REUSE:
...@@ -276,7 +281,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -276,7 +281,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
case PageInfo::SAFE_BROWSING_STATUS_BILLING: case PageInfo::SAFE_BROWSING_STATUS_BILLING:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_BILLING_SUMMARY, IDS_PAGE_INFO_BILLING_SUMMARY,
IDS_PAGE_INFO_BILLING_DETAILS); IDS_PAGE_INFO_BILLING_DETAILS,
SecurityDescriptionType::SAFE_BROWSING);
} }
switch (identity_info.safety_tip_status) { switch (identity_info.safety_tip_status) {
...@@ -284,7 +290,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -284,7 +290,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
return CreateSecurityDescription( return CreateSecurityDescription(
SecuritySummaryColor::RED, SecuritySummaryColor::RED,
IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE, IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE,
IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION); IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION,
SecurityDescriptionType::SAFETY_TIP);
case security_state::SafetyTipStatus::kLookalike: case security_state::SafetyTipStatus::kLookalike:
// Lookalikes have their own strings, but they're suggestions, not // Lookalikes have their own strings, but they're suggestions, not
// warnings, so we leave Page Info alone. // warnings, so we leave Page Info alone.
...@@ -301,9 +308,9 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -301,9 +308,9 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// We provide identical summary and detail strings for Android, which // We provide identical summary and detail strings for Android, which
// deduplicates them in the UI code. // deduplicates them in the UI code.
return CreateSecurityDescription(SecuritySummaryColor::GREEN, return CreateSecurityDescription(
IDS_PAGE_INFO_INTERNAL_PAGE, SecuritySummaryColor::GREEN, IDS_PAGE_INFO_INTERNAL_PAGE,
IDS_PAGE_INFO_INTERNAL_PAGE); IDS_PAGE_INFO_INTERNAL_PAGE, SecurityDescriptionType::INTERNAL);
#else #else
// Internal pages on desktop have their own UI implementations which // Internal pages on desktop have their own UI implementations which
// should never call this function. // should never call this function.
...@@ -319,23 +326,28 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -319,23 +326,28 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE: case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_NOT_SECURE_SUMMARY, IDS_PAGE_INFO_NOT_SECURE_SUMMARY,
IDS_PAGE_INFO_NOT_SECURE_DETAILS); IDS_PAGE_INFO_NOT_SECURE_DETAILS,
SecurityDescriptionType::CONNECTION);
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION: case PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY, IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY,
IDS_PAGE_INFO_NOT_SECURE_DETAILS); IDS_PAGE_INFO_NOT_SECURE_DETAILS,
SecurityDescriptionType::CONNECTION);
case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE: case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY, IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY,
IDS_PAGE_INFO_MIXED_CONTENT_DETAILS); IDS_PAGE_INFO_MIXED_CONTENT_DETAILS,
SecurityDescriptionType::CONNECTION);
case PageInfo::SITE_CONNECTION_STATUS_LEGACY_TLS: case PageInfo::SITE_CONNECTION_STATUS_LEGACY_TLS:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY, IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY,
IDS_PAGE_INFO_LEGACY_TLS_DETAILS); IDS_PAGE_INFO_LEGACY_TLS_DETAILS,
SecurityDescriptionType::CONNECTION);
default: default:
return CreateSecurityDescription(SecuritySummaryColor::GREEN, return CreateSecurityDescription(SecuritySummaryColor::GREEN,
IDS_PAGE_INFO_SECURE_SUMMARY, IDS_PAGE_INFO_SECURE_SUMMARY,
IDS_PAGE_INFO_SECURE_DETAILS); IDS_PAGE_INFO_SECURE_DETAILS,
SecurityDescriptionType::CONNECTION);
} }
case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM: case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM:
case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN: case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN:
...@@ -343,7 +355,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { ...@@ -343,7 +355,8 @@ PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const {
default: default:
return CreateSecurityDescription(SecuritySummaryColor::RED, return CreateSecurityDescription(SecuritySummaryColor::RED,
IDS_PAGE_INFO_NOT_SECURE_SUMMARY, IDS_PAGE_INFO_NOT_SECURE_SUMMARY,
IDS_PAGE_INFO_NOT_SECURE_DETAILS); IDS_PAGE_INFO_NOT_SECURE_DETAILS,
SecurityDescriptionType::CONNECTION);
} }
} }
......
...@@ -43,6 +43,19 @@ class PageInfoUI { ...@@ -43,6 +43,19 @@ class PageInfoUI {
GREEN, GREEN,
}; };
enum class SecurityDescriptionType {
// The UI describes whether the connection is secure, e.g. secure
// HTTPS, non-secure HTTP.
CONNECTION,
// The UI describes e.g. an internal (chrome://) page or extension page.
INTERNAL,
// The UI describes a Safe Browsing warning, e.g. site deceptive or contains
// malware.
SAFE_BROWSING,
// The UI shows a Safety Tip.
SAFETY_TIP,
};
struct SecurityDescription { struct SecurityDescription {
// The text style for |summary| used to color it. This provides an // The text style for |summary| used to color it. This provides an
// opinionated guide to the user on the overall security state of the site. // opinionated guide to the user on the overall security state of the site.
...@@ -52,6 +65,9 @@ class PageInfoUI { ...@@ -52,6 +65,9 @@ class PageInfoUI {
// A short paragraph with more details about the state, and how // A short paragraph with more details about the state, and how
// the user should treat it. // the user should treat it.
base::string16 details; base::string16 details;
// The category of the security description, used to determine which help
// center article to link to.
SecurityDescriptionType type;
}; };
// |CookieInfo| contains information about the cookies from a specific source. // |CookieInfo| contains information about the cookies from a specific source.
......
...@@ -116,6 +116,7 @@ class MockPageInfoUI : public PageInfoUI { ...@@ -116,6 +116,7 @@ class MockPageInfoUI : public PageInfoUI {
l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_SUMMARY); l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_SUMMARY);
security_description->details = security_description->details =
l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS); l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS);
security_description->type = SecurityDescriptionType::SAFE_BROWSING;
return security_description; return security_description;
} }
#endif #endif
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/certificate_viewer.h" #include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/lookalikes/safety_tips/safety_tip_ui_helper.h"
#include "chrome/browser/platform_util.h" #include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ssl/security_state_tab_helper.h"
...@@ -734,8 +735,8 @@ void PageInfoBubbleView::SetIdentityInfo(const IdentityInfo& identity_info) { ...@@ -734,8 +735,8 @@ void PageInfoBubbleView::SetIdentityInfo(const IdentityInfo& identity_info) {
std::unique_ptr<PageInfoUI::SecurityDescription> security_description = std::unique_ptr<PageInfoUI::SecurityDescription> security_description =
GetSecurityDescription(identity_info); GetSecurityDescription(identity_info);
// Set the bubble title, update the title label text, then apply color.
set_window_title(security_description->summary); set_window_title(security_description->summary);
set_security_description(*security_description);
GetBubbleFrameView()->UpdateWindowTitle(); GetBubbleFrameView()->UpdateWindowTitle();
int text_style = views::style::STYLE_PRIMARY; int text_style = views::style::STYLE_PRIMARY;
switch (security_description->summary_style) { switch (security_description->summary_style) {
...@@ -926,6 +927,7 @@ PageInfoBubbleView::CreateSecurityDescriptionForPasswordReuse() const { ...@@ -926,6 +927,7 @@ PageInfoBubbleView::CreateSecurityDescriptionForPasswordReuse() const {
GetPasswordProtectionService(profile_); GetPasswordProtectionService(profile_);
security_description->details = service->GetWarningDetailText( security_description->details = service->GetWarningDetailText(
service->reused_password_account_type_for_last_shown_warning()); service->reused_password_account_type_for_last_shown_warning());
security_description->type = SecurityDescriptionType::SAFE_BROWSING;
return security_description; return security_description;
} }
#endif #endif
...@@ -985,12 +987,16 @@ void PageInfoBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, ...@@ -985,12 +987,16 @@ void PageInfoBubbleView::StyledLabelLinkClicked(views::StyledLabel* label,
int event_flags) { int event_flags) {
switch (label->GetID()) { switch (label->GetID()) {
case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LABEL_SECURITY_DETAILS: case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LABEL_SECURITY_DETAILS:
web_contents()->OpenURL(content::OpenURLParams( if (GetSecurityDetails().type == SecurityDescriptionType::SAFETY_TIP) {
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), safety_tips::OpenHelpCenter(web_contents());
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, } else {
false)); web_contents()->OpenURL(content::OpenURLParams(
presenter_->RecordPageInfoAction( GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(),
PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
false));
presenter_->RecordPageInfoAction(
PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
}
break; break;
case PageInfoBubbleView:: case PageInfoBubbleView::
VIEW_ID_PAGE_INFO_LABEL_RESET_CERTIFICATE_DECISIONS: VIEW_ID_PAGE_INFO_LABEL_RESET_CERTIFICATE_DECISIONS:
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/ui/page_info/page_info_dialog.h" #include "chrome/browser/ui/page_info/page_info_dialog.h"
#include "chrome/browser/ui/page_info/page_info_ui.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/buildflags.h" #include "ui/base/buildflags.h"
...@@ -71,6 +72,11 @@ void PageInfoBubbleViewBase::OnWidgetDestroying(views::Widget* widget) { ...@@ -71,6 +72,11 @@ void PageInfoBubbleViewBase::OnWidgetDestroying(views::Widget* widget) {
g_page_info_bubble = nullptr; g_page_info_bubble = nullptr;
} }
PageInfoUI::SecurityDescription PageInfoBubbleViewBase::GetSecurityDetails()
const {
return security_description_;
}
void PageInfoBubbleViewBase::RenderFrameDeleted( void PageInfoBubbleViewBase::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) { content::RenderFrameHost* render_frame_host) {
if (render_frame_host == web_contents()->GetMainFrame()) { if (render_frame_host == web_contents()->GetMainFrame()) {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_BASE_H_ #ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_BASE_H_
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_BASE_H_ #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_BASE_H_
#include "chrome/browser/ui/page_info/page_info_ui.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
...@@ -56,7 +57,12 @@ class PageInfoBubbleViewBase : public views::BubbleDialogDelegateView, ...@@ -56,7 +57,12 @@ class PageInfoBubbleViewBase : public views::BubbleDialogDelegateView,
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
void OnWidgetDestroying(views::Widget* widget) override; void OnWidgetDestroying(views::Widget* widget) override;
PageInfoUI::SecurityDescription GetSecurityDetails() const;
void set_window_title(const base::string16& title) { window_title_ = title; } void set_window_title(const base::string16& title) { window_title_ = title; }
void set_security_description(
const PageInfoUI::SecurityDescription& description) {
security_description_ = description;
}
private: private:
// WebContentsObserver: // WebContentsObserver:
...@@ -66,6 +72,7 @@ class PageInfoBubbleViewBase : public views::BubbleDialogDelegateView, ...@@ -66,6 +72,7 @@ class PageInfoBubbleViewBase : public views::BubbleDialogDelegateView,
void DidChangeVisibleSecurityState() override; void DidChangeVisibleSecurityState() override;
base::string16 window_title_; base::string16 window_title_;
PageInfoUI::SecurityDescription security_description_;
DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewBase); DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewBase);
}; };
......
...@@ -88,6 +88,9 @@ class PageInfoBubbleViewTestApi { ...@@ -88,6 +88,9 @@ class PageInfoBubbleViewTestApi {
views::Widget::ClosedReason closed_reason() const { return *closed_reason_; } views::Widget::ClosedReason closed_reason() const { return *closed_reason_; }
base::string16 GetWindowTitle() { return view_->GetWindowTitle(); } base::string16 GetWindowTitle() { return view_->GetWindowTitle(); }
PageInfoUI::SecurityDescription GetSecurityDetails() {
return view_->GetSecurityDetails();
}
PermissionSelectorRow* GetPermissionSelectorAt(int index) { PermissionSelectorRow* GetPermissionSelectorAt(int index) {
return view_->selector_rows_[index].get(); return view_->selector_rows_[index].get();
...@@ -682,6 +685,8 @@ TEST_F(PageInfoBubbleViewTest, OpenPageInfoBubbleAfterNavigationStart) { ...@@ -682,6 +685,8 @@ TEST_F(PageInfoBubbleViewTest, OpenPageInfoBubbleAfterNavigationStart) {
api_->CreateView(); api_->CreateView();
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PAGE_INFO_NOT_SECURE_SUMMARY), EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PAGE_INFO_NOT_SECURE_SUMMARY),
api_->GetWindowTitle()); api_->GetWindowTitle());
EXPECT_EQ(PageInfoUI::SecurityDescriptionType::CONNECTION,
api_->GetSecurityDetails().type);
// Set up a test SSLInfo so that Page Info sees the connection as secure. // Set up a test SSLInfo so that Page Info sees the connection as secure.
uint16_t cipher_suite = 0xc02f; // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16_t cipher_suite = 0xc02f; // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
...@@ -700,6 +705,8 @@ TEST_F(PageInfoBubbleViewTest, OpenPageInfoBubbleAfterNavigationStart) { ...@@ -700,6 +705,8 @@ TEST_F(PageInfoBubbleViewTest, OpenPageInfoBubbleAfterNavigationStart) {
navigation->Commit(); navigation->Commit();
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURE_SUMMARY), EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURE_SUMMARY),
api_->GetWindowTitle()); api_->GetWindowTitle());
EXPECT_EQ(PageInfoUI::SecurityDescriptionType::CONNECTION,
api_->GetSecurityDetails().type);
} }
TEST_F(PageInfoBubbleViewTest, EnsureCloseCallback) { TEST_F(PageInfoBubbleViewTest, EnsureCloseCallback) {
......
...@@ -232,22 +232,26 @@ class SafetyTipPageInfoBubbleViewBrowserTest ...@@ -232,22 +232,26 @@ class SafetyTipPageInfoBubbleViewBrowserTest
} }
OpenPageInfoBubble(browser); OpenPageInfoBubble(browser);
views::BubbleDialogDelegateView* page_info = auto* page_info = static_cast<SafetyTipPageInfoBubbleView*>(
PageInfoBubbleViewBase::GetPageInfoBubbleForTesting(); PageInfoBubbleViewBase::GetPageInfoBubbleForTesting());
ASSERT_TRUE(page_info); ASSERT_TRUE(page_info);
EXPECT_EQ(page_info->GetWindowTitle(), EXPECT_EQ(page_info->GetWindowTitle(),
l10n_util::GetStringUTF16( l10n_util::GetStringUTF16(
IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE)); IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE));
EXPECT_EQ(page_info->GetSecurityDetails().type,
PageInfoUI::SecurityDescriptionType::SAFETY_TIP);
} }
void CheckPageInfoDoesNotShowSafetyTipInfo(Browser* browser) { void CheckPageInfoDoesNotShowSafetyTipInfo(Browser* browser) {
OpenPageInfoBubble(browser); OpenPageInfoBubble(browser);
views::BubbleDialogDelegateView* page_info = auto* page_info = static_cast<SafetyTipPageInfoBubbleView*>(
PageInfoBubbleViewBase::GetPageInfoBubbleForTesting(); PageInfoBubbleViewBase::GetPageInfoBubbleForTesting());
ASSERT_TRUE(page_info); ASSERT_TRUE(page_info);
EXPECT_NE(page_info->GetWindowTitle(), EXPECT_NE(page_info->GetWindowTitle(),
l10n_util::GetStringUTF16( l10n_util::GetStringUTF16(
IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE)); IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE));
EXPECT_NE(page_info->GetSecurityDetails().type,
PageInfoUI::SecurityDescriptionType::SAFETY_TIP);
} }
private: private:
......
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