| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid
ent.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid
ent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const unsigned char certificates[][5] = { | 33 const unsigned char certificates[][5] = { |
| 34 {42, 255, 100, 53, 2}, | 34 {42, 255, 100, 53, 2}, |
| 35 {64, 33, 51, 91, 210}, | 35 {64, 33, 51, 91, 210}, |
| 36 }; | 36 }; |
| 37 for (size_t i = 0; i < arraysize(certificates); ++i) { | 37 for (size_t i = 0; i < arraysize(certificates); ++i) { |
| 38 ClientDownloadRequest_CertificateChain_Element* element = | 38 ClientDownloadRequest_CertificateChain_Element* element = |
| 39 certificate_chain->add_element(); | 39 certificate_chain->add_element(); |
| 40 element->set_certificate(certificates[i], arraysize(certificates[i])); | 40 element->set_certificate(certificates[i], arraysize(certificates[i])); |
| 41 } | 41 } |
| 42 | 42 |
| 43 return base::WrapUnique(new BinaryIntegrityIncident(std::move(incident))); | 43 return base::MakeUnique<BinaryIntegrityIncident>(std::move(incident)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 TEST(BinaryIntegrityIncident, GetType) { | 48 TEST(BinaryIntegrityIncident, GetType) { |
| 49 ASSERT_EQ(IncidentType::BINARY_INTEGRITY, MakeIncident("foo")->GetType()); | 49 ASSERT_EQ(IncidentType::BINARY_INTEGRITY, MakeIncident("foo")->GetType()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 TEST(BinaryIntegrityIncident, GetKeyIsFile) { | 52 TEST(BinaryIntegrityIncident, GetKeyIsFile) { |
| 53 ASSERT_EQ(std::string("foo"), MakeIncident("foo")->GetKey()); | 53 ASSERT_EQ(std::string("foo"), MakeIncident("foo")->GetKey()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TEST(BinaryIntegrityIncident, SameIncidentSameDigest) { | 56 TEST(BinaryIntegrityIncident, SameIncidentSameDigest) { |
| 57 ASSERT_EQ(MakeIncident("foo")->ComputeDigest(), | 57 ASSERT_EQ(MakeIncident("foo")->ComputeDigest(), |
| 58 MakeIncident("foo")->ComputeDigest()); | 58 MakeIncident("foo")->ComputeDigest()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 TEST(BinaryIntegrityIncident, DifferentIncidentDifferentDigest) { | 61 TEST(BinaryIntegrityIncident, DifferentIncidentDifferentDigest) { |
| 62 ASSERT_NE(MakeIncident("foo")->ComputeDigest(), | 62 ASSERT_NE(MakeIncident("foo")->ComputeDigest(), |
| 63 MakeIncident("bar")->ComputeDigest()); | 63 MakeIncident("bar")->ComputeDigest()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace safe_browsing | 66 } // namespace safe_browsing |
| OLD | NEW |