Index: chrome/browser/ssl/security_state_tab_helper_browser_tests.cc |
diff --git a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc |
similarity index 89% |
rename from chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
rename to chrome/browser/ssl/security_state_tab_helper_browser_tests.cc |
index 48722009d0a37b9060ba2fad6fac4b3189854f30..240efff0e4791df8f05c4a51b1396b58c50586a4 100644 |
--- a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
+++ b/chrome/browser/ssl/security_state_tab_helper_browser_tests.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/ssl/chrome_security_state_model_client.h" |
+#include "chrome/browser/ssl/security_state_tab_helper.h" |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
@@ -10,7 +10,6 @@ |
#include "base/strings/string_split.h" |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/ssl/cert_verifier_browser_test.h" |
-#include "chrome/browser/ssl/chrome_security_state_model_client.h" |
#include "chrome/browser/ssl/ssl_blocking_page.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_commands.h" |
@@ -18,11 +17,11 @@ |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
-#include "chrome/grit/generated_resources.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "components/prefs/pref_service.h" |
-#include "components/security_state/switches.h" |
+#include "components/security_state/core/switches.h" |
+#include "components/strings/grit/components_strings.h" |
#include "content/public/browser/interstitial_page.h" |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/navigation_entry.h" |
@@ -130,7 +129,7 @@ void CheckBrokenSecurityStyle(const SecurityStyleTestObserver& observer, |
// Check the associated certificate. |
net::X509Certificate* cert = browser->tab_strip_model() |
->GetActiveWebContents() |
- ->GetController() |
+ ->GetController() |
.GetActiveEntry() |
->GetSSL() |
.certificate.get(); |
@@ -169,7 +168,7 @@ void CheckSecureExplanations( |
content::WebContents* web_contents = |
browser->tab_strip_model()->GetActiveWebContents(); |
SecurityStateModel::SecurityInfo security_info; |
- ChromeSecurityStateModelClient::FromWebContents(web_contents) |
+ SecurityStateTabHelper::FromWebContents(web_contents) |
->GetSecurityInfo(&security_info); |
const char *protocol, *key_exchange, *cipher, *mac; |
@@ -213,11 +212,11 @@ void CheckSecurityInfoForSecure( |
bool expect_cert_error) { |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(expect_security_level, security_info.security_level); |
EXPECT_EQ(expect_sha1_status, security_info.sha1_deprecation_status); |
EXPECT_EQ(expect_mixed_content_status, security_info.mixed_content_status); |
@@ -233,11 +232,11 @@ void CheckSecurityInfoForSecure( |
void CheckSecurityInfoForNonSecure(content::WebContents* contents) { |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); |
EXPECT_EQ(SecurityStateModel::NO_DEPRECATED_SHA1, |
security_info.sha1_deprecation_status); |
@@ -273,9 +272,9 @@ void GetFilePathWithHostAndPortReplacement( |
original_file_path, replacement_text, replacement_path); |
} |
-class ChromeSecurityStateModelClientTest : public CertVerifierBrowserTest { |
+class SecurityStateTabHelperTest : public CertVerifierBrowserTest { |
public: |
- ChromeSecurityStateModelClientTest() |
+ SecurityStateTabHelperTest() |
: https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { |
https_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
} |
@@ -300,7 +299,7 @@ class ChromeSecurityStateModelClientTest : public CertVerifierBrowserTest { |
net::EmbeddedTestServer https_server_; |
private: |
- DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClientTest); |
+ DISALLOW_COPY_AND_ASSIGN(SecurityStateTabHelperTest); |
}; |
GURL GetURLWithNonLocalHostname(net::EmbeddedTestServer* server, |
@@ -310,11 +309,11 @@ GURL GetURLWithNonLocalHostname(net::EmbeddedTestServer* server, |
return server->GetURL(path).ReplaceComponents(replace_host); |
} |
-class ChromeSecurityStateModelClientTestWithPasswordCcSwitch |
- : public ChromeSecurityStateModelClientTest { |
+class SecurityStateTabHelperTestWithPasswordCcSwitch |
+ : public SecurityStateTabHelperTest { |
public: |
- ChromeSecurityStateModelClientTestWithPasswordCcSwitch() |
- : ChromeSecurityStateModelClientTest() {} |
+ SecurityStateTabHelperTestWithPasswordCcSwitch() |
+ : SecurityStateTabHelperTest() {} |
void SetUpOnMainThread() override { |
ASSERT_TRUE(embedded_test_server()->Start()); |
@@ -324,15 +323,14 @@ class ChromeSecurityStateModelClientTestWithPasswordCcSwitch |
} |
void SetUpCommandLine(base::CommandLine* command_line) override { |
- ChromeSecurityStateModelClientTest::SetUpCommandLine(command_line); |
+ SecurityStateTabHelperTest::SetUpCommandLine(command_line); |
command_line->AppendSwitchASCII( |
security_state::switches::kMarkHttpAs, |
security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); |
} |
private: |
- DISALLOW_COPY_AND_ASSIGN( |
- ChromeSecurityStateModelClientTestWithPasswordCcSwitch); |
+ DISALLOW_COPY_AND_ASSIGN(SecurityStateTabHelperTestWithPasswordCcSwitch); |
}; |
class SecurityStyleChangedTest : public InProcessBrowserTest { |
@@ -354,7 +352,7 @@ class SecurityStyleChangedTest : public InProcessBrowserTest { |
DISALLOW_COPY_AND_ASSIGN(SecurityStyleChangedTest); |
}; |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpPage) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, HttpPage) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
ui_test_utils::NavigateToURL( |
browser(), embedded_test_server()->GetURL("/ssl/google.html")); |
@@ -362,11 +360,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpPage) { |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); |
EXPECT_EQ(SecurityStateModel::NO_DEPRECATED_SHA1, |
security_info.sha1_deprecation_status); |
@@ -380,7 +378,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpPage) { |
EXPECT_EQ(0, security_info.connection_status); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpsPage) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, HttpsPage) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -393,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpsPage) { |
false /* expect cert status error */); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, SHA1Broken) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, SHA1Broken) { |
ASSERT_TRUE(https_server_.Start()); |
// The test server uses a long-lived cert by default, so a SHA1 |
// signature in it will register as a "broken" condition rather than |
@@ -410,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, SHA1Broken) { |
false /* expect cert status error */); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, MixedContent) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -423,8 +421,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
// Navigate to an HTTPS page that displays mixed content. |
std::string replacement_path; |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_displays_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_displays_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -435,8 +433,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
// Navigate to an HTTPS page that displays mixed content dynamically. |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_with_dynamic_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_with_dynamic_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -457,9 +455,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
false /* expect cert status error */); |
// Navigate to an HTTPS page that runs mixed content. |
- GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_runs_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ GetFilePathWithHostAndPortReplacement("/ssl/page_runs_insecure_content.html", |
+ replacement_pair, &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -470,8 +467,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
// Navigate to an HTTPS page that runs and displays mixed content. |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_runs_and_displays_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_runs_and_displays_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -501,7 +498,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
false /* expect cert status error */); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, |
ActiveContentWithCertErrors) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -518,11 +515,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
entry->GetSSL().content_status |= |
content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS; |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(web_contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(web_contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); |
EXPECT_EQ(SecurityStateModel::DANGEROUS, security_info.security_level); |
@@ -530,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
security_info.content_with_cert_errors_status); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, |
PassiveContentWithCertErrors) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -547,11 +544,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
entry->GetSSL().content_status |= |
content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(web_contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(web_contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); |
EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); |
@@ -559,7 +556,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
security_info.content_with_cert_errors_status); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, |
ActiveAndPassiveContentWithCertErrors) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -578,11 +575,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
entry->GetSSL().content_status |= |
content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(web_contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(web_contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); |
EXPECT_EQ(SecurityStateModel::DANGEROUS, security_info.security_level); |
@@ -591,8 +588,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
} |
// Same as the test above but with a long-lived SHA1 cert. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
- MixedContentWithBrokenSHA1) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, MixedContentWithBrokenSHA1) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
ASSERT_TRUE(https_server_.Start()); |
// The test server uses a long-lived cert by default, so a SHA1 |
@@ -610,8 +606,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// Navigate to an HTTPS page that displays mixed content. |
std::string replacement_path; |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_displays_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_displays_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -622,8 +618,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// Navigate to an HTTPS page that displays mixed content dynamically. |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_with_dynamic_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_with_dynamic_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -644,9 +640,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
false /* expect cert status error */); |
// Navigate to an HTTPS page that runs mixed content. |
- GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_runs_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ GetFilePathWithHostAndPortReplacement("/ssl/page_runs_insecure_content.html", |
+ replacement_pair, &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -657,8 +652,8 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// Navigate to an HTTPS page that runs and displays mixed content. |
GetFilePathWithHostAndPortReplacement( |
- "/ssl/page_runs_and_displays_insecure_content.html", |
- replacement_pair, &replacement_path); |
+ "/ssl/page_runs_and_displays_insecure_content.html", replacement_pair, |
+ &replacement_path); |
ui_test_utils::NavigateToURL(browser(), |
https_server_.GetURL(replacement_path)); |
CheckSecurityInfoForSecure( |
@@ -670,8 +665,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// Tests that the Content Security Policy block-all-mixed-content |
// directive stops mixed content from running. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
- MixedContentStrictBlocking) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, MixedContentStrictBlocking) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -695,7 +689,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
false /* expect cert status error */); |
} |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, BrokenHTTPS) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, BrokenHTTPS) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_DATE_INVALID, |
@@ -734,7 +728,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, BrokenHTTPS) { |
const char kReportURI[] = "https://report-hpkp.test"; |
-class PKPModelClientTest : public ChromeSecurityStateModelClientTest { |
+class PKPModelClientTest : public SecurityStateTabHelperTest { |
public: |
void SetUpOnMainThread() override { |
ASSERT_TRUE(https_server_.Start()); |
@@ -845,10 +839,9 @@ void InstallLoadingInterceptor(const std::string& host) { |
std::unique_ptr<net::URLRequestInterceptor>(new PendingJobInterceptor())); |
} |
-class SecurityStateModelLoadingTest |
- : public ChromeSecurityStateModelClientTest { |
+class SecurityStateModelLoadingTest : public SecurityStateTabHelperTest { |
public: |
- SecurityStateModelLoadingTest() : ChromeSecurityStateModelClientTest() {} |
+ SecurityStateModelLoadingTest() : SecurityStateTabHelperTest() {} |
~SecurityStateModelLoadingTest() override{}; |
protected: |
@@ -888,73 +881,24 @@ IN_PROC_BROWSER_TEST_F(SecurityStateModelLoadingTest, NavigationStateChanges) { |
browser()->tab_strip_model()->GetActiveWebContents()); |
} |
-// Tests that the NavigationEntry's flags for nonsecure password/credit |
-// card inputs are reflected in the VisibleSecurityState. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
- VisibleSecurityStateNonsecureFormInputs) { |
- ASSERT_TRUE(https_server_.Start()); |
- ui_test_utils::NavigateToURL(browser(), |
- https_server_.GetURL("/ssl/google.html")); |
- |
- content::WebContents* contents = |
- browser()->tab_strip_model()->GetActiveWebContents(); |
- ASSERT_TRUE(contents); |
- |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
- |
- // First, test that if the flags aren't set on the NavigationEntry, |
- // then they also aren't set on the VisibleSecurityState. |
- content::SSLStatus& ssl_status = |
- contents->GetController().GetVisibleEntry()->GetSSL(); |
- ASSERT_FALSE(ssl_status.content_status & |
- content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
- ASSERT_FALSE(ssl_status.content_status & |
- content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); |
- SecurityStateModel::VisibleSecurityState |
- visible_security_state_no_sensitive_inputs; |
- model_client->GetVisibleSecurityState( |
- &visible_security_state_no_sensitive_inputs); |
- EXPECT_FALSE(visible_security_state_no_sensitive_inputs |
- .displayed_password_field_on_http); |
- EXPECT_FALSE(visible_security_state_no_sensitive_inputs |
- .displayed_credit_card_field_on_http); |
- |
- // Now, set the flags on the NavigationEntry and test that they are |
- // reflected in the VisibleSecurityState. |
- ssl_status.content_status |= |
- content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP; |
- ssl_status.content_status |= |
- content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP; |
- SecurityStateModel::VisibleSecurityState |
- visible_security_state_sensitive_inputs; |
- model_client->GetVisibleSecurityState( |
- &visible_security_state_sensitive_inputs); |
- EXPECT_TRUE( |
- visible_security_state_sensitive_inputs.displayed_password_field_on_http); |
- EXPECT_TRUE(visible_security_state_sensitive_inputs |
- .displayed_credit_card_field_on_http); |
-} |
- |
// Tests that when a visible password field is detected on an HTTP page |
// load, and when the command-line flag is set, the security level is |
// downgraded to HTTP_SHOW_WARNING. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
PasswordSecurityLevelDowngraded) { |
content::WebContents* contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
ui_test_utils::NavigateToURL( |
browser(), GetURLWithNonLocalHostname(embedded_test_server(), |
"/password/simple_password.html")); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -967,22 +911,22 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that when an invisible password field is present on an HTTP page |
// load, and when the command-line flag is set, the security level is |
// *not* downgraded to HTTP_SHOW_WARNING. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
PasswordSecurityLevelNotDowngradedForInvisibleInput) { |
content::WebContents* contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
ui_test_utils::NavigateToURL( |
browser(), |
GetURLWithNonLocalHostname(embedded_test_server(), |
"/password/invisible_password.html")); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::NONE, |
security_info.security_level); |
@@ -995,22 +939,22 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that when a visible password field is detected inside an iframe |
// on an HTTP page load, and when the command-line flag is set, the |
// security level is downgraded to HTTP_SHOW_WARNING. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
PasswordSecurityLevelDowngradedFromIframe) { |
content::WebContents* contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
ui_test_utils::NavigateToURL( |
browser(), |
GetURLWithNonLocalHostname(embedded_test_server(), |
"/password/simple_password_in_iframe.html")); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1024,15 +968,15 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// on an HTTP page load, and when the command-line flag is set, the |
// security level is downgraded to HTTP_SHOW_WARNING, even if the iframe |
// itself was loaded over HTTPS. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
PasswordSecurityLevelDowngradedFromHttpsIframe) { |
content::WebContents* contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
// Navigate to an HTTP URL, which loads an iframe using the host and port of |
// |https_server_|. |
@@ -1044,7 +988,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
browser(), |
GetURLWithNonLocalHostname(embedded_test_server(), replacement_path)); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1057,7 +1001,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that when a visible password field is detected on an HTTP page |
// load, and when the command-line flag is *not* set, the security level is |
// *not* downgraded to HTTP_SHOW_WARNING. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, |
PasswordSecurityLevelNotDowngradedWithoutSwitch) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); |
@@ -1066,9 +1010,9 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
ui_test_utils::NavigateToURL( |
browser(), GetURLWithNonLocalHostname(embedded_test_server(), |
@@ -1076,7 +1020,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// The security level should not be HTTP_SHOW_WARNING, because the |
// command-line switch was not set. |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::NONE, |
security_info.security_level); |
@@ -1090,15 +1034,15 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
// Tests that when a visible password field is detected on an HTTPS page |
// load, and when the command-line flag is set, the security level is |
// *not* downgraded to HTTP_SHOW_WARNING. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
PasswordSecurityLevelNotDowngradedOnHttps) { |
content::WebContents* contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
GURL url = GetURLWithNonLocalHostname(&https_server_, |
"/password/simple_password.html"); |
@@ -1106,7 +1050,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// The security level should not be HTTP_SHOW_WARNING, because the page was |
// HTTPS instead of HTTP. |
security_state::SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::SECURE, |
security_info.security_level); |
@@ -1186,7 +1130,7 @@ void CheckForOneFutureHttpWarningConsoleMessage( |
// Tests that console messages are printed upon a call to |
// GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per |
// main-frame navigation. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
ConsoleMessage) { |
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
Browser::CreateParams(browser()->profile())); |
@@ -1219,11 +1163,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
first_message.Run(); |
// Check that the HTTP_SHOW_WARNING state was actually triggered. |
- ChromeSecurityStateModelClient* client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1247,7 +1191,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
contents->OnPasswordInputShownOnHttp(); |
second_message.Run(); |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1257,7 +1201,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that console messages are printed upon a call to |
// GetSecurityInfo() on a NONE page that will be marked |
// HTTP_SHOW_WARNING in future, exactly once per main-frame navigation. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, ConsoleMessage) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ConsoleMessage) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); |
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
@@ -1291,11 +1235,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, ConsoleMessage) { |
first_message.Run(); |
// Check that the correct state was actually triggered. |
- ChromeSecurityStateModelClient* client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::NONE, |
security_info.security_level); |
EXPECT_TRUE(security_info.displayed_private_user_data_input_on_http); |
@@ -1320,7 +1264,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, ConsoleMessage) { |
contents->OnPasswordInputShownOnHttp(); |
second_message.Run(); |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::NONE, |
security_info.security_level); |
EXPECT_TRUE(security_info.displayed_private_user_data_input_on_http); |
@@ -1330,7 +1274,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, ConsoleMessage) { |
// Tests that additional HTTP_SHOW_WARNING console messages are not |
// printed after subframe navigations. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
ConsoleMessageNotPrintedForFrameNavigation) { |
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
Browser::CreateParams(browser()->profile())); |
@@ -1363,11 +1307,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
first_message.Run(); |
// Check that the HTTP_SHOW_WARNING state was actually triggered. |
- ChromeSecurityStateModelClient* client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1406,7 +1350,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
contents->OnPasswordInputShownOnHttp(); |
second_message.Run(); |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); |
@@ -1414,7 +1358,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that additional HTTP_SHOW_WARNING console messages are not |
// printed after pushState navigations. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
ConsoleMessageNotPrintedForPushStateNavigation) { |
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
Browser::CreateParams(browser()->profile())); |
@@ -1447,11 +1391,11 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
first_message.Run(); |
// Check that the HTTP_SHOW_WARNING state was actually triggered. |
- ChromeSecurityStateModelClient* client = |
- ChromeSecurityStateModelClient::FromWebContents(contents); |
- ASSERT_TRUE(client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(contents); |
+ ASSERT_TRUE(helper); |
security_state::SecurityStateModel::SecurityInfo security_info; |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
@@ -1485,7 +1429,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
contents->OnPasswordInputShownOnHttp(); |
second_message.Run(); |
- client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, |
security_info.security_level); |
ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); |
@@ -1493,7 +1437,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
// Tests that the SecurityStateModel for a WebContents is up to date |
// when the WebContents is inserted into a Browser's TabStripModel. |
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { |
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, AddedTab) { |
ASSERT_TRUE(https_server_.Start()); |
SetUpMockCertVerifierForHttpsServer(0, net::OK); |
@@ -1504,7 +1448,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { |
content::WebContents* new_contents = content::WebContents::Create( |
content::WebContents::CreateParams(tab->GetBrowserContext())); |
content::NavigationController& controller = new_contents->GetController(); |
- ChromeSecurityStateModelClient::CreateForWebContents(new_contents); |
+ SecurityStateTabHelper::CreateForWebContents(new_contents); |
CheckSecurityInfoForNonSecure(new_contents); |
controller.LoadURL(https_server_.GetURL("/title1.html"), content::Referrer(), |
ui::PAGE_TRANSITION_TYPED, std::string()); |
@@ -2038,11 +1982,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTestURLRequestWithSCTs, |
content::WebContents* web_contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
ASSERT_TRUE(web_contents); |
- ChromeSecurityStateModelClient* model_client = |
- ChromeSecurityStateModelClient::FromWebContents(web_contents); |
- ASSERT_TRUE(model_client); |
+ SecurityStateTabHelper* helper = |
+ SecurityStateTabHelper::FromWebContents(web_contents); |
+ ASSERT_TRUE(helper); |
SecurityStateModel::SecurityInfo security_info; |
- model_client->GetSecurityInfo(&security_info); |
+ helper->GetSecurityInfo(&security_info); |
EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); |
EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
} |