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 <stdint.h> |
| 6 |
5 #include <algorithm> | 7 #include <algorithm> |
6 | 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" |
8 #include "base/pickle.h" | 11 #include "base/pickle.h" |
9 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
10 #include "base/time/time.h" | 13 #include "base/time/time.h" |
11 #include "chrome/browser/history/history_service_factory.h" | 14 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
14 #include "chrome/browser/safe_browsing/threat_details.h" | 17 #include "chrome/browser/safe_browsing/threat_details.h" |
15 #include "chrome/browser/safe_browsing/threat_details_history.h" | 18 #include "chrome/browser/safe_browsing/threat_details_history.h" |
16 #include "chrome/browser/safe_browsing/ui_manager.h" | 19 #include "chrome/browser/safe_browsing/ui_manager.h" |
17 #include "chrome/common/safe_browsing/csd.pb.h" | 20 #include "chrome/common/safe_browsing/csd.pb.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 266 |
264 std::vector<const ClientSafeBrowsingReportRequest::Resource*> expected; | 267 std::vector<const ClientSafeBrowsingReportRequest::Resource*> expected; |
265 for (int i = 0; i < report_pb.resources_size(); ++i) { | 268 for (int i = 0; i < report_pb.resources_size(); ++i) { |
266 const ClientSafeBrowsingReportRequest::Resource& resource = | 269 const ClientSafeBrowsingReportRequest::Resource& resource = |
267 expected_pb.resources(i); | 270 expected_pb.resources(i); |
268 expected.push_back(&resource); | 271 expected.push_back(&resource); |
269 } | 272 } |
270 std::sort(expected.begin(), expected.end(), | 273 std::sort(expected.begin(), expected.end(), |
271 &ThreatDetailsTest::ResourceLessThan); | 274 &ThreatDetailsTest::ResourceLessThan); |
272 | 275 |
273 for (uint32 i = 0; i < expected.size(); ++i) { | 276 for (uint32_t i = 0; i < expected.size(); ++i) { |
274 VerifyResource(resources[i], expected[i]); | 277 VerifyResource(resources[i], expected[i]); |
275 } | 278 } |
276 | 279 |
277 EXPECT_EQ(expected_pb.complete(), report_pb.complete()); | 280 EXPECT_EQ(expected_pb.complete(), report_pb.complete()); |
278 } | 281 } |
279 | 282 |
280 void VerifyResource( | 283 void VerifyResource( |
281 const ClientSafeBrowsingReportRequest::Resource* resource, | 284 const ClientSafeBrowsingReportRequest::Resource* resource, |
282 const ClientSafeBrowsingReportRequest::Resource* expected) { | 285 const ClientSafeBrowsingReportRequest::Resource* expected) { |
283 EXPECT_EQ(expected->id(), resource->id()); | 286 EXPECT_EQ(expected->id(), resource->id()); |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 pb_resource->set_parent_id(3); | 885 pb_resource->set_parent_id(3); |
883 pb_resource->set_url(kSecondRedirectURL); | 886 pb_resource->set_url(kSecondRedirectURL); |
884 pb_resource = expected.add_resources(); | 887 pb_resource = expected.add_resources(); |
885 pb_resource->set_id(3); | 888 pb_resource->set_id(3); |
886 pb_resource->set_url(kFirstRedirectURL); | 889 pb_resource->set_url(kFirstRedirectURL); |
887 | 890 |
888 VerifyResults(actual, expected); | 891 VerifyResults(actual, expected); |
889 } | 892 } |
890 | 893 |
891 } // namespace safe_browsing | 894 } // namespace safe_browsing |
OLD | NEW |