Chromium Code Reviews| Index: chrome/browser/ui/page_info/page_info_unittest.cc |
| diff --git a/chrome/browser/ui/page_info/website_settings_unittest.cc b/chrome/browser/ui/page_info/page_info_unittest.cc |
| similarity index 76% |
| rename from chrome/browser/ui/page_info/website_settings_unittest.cc |
| rename to chrome/browser/ui/page_info/page_info_unittest.cc |
| index 2331dcb478b3afd91216a1773350e65f009226ff..67d9762752a598d01980bddbae9fcdf12cbaa4c4 100644 |
| --- a/chrome/browser/ui/page_info/website_settings_unittest.cc |
| +++ b/chrome/browser/ui/page_info/page_info_unittest.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/ui/page_info/website_settings.h" |
| +#include "chrome/browser/ui/page_info/page_info.h" |
| #include <string> |
| #include <vector> |
| @@ -17,7 +17,7 @@ |
| #include "build/build_config.h" |
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| #include "chrome/browser/infobars/infobar_service.h" |
| -#include "chrome/browser/ui/page_info/website_settings_ui.h" |
| +#include "chrome/browser/ui/page_info/page_info_ui.h" |
| #include "chrome/browser/usb/usb_chooser_context.h" |
| #include "chrome/browser/usb/usb_chooser_context_factory.h" |
| #include "chrome/grit/theme_resources.h" |
| @@ -68,9 +68,9 @@ int SetSSLCipherSuite(int connection_status, int cipher_suite) { |
| return cipher_suite | connection_status; |
| } |
| -class MockWebsiteSettingsUI : public WebsiteSettingsUI { |
| +class MockPageInfoUI : public PageInfoUI { |
| public: |
| - virtual ~MockWebsiteSettingsUI() {} |
| + virtual ~MockPageInfoUI() {} |
| MOCK_METHOD1(SetCookieInfo, void(const CookieInfoList& cookie_info_list)); |
| MOCK_METHOD0(SetPermissionInfoStub, void()); |
| MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info)); |
| @@ -90,11 +90,11 @@ class MockWebsiteSettingsUI : public WebsiteSettingsUI { |
| set_permission_info_callback_; |
| }; |
| -class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
| +class PageInfoTest : public ChromeRenderViewHostTestHarness { |
| public: |
| - WebsiteSettingsTest() : url_("http://www.example.com") {} |
| + PageInfoTest() : url_("http://www.example.com") {} |
| - ~WebsiteSettingsTest() override {} |
| + ~PageInfoTest() override {} |
| void SetUp() override { |
| ChromeRenderViewHostTestHarness::SetUp(); |
| @@ -111,22 +111,21 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
| InfoBarService::CreateForWebContents(web_contents()); |
| // Setup mock ui. |
| - mock_ui_.reset(new MockWebsiteSettingsUI()); |
| + mock_ui_.reset(new MockPageInfoUI()); |
| // Use this rather than gmock's ON_CALL.WillByDefault(Invoke(... because |
| // gmock doesn't handle move-only types well. |
| - mock_ui_->set_permission_info_callback_ = base::Bind( |
| - &WebsiteSettingsTest::SetPermissionInfo, base::Unretained(this)); |
| + mock_ui_->set_permission_info_callback_ = |
| + base::Bind(&PageInfoTest::SetPermissionInfo, base::Unretained(this)); |
| } |
| void TearDown() override { |
| - ASSERT_TRUE(website_settings_.get()) |
| - << "No WebsiteSettings instance created."; |
| + ASSERT_TRUE(website_settings_.get()) << "No PageInfo instance created."; |
|
estark
2017/03/20 20:19:17
do |website_settings_| and its getter need to be r
lgarron
2017/03/24 05:55:20
Done in the latest patch.
|
| RenderViewHostTestHarness::TearDown(); |
| website_settings_.reset(); |
| } |
| - void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) { |
| - // During creation |WebsiteSettings| makes the following calls to the ui. |
| + void SetDefaultUIExpectations(MockPageInfoUI* mock_ui) { |
| + // During creation |PageInfo| makes the following calls to the ui. |
| EXPECT_CALL(*mock_ui, SetPermissionInfoStub()); |
| EXPECT_CALL(*mock_ui, SetIdentityInfo(_)); |
| EXPECT_CALL(*mock_ui, SetCookieInfo(_)); |
| @@ -141,15 +140,15 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
| last_chosen_object_info_.push_back(std::move(chosen_object_info)); |
| } |
| - void ResetMockUI() { mock_ui_.reset(new MockWebsiteSettingsUI()); } |
| + void ResetMockUI() { mock_ui_.reset(new MockPageInfoUI()); } |
| - void ClearWebsiteSettings() { website_settings_.reset(nullptr); } |
| + void ClearPageInfo() { website_settings_.reset(nullptr); } |
| const GURL& url() const { return url_; } |
| scoped_refptr<net::X509Certificate> cert() { return cert_; } |
| - MockWebsiteSettingsUI* mock_ui() { return mock_ui_.get(); } |
| + MockPageInfoUI* mock_ui() { return mock_ui_.get(); } |
| const security_state::SecurityInfo& security_info() { return security_info_; } |
| - const std::vector<std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>>& |
| + const std::vector<std::unique_ptr<PageInfoUI::ChosenObjectInfo>>& |
| last_chosen_object_info() { |
| return last_chosen_object_info_; |
| } |
| @@ -160,11 +159,11 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
| return InfoBarService::FromWebContents(web_contents()); |
| } |
| - WebsiteSettings* website_settings() { |
| + PageInfo* website_settings() { |
| if (!website_settings_.get()) { |
| - website_settings_.reset(new WebsiteSettings( |
| - mock_ui(), profile(), tab_specific_content_settings(), web_contents(), |
| - url(), security_info())); |
| + website_settings_.reset( |
| + new PageInfo(mock_ui(), profile(), tab_specific_content_settings(), |
| + web_contents(), url(), security_info())); |
| } |
| return website_settings_.get(); |
| } |
| @@ -177,17 +176,17 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
| private: |
| device::MockDeviceClient device_client_; |
| - std::unique_ptr<WebsiteSettings> website_settings_; |
| - std::unique_ptr<MockWebsiteSettingsUI> mock_ui_; |
| + std::unique_ptr<PageInfo> website_settings_; |
| + std::unique_ptr<MockPageInfoUI> mock_ui_; |
| scoped_refptr<net::X509Certificate> cert_; |
| GURL url_; |
| - std::vector<std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>> |
| + std::vector<std::unique_ptr<PageInfoUI::ChosenObjectInfo>> |
| last_chosen_object_info_; |
| }; |
| } // namespace |
| -TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { |
| +TEST_F(PageInfoTest, OnPermissionsChanged) { |
| // Setup site permissions. |
| HostContentSettingsMap* content_settings = |
| HostContentSettingsMapFactory::GetForProfile(profile()); |
| @@ -263,7 +262,7 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { |
| EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); |
| } |
| -TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) { |
| +TEST_F(PageInfoTest, OnSiteDataAccessed) { |
| EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()); |
| EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); |
| EXPECT_CALL(*mock_ui(), SetCookieInfo(_)).Times(2); |
| @@ -271,7 +270,7 @@ TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) { |
| website_settings()->OnSiteDataAccessed(); |
| } |
| -TEST_F(WebsiteSettingsTest, OnChosenObjectDeleted) { |
| +TEST_F(PageInfoTest, OnChosenObjectDeleted) { |
| scoped_refptr<device::UsbDevice> device = |
| new device::MockUsbDevice(0, 0, "Google", "Gizmo", "1234567890"); |
| usb_service().AddDevice(device); |
| @@ -281,67 +280,66 @@ TEST_F(WebsiteSettingsTest, OnChosenObjectDeleted) { |
| EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); |
| EXPECT_CALL(*mock_ui(), SetCookieInfo(_)); |
| - // Access WebsiteSettings so that SetPermissionInfo is called once to populate |
| + // Access PageInfo so that SetPermissionInfo is called once to populate |
| // |last_chosen_object_info_|. It will be called again by |
| // OnSiteChosenObjectDeleted. |
| EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(2); |
| website_settings(); |
| ASSERT_EQ(1u, last_chosen_object_info().size()); |
| - const WebsiteSettingsUI::ChosenObjectInfo* info = |
| - last_chosen_object_info()[0].get(); |
| + const PageInfoUI::ChosenObjectInfo* info = last_chosen_object_info()[0].get(); |
| website_settings()->OnSiteChosenObjectDeleted(info->ui_info, *info->object); |
| EXPECT_FALSE(store->HasDevicePermission(url(), url(), device)); |
| EXPECT_EQ(0u, last_chosen_object_info().size()); |
| } |
| -TEST_F(WebsiteSettingsTest, Malware) { |
| +TEST_F(PageInfoTest, Malware) { |
| security_info_.security_level = security_state::DANGEROUS; |
| security_info_.malicious_content_status = |
| security_state::MALICIOUS_CONTENT_STATUS_MALWARE; |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_MALWARE, |
| website_settings()->site_identity_status()); |
| } |
| -TEST_F(WebsiteSettingsTest, SocialEngineering) { |
| +TEST_F(PageInfoTest, SocialEngineering) { |
| security_info_.security_level = security_state::DANGEROUS; |
| security_info_.malicious_content_status = |
| security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING; |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING, |
| website_settings()->site_identity_status()); |
| } |
| -TEST_F(WebsiteSettingsTest, UnwantedSoftware) { |
| +TEST_F(PageInfoTest, UnwantedSoftware) { |
| security_info_.security_level = security_state::DANGEROUS; |
| security_info_.malicious_content_status = |
| security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE, |
| website_settings()->site_identity_status()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPConnection) { |
| +TEST_F(PageInfoTest, HTTPConnection) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_NO_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSConnection) { |
| +TEST_F(PageInfoTest, HTTPSConnection) { |
| security_info_.security_level = security_state::SECURE; |
| security_info_.scheme_is_cryptographic = true; |
| security_info_.certificate = cert(); |
| @@ -354,21 +352,21 @@ TEST_F(WebsiteSettingsTest, HTTPSConnection) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, InsecureContent) { |
| +TEST_F(PageInfoTest, InsecureContent) { |
| struct TestCase { |
| security_state::SecurityLevel security_level; |
| net::CertStatus cert_status; |
| security_state::ContentStatus mixed_content_status; |
| security_state::ContentStatus content_with_cert_errors_status; |
| - WebsiteSettings::SiteConnectionStatus expected_site_connection_status; |
| - WebsiteSettings::SiteIdentityStatus expected_site_identity_status; |
| + PageInfo::SiteConnectionStatus expected_site_connection_status; |
| + PageInfo::SiteIdentityStatus expected_site_identity_status; |
| int expected_connection_icon_id; |
| }; |
| @@ -376,43 +374,43 @@ TEST_F(WebsiteSettingsTest, InsecureContent) { |
| // Passive mixed content. |
| {security_state::NONE, 0, security_state::CONTENT_STATUS_DISPLAYED, |
| security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| // Passive mixed content with a cert error on the main resource. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR}, |
| // Active and passive mixed content. |
| {security_state::DANGEROUS, 0, |
| security_state::CONTENT_STATUS_DISPLAYED_AND_RAN, |
| security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Active and passive mixed content with a cert error on the main |
| // resource. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_DISPLAYED_AND_RAN, |
| security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD}, |
| // Active mixed content. |
| {security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_RAN, |
| security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Active mixed content with a cert error on the main resource. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_RAN, security_state::CONTENT_STATUS_NONE, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_BAD}, |
| // Passive subresources with cert errors. |
| {security_state::NONE, 0, security_state::CONTENT_STATUS_NONE, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| // Passive subresources with cert errors, with a cert error on the |
| // main resource also. In this case, the subresources with |
| // certificate errors are ignored: if the main resource had a cert |
| @@ -421,59 +419,59 @@ TEST_F(WebsiteSettingsTest, InsecureContent) { |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_NONE, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| + PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| // Passive and active subresources with cert errors. |
| {security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_NONE, |
| security_state::CONTENT_STATUS_DISPLAYED_AND_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Passive and active subresources with cert errors, with a cert |
| // error on the main resource also. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_NONE, |
| security_state::CONTENT_STATUS_DISPLAYED_AND_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| + PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| // Active subresources with cert errors. |
| {security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_NONE, |
| security_state::CONTENT_STATUS_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Active subresources with cert errors, with a cert error on the main |
| // resource also. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_NONE, security_state::CONTENT_STATUS_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| + PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_GOOD}, |
| // Passive mixed content and subresources with cert errors. |
| {security_state::NONE, 0, security_state::CONTENT_STATUS_DISPLAYED, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_WARNING_MINOR}, |
| // Passive mixed content and active subresources with cert errors. |
| {security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_DISPLAYED, |
| security_state::CONTENT_STATUS_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Active mixed content and passive subresources with cert errors. |
| {security_state::DANGEROUS, 0, security_state::CONTENT_STATUS_RAN, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_CERT, IDR_PAGEINFO_BAD}, |
| // Passive mixed content, active subresources with cert errors, and a cert |
| // error on the main resource. |
| {security_state::DANGEROUS, net::CERT_STATUS_DATE_INVALID, |
| security_state::CONTENT_STATUS_DISPLAYED, |
| security_state::CONTENT_STATUS_RAN, |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - WebsiteSettings::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR}, |
| + PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + PageInfo::SITE_IDENTITY_STATUS_ERROR, IDR_PAGEINFO_WARNING_MINOR}, |
| }; |
| for (const auto& test : kTestCases) { |
| ResetMockUI(); |
| - ClearWebsiteSettings(); |
| + ClearPageInfo(); |
| security_info_ = security_state::SecurityInfo(); |
| security_info_.security_level = test.security_level; |
| security_info_.scheme_is_cryptographic = true; |
| @@ -495,13 +493,13 @@ TEST_F(WebsiteSettingsTest, InsecureContent) { |
| EXPECT_EQ(test.expected_site_identity_status, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(test.expected_connection_icon_id, |
| - WebsiteSettingsUI::GetConnectionIconID( |
| + PageInfoUI::GetConnectionIconID( |
| website_settings()->site_connection_status())); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSEVCert) { |
| +TEST_F(PageInfoTest, HTTPSEVCert) { |
| scoped_refptr<net::X509Certificate> ev_cert = |
| net::X509Certificate::CreateFromBytes( |
| reinterpret_cast<const char*>(google_der), sizeof(google_der)); |
| @@ -520,16 +518,15 @@ TEST_F(WebsiteSettingsTest, HTTPSEVCert) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ( |
| - WebsiteSettings::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| - website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, |
| + website_settings()->site_connection_status()); |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_EV_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::UTF8ToUTF16("Google Inc"), |
| website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSRevocationError) { |
| +TEST_F(PageInfoTest, HTTPSRevocationError) { |
| security_info_.security_level = security_state::SECURE; |
| security_info_.scheme_is_cryptographic = true; |
| security_info_.certificate = cert(); |
| @@ -542,14 +539,14 @@ TEST_F(WebsiteSettingsTest, HTTPSRevocationError) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSConnectionError) { |
| +TEST_F(PageInfoTest, HTTPSConnectionError) { |
| security_info_.security_level = security_state::SECURE; |
| security_info_.scheme_is_cryptographic = true; |
| security_info_.certificate = cert(); |
| @@ -562,14 +559,14 @@ TEST_F(WebsiteSettingsTest, HTTPSConnectionError) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSPolicyCertConnection) { |
| +TEST_F(PageInfoTest, HTTPSPolicyCertConnection) { |
| security_info_.security_level = |
| security_state::SECURE_WITH_POLICY_INSTALLED_CERT; |
| security_info_.scheme_is_cryptographic = true; |
| @@ -583,14 +580,14 @@ TEST_F(WebsiteSettingsTest, HTTPSPolicyCertConnection) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -TEST_F(WebsiteSettingsTest, HTTPSSHA1) { |
| +TEST_F(PageInfoTest, HTTPSSHA1) { |
| security_info_.security_level = security_state::NONE; |
| security_info_.scheme_is_cryptographic = true; |
| security_info_.certificate = cert(); |
| @@ -604,26 +601,25 @@ TEST_F(WebsiteSettingsTest, HTTPSSHA1) { |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_ENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ( |
| - WebsiteSettings::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM, |
| - website_settings()->site_identity_status()); |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM, |
| + website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| EXPECT_EQ(IDR_PAGEINFO_WARNING_MINOR, |
| - WebsiteSettingsUI::GetIdentityIconID( |
| + PageInfoUI::GetIdentityIconID( |
| website_settings()->site_identity_status())); |
| } |
| #if !defined(OS_ANDROID) |
| -TEST_F(WebsiteSettingsTest, NoInfoBar) { |
| +TEST_F(PageInfoTest, NoInfoBar) { |
| SetDefaultUIExpectations(mock_ui()); |
| EXPECT_EQ(0u, infobar_service()->infobar_count()); |
| website_settings()->OnUIClosing(); |
| EXPECT_EQ(0u, infobar_service()->infobar_count()); |
| } |
| -TEST_F(WebsiteSettingsTest, ShowInfoBar) { |
| +TEST_F(PageInfoTest, ShowInfoBar) { |
| EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); |
| EXPECT_CALL(*mock_ui(), SetCookieInfo(_)); |
| @@ -639,33 +635,33 @@ TEST_F(WebsiteSettingsTest, ShowInfoBar) { |
| } |
| #endif |
| -TEST_F(WebsiteSettingsTest, AboutBlankPage) { |
| +TEST_F(PageInfoTest, AboutBlankPage) { |
| SetURL("about:blank"); |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_UNENCRYPTED, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_NO_CERT, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| -// On desktop, internal URLs aren't handled by WebsiteSettings class. Instead, a |
| +// On desktop, internal URLs aren't handled by PageInfo class. Instead, a |
| // custom and simpler popup is shown, so no need to test. |
| #if defined(OS_ANDROID) || defined(OS_IOS) |
| -TEST_F(WebsiteSettingsTest, InternalPage) { |
| +TEST_F(PageInfoTest, InternalPage) { |
| SetURL("chrome://bookmarks"); |
| SetDefaultUIExpectations(mock_ui()); |
| - EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, |
| + EXPECT_EQ(PageInfo::SITE_CONNECTION_STATUS_INTERNAL_PAGE, |
| website_settings()->site_connection_status()); |
| - EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, |
| + EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE, |
| website_settings()->site_identity_status()); |
| EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| } |
| #endif |
| -// Tests that metrics are recorded on a WebsiteSettings for pages with |
| +// Tests that metrics are recorded on a PageInfo for pages with |
| // various security levels. |
| -TEST_F(WebsiteSettingsTest, SecurityLevelMetrics) { |
| +TEST_F(PageInfoTest, SecurityLevelMetrics) { |
| struct TestCase { |
| const std::string url; |
| const security_state::SecurityLevel security_level; |
| @@ -695,26 +691,26 @@ TEST_F(WebsiteSettingsTest, SecurityLevelMetrics) { |
| SetURL(test.url); |
| security_info_.security_level = test.security_level; |
| ResetMockUI(); |
| - ClearWebsiteSettings(); |
| + ClearPageInfo(); |
| SetDefaultUIExpectations(mock_ui()); |
| histograms.ExpectTotalCount(kGenericHistogram, 0); |
| histograms.ExpectTotalCount(test.histogram_name, 0); |
| - website_settings()->RecordWebsiteSettingsAction( |
| - WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED); |
| + website_settings()->RecordPageInfoAction( |
| + PageInfo::PageInfoAction::WEBSITE_SETTINGS_OPENED); |
| - // RecordWebsiteSettingsAction() is called during WebsiteSettings |
| - // creation in addition to the explicit RecordWebsiteSettingsAction() |
| + // RecordPageInfoAction() is called during PageInfo |
| + // creation in addition to the explicit RecordPageInfoAction() |
| // call, so it is called twice in total. |
| histograms.ExpectTotalCount(kGenericHistogram, 2); |
| histograms.ExpectBucketCount( |
| - kGenericHistogram, |
| - WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED, 2); |
| + kGenericHistogram, PageInfo::PageInfoAction::WEBSITE_SETTINGS_OPENED, |
| + 2); |
| histograms.ExpectTotalCount(test.histogram_name, 2); |
| histograms.ExpectBucketCount( |
| - test.histogram_name, |
| - WebsiteSettings::WebsiteSettingsAction::WEBSITE_SETTINGS_OPENED, 2); |
| + test.histogram_name, PageInfo::PageInfoAction::WEBSITE_SETTINGS_OPENED, |
| + 2); |
| } |
| } |