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

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: set TODO url for crbug.com/666172 Created 4 years, 1 month 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
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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, 909 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
910 ReportingDisabledByPolicy) { 910 ReportingDisabledByPolicy) {
911 SetExtendedReportingPref(browser()->profile()->GetPrefs(), true); 911 SetExtendedReportingPref(browser()->profile()->GetPrefs(), true);
912 browser()->profile()->GetPrefs()->SetBoolean( 912 browser()->profile()->GetPrefs()->SetBoolean(
913 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false); 913 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false);
914 914
915 TestReportingDisabledAndDontProceed( 915 TestReportingDisabledAndDontProceed(
916 net::URLRequestMockHTTPJob::GetMockUrl(kEmptyPage)); 916 net::URLRequestMockHTTPJob::GetMockUrl(kEmptyPage));
917 } 917 }
918 918
919 // Verifies that the reporting checkbox is still shown if the page is reloaded
920 // while the interstitial is showing.
921 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
922 ReloadWhileInterstitialShowing) {
923 // Start navigation to bad page (kEmptyPage), which will be blocked before it
924 // is committed.
925 GURL url = SetupWarningAndNavigate();
meacer 2016/11/30 00:04:09 nit: const?
mattm 2016/11/30 00:47:41 Done.
926
927 // Checkbox should be showing.
928 EXPECT_EQ(VISIBLE, GetVisibility("extended-reporting-opt-in"));
929
930 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
931 ASSERT_TRUE(tab);
932 // Security indicator should be showing.
933 ExpectSecurityIndicatorDowngrade(tab, 0u);
934
935 // Check navigation entry state.
936 NavigationController& controller = tab->GetController();
meacer 2016/11/30 00:04:09 const
mattm 2016/11/30 00:47:41 Done.
937 ASSERT_TRUE(controller.GetVisibleEntry());
938 EXPECT_EQ(controller.GetVisibleEntry()->GetURL(), url);
meacer 2016/11/30 00:04:09 nit: The order of params seems reversed here. url
mattm 2016/11/30 00:47:41 Done.
939 ASSERT_TRUE(controller.GetPendingEntry());
940 EXPECT_EQ(controller.GetPendingEntry()->GetURL(), url);
941
942 // "Reload" the tab.
943 SetupWarningAndNavigate();
944
945 // Checkbox should be showing.
946 EXPECT_EQ(VISIBLE, GetVisibility("extended-reporting-opt-in"));
947
948 // TODO(crbug.com/666172): Security indicator should be showing.
949 // ExpectSecurityIndicatorDowngrade(tab, 0u);
meacer 2016/11/30 00:04:09 Is this intentionally commented out? If so, you mi
mattm 2016/11/30 00:47:41 Done.
950
951 // Check navigation entry state.
952 ASSERT_TRUE(controller.GetVisibleEntry());
953 EXPECT_EQ(controller.GetVisibleEntry()->GetURL(), url);
954 ASSERT_TRUE(controller.GetPendingEntry());
955 EXPECT_EQ(controller.GetPendingEntry()->GetURL(), url);
956 }
957
919 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, LearnMore) { 958 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, LearnMore) {
920 SetupWarningAndNavigate(); 959 SetupWarningAndNavigate();
921 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); 960 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link"));
922 AssertNoInterstitial(false); // Assert the interstitial is gone 961 AssertNoInterstitial(false); // Assert the interstitial is gone
923 962
924 // We are in the help page. 963 // We are in the help page.
925 EXPECT_EQ( 964 EXPECT_EQ(
926 GURL("https://support.google.com/chrome/answer/99020").GetWithEmptyPath(), 965 GURL("https://support.google.com/chrome/answer/99020").GetWithEmptyPath(),
927 browser() 966 browser()
928 ->tab_strip_model() 967 ->tab_strip_model()
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 1347
1309 INSTANTIATE_TEST_CASE_P( 1348 INSTANTIATE_TEST_CASE_P(
1310 SafeBrowsingBlockingPageIDNTestWithThreatType, 1349 SafeBrowsingBlockingPageIDNTestWithThreatType,
1311 SafeBrowsingBlockingPageIDNTest, 1350 SafeBrowsingBlockingPageIDNTest,
1312 testing::Combine(testing::Values(false, true), 1351 testing::Combine(testing::Values(false, true),
1313 testing::Values(SB_THREAT_TYPE_URL_MALWARE, 1352 testing::Values(SB_THREAT_TYPE_URL_MALWARE,
1314 SB_THREAT_TYPE_URL_PHISHING, 1353 SB_THREAT_TYPE_URL_PHISHING,
1315 SB_THREAT_TYPE_URL_UNWANTED))); 1354 SB_THREAT_TYPE_URL_UNWANTED)));
1316 1355
1317 } // namespace safe_browsing 1356 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698