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

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

Issue 2852333003: Rename SafeBrowsingErrorUI to SafeBrowsingLoudErrorUI (Closed)
Patch Set: Comments Created 3 years, 7 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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "net/test/url_request/url_request_mock_http_job.h" 61 #include "net/test/url_request/url_request_mock_http_job.h"
62 #include "testing/gmock/include/gmock/gmock-matchers.h" 62 #include "testing/gmock/include/gmock/gmock-matchers.h"
63 #include "ui/base/l10n/l10n_util.h" 63 #include "ui/base/l10n/l10n_util.h"
64 64
65 using chrome_browser_interstitials::SecurityInterstitialIDNTest; 65 using chrome_browser_interstitials::SecurityInterstitialIDNTest;
66 using content::BrowserThread; 66 using content::BrowserThread;
67 using content::InterstitialPage; 67 using content::InterstitialPage;
68 using content::NavigationController; 68 using content::NavigationController;
69 using content::RenderFrameHost; 69 using content::RenderFrameHost;
70 using content::WebContents; 70 using content::WebContents;
71 using security_interstitials::SafeBrowsingErrorUI; 71 using security_interstitials::BaseSafeBrowsingErrorUI;
72 72
73 namespace safe_browsing { 73 namespace safe_browsing {
74 74
75 namespace { 75 namespace {
76 76
77 const char kEmptyPage[] = "empty.html"; 77 const char kEmptyPage[] = "empty.html";
78 const char kHTTPSPage[] = "/ssl/google.html"; 78 const char kHTTPSPage[] = "/ssl/google.html";
79 const char kMaliciousPage[] = "safe_browsing/malware.html"; 79 const char kMaliciousPage[] = "safe_browsing/malware.html";
80 const char kCrossSiteMaliciousPage[] = "safe_browsing/malware2.html"; 80 const char kCrossSiteMaliciousPage[] = "safe_browsing/malware2.html";
81 const char kPageWithCrossOriginMaliciousIframe[] = 81 const char kPageWithCrossOriginMaliciousIframe[] =
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 }; 234 };
235 235
236 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. 236 // A SafeBrowingBlockingPage class that lets us wait until it's hidden.
237 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { 237 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage {
238 public: 238 public:
239 TestSafeBrowsingBlockingPage( 239 TestSafeBrowsingBlockingPage(
240 BaseUIManager* manager, 240 BaseUIManager* manager,
241 WebContents* web_contents, 241 WebContents* web_contents,
242 const GURL& main_frame_url, 242 const GURL& main_frame_url,
243 const UnsafeResourceList& unsafe_resources, 243 const UnsafeResourceList& unsafe_resources,
244 const SafeBrowsingErrorUI::SBErrorDisplayOptions& display_options) 244 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options)
245 : SafeBrowsingBlockingPage(manager, 245 : SafeBrowsingBlockingPage(manager,
246 web_contents, 246 web_contents,
247 main_frame_url, 247 main_frame_url,
248 unsafe_resources, 248 unsafe_resources,
249 display_options), 249 display_options),
250 wait_for_delete_(false) { 250 wait_for_delete_(false) {
251 // Don't wait the whole 3 seconds for the browser test. 251 // Don't wait the whole 3 seconds for the browser test.
252 SetThreatDetailsProceedDelayForTesting(100); 252 SetThreatDetailsProceedDelayForTesting(100);
253 } 253 }
254 254
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 const GURL& main_frame_url, 289 const GURL& main_frame_url,
290 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) 290 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources)
291 override { 291 override {
292 PrefService* prefs = 292 PrefService* prefs =
293 Profile::FromBrowserContext(web_contents->GetBrowserContext()) 293 Profile::FromBrowserContext(web_contents->GetBrowserContext())
294 ->GetPrefs(); 294 ->GetPrefs();
295 bool is_extended_reporting_opt_in_allowed = 295 bool is_extended_reporting_opt_in_allowed =
296 prefs->GetBoolean(prefs::kSafeBrowsingExtendedReportingOptInAllowed); 296 prefs->GetBoolean(prefs::kSafeBrowsingExtendedReportingOptInAllowed);
297 bool is_proceed_anyway_disabled = 297 bool is_proceed_anyway_disabled =
298 prefs->GetBoolean(prefs::kSafeBrowsingProceedAnywayDisabled); 298 prefs->GetBoolean(prefs::kSafeBrowsingProceedAnywayDisabled);
299 SafeBrowsingErrorUI::SBErrorDisplayOptions display_options( 299 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options(
300 BaseBlockingPage::IsMainPageLoadBlocked(unsafe_resources), 300 BaseBlockingPage::IsMainPageLoadBlocked(unsafe_resources),
301 is_extended_reporting_opt_in_allowed, 301 is_extended_reporting_opt_in_allowed,
302 web_contents->GetBrowserContext()->IsOffTheRecord(), 302 web_contents->GetBrowserContext()->IsOffTheRecord(),
303 IsExtendedReportingEnabled(*prefs), IsScout(*prefs), 303 IsExtendedReportingEnabled(*prefs), IsScout(*prefs),
304 is_proceed_anyway_disabled, 304 is_proceed_anyway_disabled,
305 BaseBlockingPage::IsMainPageLoadBlocked(unsafe_resources)); 305 BaseBlockingPage::IsMainPageLoadBlocked(unsafe_resources));
306 return new TestSafeBrowsingBlockingPage(delegate, web_contents, 306 return new TestSafeBrowsingBlockingPage(delegate, web_contents,
307 main_frame_url, unsafe_resources, 307 main_frame_url, unsafe_resources,
308 display_options); 308 display_options);
309 } 309 }
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 1486
1487 INSTANTIATE_TEST_CASE_P( 1487 INSTANTIATE_TEST_CASE_P(
1488 SafeBrowsingBlockingPageIDNTestWithThreatType, 1488 SafeBrowsingBlockingPageIDNTestWithThreatType,
1489 SafeBrowsingBlockingPageIDNTest, 1489 SafeBrowsingBlockingPageIDNTest,
1490 testing::Combine(testing::Values(false, true), 1490 testing::Combine(testing::Values(false, true),
1491 testing::Values(SB_THREAT_TYPE_URL_MALWARE, 1491 testing::Values(SB_THREAT_TYPE_URL_MALWARE,
1492 SB_THREAT_TYPE_URL_PHISHING, 1492 SB_THREAT_TYPE_URL_PHISHING,
1493 SB_THREAT_TYPE_URL_UNWANTED))); 1493 SB_THREAT_TYPE_URL_UNWANTED)));
1494 1494
1495 } // namespace safe_browsing 1495 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698