OLD | NEW |
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 #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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 protected: | 210 protected: |
211 void InitResource(SafeBrowsingService::UnsafeResource* resource, | 211 void InitResource(SafeBrowsingService::UnsafeResource* resource, |
212 bool is_subresource, | 212 bool is_subresource, |
213 const GURL& url) { | 213 const GURL& url) { |
214 resource->url = url; | 214 resource->url = url; |
215 resource->is_subresource = is_subresource; | 215 resource->is_subresource = is_subresource; |
216 resource->threat_type = SafeBrowsingService::URL_MALWARE; | 216 resource->threat_type = SafeBrowsingService::URL_MALWARE; |
217 resource->render_process_host_id = contents()->GetRenderProcessHost()-> | 217 resource->render_process_host_id = contents()->GetRenderProcessHost()-> |
218 GetID(); | 218 GetID(); |
219 resource->render_view_id = contents()->GetRenderViewHost()->routing_id(); | 219 resource->render_view_id = contents()->GetRenderViewHost()->GetRoutingID(); |
220 } | 220 } |
221 | 221 |
222 void VerifyResults(const ClientMalwareReportRequest& report_pb, | 222 void VerifyResults(const ClientMalwareReportRequest& report_pb, |
223 const ClientMalwareReportRequest& expected_pb) { | 223 const ClientMalwareReportRequest& expected_pb) { |
224 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url()); | 224 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url()); |
225 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); | 225 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); |
226 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); | 226 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); |
227 | 227 |
228 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size()); | 228 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size()); |
229 // Sort the resources, to make the test deterministic | 229 // Sort the resources, to make the test deterministic |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 pb_resource = expected.add_resources(); | 676 pb_resource = expected.add_resources(); |
677 pb_resource->set_id(2); | 677 pb_resource->set_id(2); |
678 pb_resource->set_parent_id(3); | 678 pb_resource->set_parent_id(3); |
679 pb_resource->set_url(kSecondRedirectURL); | 679 pb_resource->set_url(kSecondRedirectURL); |
680 pb_resource = expected.add_resources(); | 680 pb_resource = expected.add_resources(); |
681 pb_resource->set_id(3); | 681 pb_resource->set_id(3); |
682 pb_resource->set_url(kFirstRedirectURL); | 682 pb_resource->set_url(kFirstRedirectURL); |
683 | 683 |
684 VerifyResults(actual, expected); | 684 VerifyResults(actual, expected); |
685 } | 685 } |
OLD | NEW |