Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2400673003: Remove SSLStatus::security_style member and content::SecurityStyle (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 35306810ddba852d5958f4c4707141cf89d88d58..0126aec352ca382573157aee532154acba7fe898 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -160,9 +160,14 @@ void Check(const NavigationEntry& entry, int expected_authentication_state) {
namespace SecurityStyle {
-void Check(const NavigationEntry& entry,
- content::SecurityStyle expected_security_style) {
- EXPECT_EQ(expected_security_style, entry.GetSSL().security_style);
+void Check(
+ WebContents* tab,
+ security_state::SecurityStateModel::SecurityLevel expected_security_level) {
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(tab);
+ security_state::SecurityStateModel::SecurityInfo security_info;
+ model_client->GetSecurityInfo(&security_info);
+ EXPECT_EQ(expected_security_level, security_info.security_level);
}
} // namespace SecurityStyle
@@ -187,15 +192,16 @@ void Check(const NavigationEntry& entry, net::CertStatus error) {
} // namespace CertError
-void CheckSecurityState(WebContents* tab,
- net::CertStatus expected_error,
- content::SecurityStyle expected_security_style,
- int expected_authentication_state) {
+void CheckSecurityState(
+ WebContents* tab,
+ net::CertStatus expected_error,
+ security_state::SecurityStateModel::SecurityLevel expected_security_level,
+ int expected_authentication_state) {
ASSERT_FALSE(tab->IsCrashed());
NavigationEntry* entry = tab->GetController().GetActiveEntry();
ASSERT_TRUE(entry);
CertError::Check(*entry, expected_error);
- SecurityStyle::Check(*entry, expected_security_style);
+ SecurityStyle::Check(tab, expected_security_level);
AuthState::Check(*entry, expected_authentication_state);
}
@@ -310,26 +316,23 @@ class SSLUITest
void CheckAuthenticatedState(WebContents* tab,
int expected_authentication_state) {
- CheckSecurityState(tab,
- CertError::NONE,
- content::SECURITY_STYLE_AUTHENTICATED,
+ CheckSecurityState(tab, CertError::NONE,
+ security_state::SecurityStateModel::SECURE,
expected_authentication_state);
}
void CheckUnauthenticatedState(WebContents* tab,
int expected_authentication_state) {
- CheckSecurityState(tab,
- CertError::NONE,
- content::SECURITY_STYLE_UNAUTHENTICATED,
+ CheckSecurityState(tab, CertError::NONE,
+ security_state::SecurityStateModel::NONE,
expected_authentication_state);
}
void CheckAuthenticationBrokenState(WebContents* tab,
net::CertStatus error,
int expected_authentication_state) {
- CheckSecurityState(tab,
- error,
- content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
+ CheckSecurityState(tab, error,
+ security_state::SecurityStateModel::DANGEROUS,
expected_authentication_state);
// CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style
// to SECURITY_STYLE_AUTHENTICATION_BROKEN.
@@ -1472,8 +1475,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestDisplaysInsecureContent) {
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL(replacement_path));
- CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(),
- AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(),
+ CertError::NONE, security_state::SecurityStateModel::NONE,
+ AuthState::DISPLAYED_INSECURE_CONTENT);
}
// Test that if the user proceeds and the checkbox is checked, a report
@@ -1739,7 +1743,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
observer.Wait();
// The new tab has insecure content.
- CheckAuthenticatedState(tab2, AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckSecurityState(tab2, CertError::NONE,
+ security_state::SecurityStateModel::NONE,
+ AuthState::DISPLAYED_INSECURE_CONTENT);
// The original tab should not be contaminated.
CheckAuthenticatedState(tab1, AuthState::NONE);
@@ -1814,7 +1820,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) {
// content (even though the image comes from the WebCore memory cache).
const GURL url_https = https_server_.GetURL(replacement_path);
ui_test_utils::NavigateToURL(browser(), url_https);
- CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckSecurityState(tab, CertError::NONE,
+ security_state::SecurityStateModel::NONE,
+ AuthState::DISPLAYED_INSECURE_CONTENT);
}
// http://crbug.com/84729
@@ -2154,7 +2162,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITestWaitForDOMNotification,
"document.body.appendChild(img);"));
content::RunMessageLoop();
- CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckSecurityState(tab, CertError::NONE,
+ security_state::SecurityStateModel::NONE,
+ AuthState::DISPLAYED_INSECURE_CONTENT);
}
// Visits a page to which we could not connect (bad port) over http and https
@@ -2521,7 +2531,6 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) {
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_NO_FATAL_FAILURE(
SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html"));
- CheckAuthenticatedState(tab, AuthState::NONE);
ChromeSecurityStateModelClient* client =
ChromeSecurityStateModelClient::FromWebContents(tab);
@@ -2532,6 +2541,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) {
security_info.mixed_content_status);
EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED,
security_info.content_with_cert_errors_status);
+ EXPECT_EQ(security_state::SecurityStateModel::NONE,
+ security_info.security_level);
+ EXPECT_EQ(0u, security_info.cert_status);
int img_width;
EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
@@ -2896,7 +2908,8 @@ IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest,
observer.Wait();
CheckSecurityState(contents, CertError::NONE,
- content::SECURITY_STYLE_AUTHENTICATED, AuthState::NONE);
+ security_state::SecurityStateModel::SECURE,
+ AuthState::NONE);
replacements.SetHostStr("mail.example.com");
GURL https_server_new_url = https_server_url.ReplaceComponents(replacements);
// Verify that the current URL is the suggested URL.
@@ -2954,7 +2967,8 @@ IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest,
observer.Wait();
CheckSecurityState(contents, CertError::NONE,
- content::SECURITY_STYLE_AUTHENTICATED, AuthState::NONE);
+ security_state::SecurityStateModel::SECURE,
+ AuthState::NONE);
}
// Tests this scenario:
@@ -3198,7 +3212,7 @@ IN_PROC_BROWSER_TEST_F(CertVerifierBrowserTest, MockCertVerifierSmokeTest) {
CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(),
net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION,
- content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
+ security_state::SecurityStateModel::DANGEROUS,
AuthState::SHOWING_INTERSTITIAL);
}
@@ -3318,7 +3332,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, ClientRedirectToMixedContentSSLState) {
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2);
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
- CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckSecurityState(tab, CertError::NONE,
+ security_state::SecurityStateModel::NONE,
+ AuthState::DISPLAYED_INSECURE_CONTENT);
}
// Checks that in-page navigations during page load preserves SSL state.

Powered by Google App Engine
This is Rietveld 408576698