Chromium Code Reviews| 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..946b184497dfbdd3e02a288454349ced887503e5 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,23 @@ class ClientSideDetectionHostTest : public ChromeRenderViewHostTestHarness { |
| TestUnsafeResourceCopied(resource); |
| } |
| + void NavigateWithoutSBHitAndCommit(const GURL& safe_url) { |
|
mattm
2013/12/16 22:36:11
Might as well check the DidShowSBInterstitial valu
Greg Billock
2013/12/16 23:00:22
Done.
|
| + 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()); |
| + |
| + content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); |
| + ASSERT_FALSE(csd_host_->DidPageReceiveSafeBrowsingMatch()); |
| + } |
| + |
| void CheckIPUrlEqual(const std::vector<IPUrlInfo>& expect, |
| const std::vector<IPUrlInfo>& result) { |
| ASSERT_EQ(expect.size(), result.size()); |
| @@ -731,6 +752,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) { |