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 aff6c93700a9e8b532497ff78467a90cc2a79582..09fa2582ff3303870b533f1b373a2658dc53ae10 100644 |
| --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc |
| +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc |
| @@ -241,10 +241,29 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness { |
| csd_host_->feature_extractor_.reset(extractor); |
| } |
| - void SetUnsafeUniquePageIdToCurrent() { |
| - csd_host_->unsafe_unique_page_id_ = |
| - contents()->controller().GetActiveEntry()->unique_id(); |
| + void SetUnsafeResourceToCurrent() { |
| + SafeBrowsingService::UnsafeResource resource; |
| + resource.url = GURL("http://www.malware.com/"); |
| + resource.original_url = contents()->GetURL(); |
| + resource.is_subresource = true; |
| + resource.threat_type = SafeBrowsingService::URL_MALWARE; |
| + resource.client = NULL; |
| + resource.render_process_host_id = contents()->GetRenderProcessHost()->id(); |
| + resource.render_view_id = contents()->render_view_host()->routing_id(); |
| + csd_host_->OnSafeBrowsingHit(resource); |
| ASSERT_TRUE(csd_host_->DidShowSBInterstitial()); |
| + ASSERT_TRUE(csd_host_->unsafe_resource_.get()); |
| + // Test that the resource above was copied. |
| + EXPECT_EQ(resource.url, csd_host_->unsafe_resource_->url); |
| + EXPECT_EQ(resource.original_url, csd_host_->unsafe_resource_->original_url); |
| + EXPECT_EQ(resource.is_subresource, |
| + csd_host_->unsafe_resource_->is_subresource); |
| + EXPECT_EQ(resource.threat_type, csd_host_->unsafe_resource_->threat_type); |
| + EXPECT_EQ(resource.client, csd_host_->unsafe_resource_->client); |
|
mattm
2011/08/01 23:19:35
nit: shouldn't this check it gets NULLed?
noelutz
2011/08/01 23:26:49
good point. done.
|
| + EXPECT_EQ(resource.render_process_host_id, |
| + csd_host_->unsafe_resource_->render_process_host_id); |
| + EXPECT_EQ(resource.render_view_id, |
| + csd_host_->unsafe_resource_->render_view_id); |
| } |
| protected: |
| @@ -519,7 +538,7 @@ TEST_F(ClientSideDetectionHostTest, |
| &kFalse, &kFalse); |
| NavigateAndCommit(url); |
| WaitAndCheckPreClassificationChecks(); |
| - SetUnsafeUniquePageIdToCurrent(); |
| + SetUnsafeResourceToCurrent(); |
| EXPECT_CALL(*csd_service_, |
| SendClientReportPhishingRequest( |