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

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

Issue 418133012: Add button to page info to revoke user certificate decisions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address pkasting comments Created 6 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/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 {

Powered by Google App Engine
This is Rietveld 408576698