| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 protected: | 212 protected: |
| 213 void InitResource(SafeBrowsingService::UnsafeResource* resource, | 213 void InitResource(SafeBrowsingService::UnsafeResource* resource, |
| 214 bool is_subresource, | 214 bool is_subresource, |
| 215 const GURL& url) { | 215 const GURL& url) { |
| 216 resource->client = NULL; | 216 resource->client = NULL; |
| 217 resource->url = url; | 217 resource->url = url; |
| 218 resource->is_subresource = is_subresource; | 218 resource->is_subresource = is_subresource; |
| 219 resource->threat_type = SafeBrowsingService::URL_MALWARE; | 219 resource->threat_type = SafeBrowsingService::URL_MALWARE; |
| 220 resource->render_process_host_id = contents()->GetRenderProcessHost()->id(); | 220 resource->render_process_host_id = contents()->GetRenderProcessHost()-> |
| 221 GetID(); |
| 221 resource->render_view_id = contents()->render_view_host()->routing_id(); | 222 resource->render_view_id = contents()->render_view_host()->routing_id(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void VerifyResults(const ClientMalwareReportRequest& report_pb, | 225 void VerifyResults(const ClientMalwareReportRequest& report_pb, |
| 225 const ClientMalwareReportRequest& expected_pb) { | 226 const ClientMalwareReportRequest& expected_pb) { |
| 226 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url()); | 227 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url()); |
| 227 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); | 228 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); |
| 228 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); | 229 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); |
| 229 | 230 |
| 230 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size()); | 231 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size()); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 pb_resource = expected.add_resources(); | 679 pb_resource = expected.add_resources(); |
| 679 pb_resource->set_id(2); | 680 pb_resource->set_id(2); |
| 680 pb_resource->set_parent_id(3); | 681 pb_resource->set_parent_id(3); |
| 681 pb_resource->set_url(kSecondRedirectURL); | 682 pb_resource->set_url(kSecondRedirectURL); |
| 682 pb_resource = expected.add_resources(); | 683 pb_resource = expected.add_resources(); |
| 683 pb_resource->set_id(3); | 684 pb_resource->set_id(3); |
| 684 pb_resource->set_url(kFirstRedirectURL); | 685 pb_resource->set_url(kFirstRedirectURL); |
| 685 | 686 |
| 686 VerifyResults(actual, expected); | 687 VerifyResults(actual, expected); |
| 687 } | 688 } |
| OLD | NEW |