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

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

Issue 2226523002: Add separate plumbing for subresources with certificate errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 4 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 626301d4b4c437fa2def13ad1b72d7c4c64014e5..10dd409b23cf2d57bc56ad44a6b95e3fcfa33126 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -2290,8 +2290,17 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorkerWithUserException) {
ui_test_utils::NavigateToURL(
browser(), https_server_.GetURL(page_with_unsafe_worker_path));
CheckWorkerLoadResult(tab, true); // Worker loads insecure content
- CheckAuthenticationBrokenState(tab, CertError::NONE,
- AuthState::RAN_INSECURE_CONTENT);
+ CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE);
+
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(tab);
+ ASSERT_TRUE(model_client);
+
+ EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
+ model_client->GetSecurityInfo().security_level);
+ EXPECT_EQ(
+ security_state::SecurityStateModel::RAN_CONTENT_WITH_CERTIFICATE_ERRORS,
+ model_client->GetSecurityInfo().content_with_cert_errors_status);
}
// Visits a page with unsafe content and makes sure that if a user exception to
@@ -2300,9 +2309,17 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) {
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_NO_FATAL_FAILURE(SetUpUnsafeContentsWithUserException(
"/ssl/page_with_unsafe_contents.html"));
- CheckAuthenticationBrokenState(
- tab, CertError::NONE,
- AuthState::RAN_INSECURE_CONTENT | AuthState::DISPLAYED_INSECURE_CONTENT);
+ CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE);
+
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(tab);
+ ASSERT_TRUE(model_client);
+
+ EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
+ model_client->GetSecurityInfo().security_level);
+ EXPECT_EQ(security_state::SecurityStateModel::
+ RAN_AND_DISPLAYED_CONTENT_WITH_CERTIFICATE_ERRORS,
+ model_client->GetSecurityInfo().content_with_cert_errors_status);
int img_width;
EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
@@ -2316,22 +2333,6 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) {
EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
tab, "window.domAutomationController.send(IsFooSet());", &js_result));
EXPECT_TRUE(js_result);
-
- // Test that active subresources with the same certificate errors as
- // the main resources don't cause mixed content UI downgrades. (Such
- // errors would be confusing and duplicative.)
- std::string replacement_path;
- GetFilePathWithHostAndPortReplacement(
- "/ssl/page_with_unsafe_contents.html",
- https_server_mismatched_.host_port_pair(), &replacement_path);
- ui_test_utils::NavigateToURL(
- browser(), https_server_mismatched_.GetURL(replacement_path));
- js_result = false;
- EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
- tab, "window.domAutomationController.send(IsFooSet());", &js_result));
- EXPECT_TRUE(js_result);
- CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
- AuthState::NONE);
}
// Like the test above, but only displaying inactive content (an image).
@@ -2339,7 +2340,17 @@ 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::DISPLAYED_INSECURE_CONTENT);
+ CheckAuthenticatedState(tab, AuthState::NONE);
+
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(tab);
+ ASSERT_TRUE(model_client);
+
+ EXPECT_EQ(security_state::SecurityStateModel::NONE,
+ model_client->GetSecurityInfo().security_level);
+ EXPECT_EQ(security_state::SecurityStateModel::
+ DISPLAYED_CONTENT_WITH_CERTIFICATE_ERRORS,
+ model_client->GetSecurityInfo().content_with_cert_errors_status);
int img_width;
EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
« no previous file with comments | « chrome/browser/ssl/chrome_ssl_host_state_delegate.cc ('k') | components/security_state/security_state_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698