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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 2510003002: If replacing a safebrowsing interstitial, don't call DontProceed on the old one. (Closed)
Patch Set: review changes Created 4 years 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This test creates a fake safebrowsing service, where we can inject known- 5 // This test creates a fake safebrowsing service, where we can inject known-
6 // threat urls. It then uses a real browser to go to these urls, and sends 6 // threat urls. It then uses a real browser to go to these urls, and sends
7 // "goback" or "proceed" commands and verifies they work. 7 // "goback" or "proceed" commands and verifies they work.
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, 910 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
911 ReportingDisabledByPolicy) { 911 ReportingDisabledByPolicy) {
912 SetExtendedReportingPref(browser()->profile()->GetPrefs(), true); 912 SetExtendedReportingPref(browser()->profile()->GetPrefs(), true);
913 browser()->profile()->GetPrefs()->SetBoolean( 913 browser()->profile()->GetPrefs()->SetBoolean(
914 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false); 914 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false);
915 915
916 TestReportingDisabledAndDontProceed( 916 TestReportingDisabledAndDontProceed(
917 net::URLRequestMockHTTPJob::GetMockUrl(kEmptyPage)); 917 net::URLRequestMockHTTPJob::GetMockUrl(kEmptyPage));
918 } 918 }
919 919
920 // Verifies that the reporting checkbox is still shown if the page is reloaded
921 // while the interstitial is showing.
922 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
923 ReloadWhileInterstitialShowing) {
924 // Start navigation to bad page (kEmptyPage), which will be blocked before it
925 // is committed.
926 const GURL url = SetupWarningAndNavigate();
927
928 // Checkbox should be showing.
929 EXPECT_EQ(VISIBLE, GetVisibility("extended-reporting-opt-in"));
930
931 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
932 ASSERT_TRUE(tab);
933 // Security indicator should be showing.
934 ExpectSecurityIndicatorDowngrade(tab, 0u);
935
936 // Check navigation entry state.
937 const NavigationController& controller = tab->GetController();
938 ASSERT_TRUE(controller.GetVisibleEntry());
939 EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL());
940 ASSERT_TRUE(controller.GetPendingEntry());
941 EXPECT_EQ(url, controller.GetPendingEntry()->GetURL());
942
943 // "Reload" the tab.
944 SetupWarningAndNavigate();
945
946 // Checkbox should be showing.
947 EXPECT_EQ(VISIBLE, GetVisibility("extended-reporting-opt-in"));
948
949 // TODO(crbug.com/666172): Security indicator should be showing.
950 // Call |ExpectSecurityIndicatorDowngrade(tab, 0u);| here once the bug is
951 // fixed.
952
953 // Check navigation entry state.
954 ASSERT_TRUE(controller.GetVisibleEntry());
955 EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL());
956 ASSERT_TRUE(controller.GetPendingEntry());
957 EXPECT_EQ(url, controller.GetPendingEntry()->GetURL());
958 }
959
920 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, LearnMore) { 960 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, LearnMore) {
921 SetupWarningAndNavigate(); 961 SetupWarningAndNavigate();
922 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); 962 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link"));
923 AssertNoInterstitial(false); // Assert the interstitial is gone 963 AssertNoInterstitial(false); // Assert the interstitial is gone
924 964
925 // We are in the help page. 965 // We are in the help page.
926 EXPECT_EQ( 966 EXPECT_EQ(
927 GURL("https://support.google.com/chrome/answer/99020").GetWithEmptyPath(), 967 GURL("https://support.google.com/chrome/answer/99020").GetWithEmptyPath(),
928 browser() 968 browser()
929 ->tab_strip_model() 969 ->tab_strip_model()
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1349
1310 INSTANTIATE_TEST_CASE_P( 1350 INSTANTIATE_TEST_CASE_P(
1311 SafeBrowsingBlockingPageIDNTestWithThreatType, 1351 SafeBrowsingBlockingPageIDNTestWithThreatType,
1312 SafeBrowsingBlockingPageIDNTest, 1352 SafeBrowsingBlockingPageIDNTest,
1313 testing::Combine(testing::Values(false, true), 1353 testing::Combine(testing::Values(false, true),
1314 testing::Values(SB_THREAT_TYPE_URL_MALWARE, 1354 testing::Values(SB_THREAT_TYPE_URL_MALWARE,
1315 SB_THREAT_TYPE_URL_PHISHING, 1355 SB_THREAT_TYPE_URL_PHISHING,
1316 SB_THREAT_TYPE_URL_UNWANTED))); 1356 SB_THREAT_TYPE_URL_UNWANTED)));
1317 1357
1318 } // namespace safe_browsing 1358 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698