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

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

Issue 1294673005: Disable Name Mismatch redirection for non-overridable SSL errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Again Created 5 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
« no previous file with comments | « chrome/browser/ssl/ssl_error_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/ssl_error_handler_unittest.cc
diff --git a/chrome/browser/ssl/ssl_error_handler_unittest.cc b/chrome/browser/ssl/ssl_error_handler_unittest.cc
index f812d6b1e4806f0a637eb678883babd2739c56ac..b81c59db6188e5f826e08c251f4352ef5c632ee8 100644
--- a/chrome/browser/ssl/ssl_error_handler_unittest.cc
+++ b/chrome/browser/ssl/ssl_error_handler_unittest.cc
@@ -42,7 +42,8 @@ class TestSSLErrorHandler : public SSLErrorHandler {
suggested_url_checked_(false),
ssl_interstitial_shown_(false),
captive_portal_interstitial_shown_(false),
- common_name_mismatch_redirect_(false) {}
+ common_name_mismatch_redirect_(false),
+ is_overridable_error_(true) {}
~TestSSLErrorHandler() override {
}
@@ -100,6 +101,8 @@ class TestSSLErrorHandler : public SSLErrorHandler {
return common_name_mismatch_redirect_;
}
+ void set_non_overridable_error() { is_overridable_error_ = false; }
+
void Reset() {
captive_portal_checked_ = false;
suggested_url_exists_ = false;
@@ -128,6 +131,8 @@ class TestSSLErrorHandler : public SSLErrorHandler {
common_name_mismatch_redirect_ = true;
}
+ bool IsErrorOverridable() const override { return is_overridable_error_; }
+
Profile* profile_;
bool captive_portal_checked_;
bool suggested_url_exists_;
@@ -135,6 +140,7 @@ class TestSSLErrorHandler : public SSLErrorHandler {
bool ssl_interstitial_shown_;
bool captive_portal_interstitial_shown_;
bool common_name_mismatch_redirect_;
+ bool is_overridable_error_;
DISALLOW_COPY_AND_ASSIGN(TestSSLErrorHandler);
};
@@ -268,6 +274,20 @@ TEST_F(SSLErrorHandlerTest, ShouldNotCheckCaptivePortalIfSuggestedUrlExists) {
EXPECT_TRUE(error_handler()->ssl_interstitial_shown());
}
+TEST_F(SSLErrorHandlerTest, ShouldNotHandleNameMismatchOnNonOverridableError) {
+ error_handler()->set_non_overridable_error();
+ error_handler()->SetSuggestedUrlExists(true);
+ error_handler()->StartHandlingError();
+
+ EXPECT_FALSE(error_handler()->suggested_url_checked());
+ EXPECT_TRUE(error_handler()->captive_portal_checked());
+ EXPECT_TRUE(error_handler()->IsTimerRunning());
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_FALSE(error_handler()->IsTimerRunning());
+ EXPECT_TRUE(error_handler()->ssl_interstitial_shown());
+}
+
#else // #if !defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
TEST_F(SSLErrorHandlerTest,
« no previous file with comments | « chrome/browser/ssl/ssl_error_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698