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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 2451623005: Remove Dangerous indicator after going back from interstitial (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/safe_browsing/safe_browsing_blocking_page_test.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 468adf7f11532a578712a079b0c2613db5377aab..8522dfabb81a4941e65f2773d40216f338186d1d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -44,6 +44,7 @@
#include "components/security_interstitials/core/metrics_helper.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -581,6 +582,17 @@ class SafeBrowsingBlockingPageBrowserTest
// EXPECT_EQ(cert_status, model_client->GetSecurityInfo().cert_status);
}
+ void ExpectNoSecurityIndicatorDowngrade(content::WebContents* tab) {
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(tab);
+ ASSERT_TRUE(model_client);
+ security_state::SecurityStateModel::SecurityInfo security_info;
+ model_client->GetSecurityInfo(&security_info);
+ EXPECT_EQ(security_state::SecurityStateModel::NONE,
+ security_info.security_level);
+ EXPECT_FALSE(security_info.fails_malware_check);
+ }
+
protected:
TestThreatDetailsFactory details_factory_;
@@ -1095,6 +1107,43 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
ExpectSecurityIndicatorDowngrade(post_tab, 0u);
}
+// Test that the security indicator does not stay downgraded after
+// clicking back from a Safe Browsing interstitial. Regression test for
+// https://crbug.com/659709.
+IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
+ SecurityStateGoBack) {
+ // Navigate to a page so that there is somewhere to go back to.
+ GURL start_url =
+ net::URLRequestMockHTTPJob::GetMockUrl("http://example.test");
+ ui_test_utils::NavigateToURL(browser(), start_url);
+
+ // The security indicator should be downgraded while the interstitial shows.
+ SetupWarningAndNavigate();
+ WebContents* error_tab = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(error_tab);
+ ExpectSecurityIndicatorDowngrade(error_tab, 0u);
+
+ // Go back.
+ EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
+ EXPECT_EQ(HIDDEN, GetVisibility("details"));
+ EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
+ EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
+ EXPECT_TRUE(Click("details-button"));
+ EXPECT_EQ(VISIBLE, GetVisibility("details"));
+ EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
+ EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
+ EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
+
+ // The security indicator should *not* still be downgraded after going back.
+ AssertNoInterstitial(true);
+ WebContents* post_tab = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(post_tab);
+ content::NavigationEntry* entry = post_tab->GetController().GetVisibleEntry();
+ ASSERT_TRUE(entry);
+ EXPECT_EQ(start_url, entry->GetURL());
+ ExpectNoSecurityIndicatorDowngrade(post_tab);
+}
+
// Test that the security indicator is downgraded after clicking through a
// Safe Browsing interstitial.
IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/ui_manager.h » ('j') | chrome/browser/safe_browsing/ui_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698