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

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

Issue 99423007: [SafeBrowsing] Reset malware indicator on page nav start. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use GetVisibleEntry Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/client_side_detection_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index beda4d7afc4fd0bbf99505084c92159f84bbccf7..3fea44f182d64b06723baaf97798260ee81679b3 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -48,9 +48,11 @@ using content::RenderViewHostTester;
using content::WebContents;
namespace {
+
const bool kFalse = false;
const bool kTrue = true;
-}
+
+} // namespace
namespace safe_browsing {
namespace {
@@ -370,6 +372,8 @@ class ClientSideDetectionHostTest : public ChromeRenderViewHostTestHarness {
csd_host_->OnSafeBrowsingHit(resource);
resource.callback.Reset();
+ ASSERT_TRUE(csd_host_->DidPageReceiveSafeBrowsingMatch());
+
// LoadURL created a navigation entry, now simulate the RenderView sending
// a notification that it actually navigated.
content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
@@ -379,6 +383,25 @@ class ClientSideDetectionHostTest : public ChromeRenderViewHostTestHarness {
TestUnsafeResourceCopied(resource);
}
+ void NavigateWithoutSBHitAndCommit(const GURL& safe_url) {
+ controller().LoadURL(
+ safe_url, content::Referrer(), content::PAGE_TRANSITION_LINK,
+ std::string());
+
+ ASSERT_TRUE(pending_rvh());
+ if (web_contents()->GetRenderViewHost()->GetProcess()->GetID() ==
+ pending_rvh()->GetProcess()->GetID()) {
+ EXPECT_NE(web_contents()->GetRenderViewHost()->GetRoutingID(),
+ pending_rvh()->GetRoutingID());
+ }
+ ASSERT_FALSE(csd_host_->DidPageReceiveSafeBrowsingMatch());
+ ASSERT_FALSE(csd_host_->DidShowSBInterstitial());
+
+ content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
+ ASSERT_FALSE(csd_host_->DidPageReceiveSafeBrowsingMatch());
+ ASSERT_FALSE(csd_host_->DidShowSBInterstitial());
+ }
+
void CheckIPUrlEqual(const std::vector<IPUrlInfo>& expect,
const std::vector<IPUrlInfo>& result) {
ASSERT_EQ(expect.size(), result.size());
@@ -731,6 +754,11 @@ TEST_F(ClientSideDetectionHostTest,
OnPhishingDetectionDone(verdict.SerializeAsString());
base::MessageLoop::current()->Run();
EXPECT_TRUE(Mock::VerifyAndClear(csd_host_.get()));
+
+ ExpectPreClassificationChecks(start_url, &kFalse, &kFalse, &kFalse, &kFalse,
+ &kFalse, &kFalse);
+ NavigateWithoutSBHitAndCommit(start_url);
+ WaitAndCheckPreClassificationChecks();
}
TEST_F(ClientSideDetectionHostTest, UpdateIPUrlMap) {
« no previous file with comments | « chrome/browser/safe_browsing/client_side_detection_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698