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

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

Issue 789703004: Reflect the status of a request for accessing a blacklisted url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tested on Android/Desktop Created 6 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
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 "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // directly rather than using ClickAndWaitForDetach since there might not 501 // directly rather than using ClickAndWaitForDetach since there might not
502 // be a notification to wait for. 502 // be a notification to wait for.
503 SendCommand("\"proceed\""); 503 SendCommand("\"proceed\"");
504 } 504 }
505 505
506 content::RenderViewHost* GetRenderViewHost() { 506 content::RenderViewHost* GetRenderViewHost() {
507 InterstitialPage* interstitial = InterstitialPage::GetInterstitialPage( 507 InterstitialPage* interstitial = InterstitialPage::GetInterstitialPage(
508 browser()->tab_strip_model()->GetActiveWebContents()); 508 browser()->tab_strip_model()->GetActiveWebContents());
509 if (!interstitial) 509 if (!interstitial)
510 return NULL; 510 return NULL;
511 return interstitial->GetRenderViewHostForTesting(); 511 return interstitial->GetRenderViewHost();
512 } 512 }
513 513
514 bool WaitForReady() { 514 bool WaitForReady() {
515 content::RenderViewHost* rvh = GetRenderViewHost(); 515 content::RenderViewHost* rvh = GetRenderViewHost();
516 if (!rvh) 516 if (!rvh)
517 return false; 517 return false;
518 // Wait until all <script> tags have executed, including jstemplate. 518 // Wait until all <script> tags have executed, including jstemplate.
519 // TODO(joaodasilva): it would be nice to avoid the busy loop, though in 519 // TODO(joaodasilva): it would be nice to avoid the busy loop, though in
520 // practice it spins at most once or twice. 520 // practice it spins at most once or twice.
521 std::string ready_state; 521 std::string ready_state;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 ? "/transparencyreport/safebrowsing/" 798 ? "/transparencyreport/safebrowsing/"
799 : "/safebrowsing/diagnostic", 799 : "/safebrowsing/diagnostic",
800 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); 800 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
801 } 801 }
802 802
803 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageBrowserTestWithThreatType, 803 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageBrowserTestWithThreatType,
804 SafeBrowsingBlockingPageBrowserTest, 804 SafeBrowsingBlockingPageBrowserTest,
805 testing::Values(SB_THREAT_TYPE_URL_MALWARE, 805 testing::Values(SB_THREAT_TYPE_URL_MALWARE,
806 SB_THREAT_TYPE_URL_PHISHING, 806 SB_THREAT_TYPE_URL_PHISHING,
807 SB_THREAT_TYPE_URL_UNWANTED)); 807 SB_THREAT_TYPE_URL_UNWANTED));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698