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