Index: chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc |
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc |
index 77d766785de8d5a0d6bfff18c0303966a89a22f0..f9521965b6b82511ebb25483aa6ecec5d9b738d5 100644 |
--- a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc |
+++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc |
@@ -202,6 +202,33 @@ IN_PROC_BROWSER_TEST_F(ChromeSSLHostStateDelegateTest, Clear) { |
kExampleHost, google_cert.get(), net::CERT_STATUS_DATE_INVALID)); |
} |
+// DidHostRunInsecureContent unit tests the expected behavior of calling |
+// DidHostRunInsecureContent as well as HostRanInsecureContent to check if |
+// insecure content has been run and to mark it as such. |
+IN_PROC_BROWSER_TEST_F(ChromeSSLHostStateDelegateTest, |
+ DidHostRunInsecureContent) { |
+ content::WebContents* tab = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
+ content::SSLHostStateDelegate* state = profile->GetSSLHostStateDelegate(); |
+ |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("www.google.com", 42)); |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("www.google.com", 191)); |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("example.com", 42)); |
+ |
+ state->HostRanInsecureContent("www.google.com", 42); |
+ |
+ EXPECT_TRUE(state->DidHostRunInsecureContent("www.google.com", 42)); |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("www.google.com", 191)); |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("example.com", 42)); |
+ |
+ state->HostRanInsecureContent("example.com", 42); |
+ |
+ EXPECT_TRUE(state->DidHostRunInsecureContent("www.google.com", 42)); |
+ EXPECT_FALSE(state->DidHostRunInsecureContent("www.google.com", 191)); |
+ EXPECT_TRUE(state->DidHostRunInsecureContent("example.com", 42)); |
+} |
+ |
// Tests the basic behavior of cert memory in incognito. |
class IncognitoSSLHostStateDelegateTest |
: public ChromeSSLHostStateDelegateTest { |