OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/blacklist_load_inciden t.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/suspicious_module_inci dent.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/common/safe_browsing/csd.pb.h" | 10 #include "chrome/common/safe_browsing/csd.pb.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace safe_browsing { | 13 namespace safe_browsing { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 scoped_ptr<Incident> MakeIncident(const char* digest) { | 17 scoped_ptr<Incident> MakeIncident(const char* digest) { |
18 scoped_ptr<ClientIncidentReport_IncidentData_BlacklistLoadIncident> incident( | 18 scoped_ptr<ClientIncidentReport_IncidentData_SuspiciousModuleIncident> |
19 new ClientIncidentReport_IncidentData_BlacklistLoadIncident); | 19 incident(new ClientIncidentReport_IncidentData_SuspiciousModuleIncident); |
20 incident->set_path("foo"); | 20 incident->set_path("foo"); |
21 return make_scoped_ptr(new BlacklistLoadIncident(std::move(incident))); | 21 return make_scoped_ptr(new SuspiciousModuleIncident(std::move(incident))); |
22 } | 22 } |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 TEST(BlacklistLoadIncident, GetType) { | 26 TEST(SuspiciousModuleIncident, GetType) { |
27 ASSERT_EQ(IncidentType::BLACKLIST_LOAD, MakeIncident("37")->GetType()); | 27 ASSERT_EQ(IncidentType::SUSPICIOUS_MODULE, MakeIncident("37")->GetType()); |
28 } | 28 } |
29 | 29 |
30 // Tests that GetKey returns the dll path. | 30 // Tests that GetKey returns the dll path. |
31 TEST(BlacklistLoadIncident, KeyIsPath) { | 31 TEST(SuspiciousModuleIncident, KeyIsPath) { |
32 ASSERT_EQ(std::string("foo"), MakeIncident("37")->GetKey()); | 32 ASSERT_EQ(std::string("foo"), MakeIncident("37")->GetKey()); |
33 } | 33 } |
34 | 34 |
35 // Tests that GetDigest returns the same value for the same incident. | 35 // Tests that GetDigest returns the same value for the same incident. |
36 TEST(BlacklistLoadIncident, SameIncidentSameDigest) { | 36 TEST(SuspiciousModuleIncident, SameIncidentSameDigest) { |
37 ASSERT_EQ(MakeIncident("37")->ComputeDigest(), | 37 ASSERT_EQ(MakeIncident("37")->ComputeDigest(), |
38 MakeIncident("37")->ComputeDigest()); | 38 MakeIncident("37")->ComputeDigest()); |
39 } | 39 } |
40 | 40 |
41 // Tests that GetDigest returns different values for different incidents. | 41 // Tests that GetDigest returns different values for different incidents. |
42 TEST(BlacklistLoadIncident, DifferentIncidentDifferentDigest) { | 42 TEST(SuspiciousModuleIncident, DifferentIncidentDifferentDigest) { |
43 ASSERT_EQ(MakeIncident("37")->ComputeDigest(), | 43 ASSERT_EQ(MakeIncident("37")->ComputeDigest(), |
grt (UTC plus 2)
2016/02/18 16:06:55
this test is broken:
- this should be ASSERT_NE si
proberge
2016/02/18 18:44:40
Good catch. It looks like blacklist_load_incident_
| |
44 MakeIncident("42")->ComputeDigest()); | 44 MakeIncident("42")->ComputeDigest()); |
45 } | 45 } |
46 | 46 |
47 } // namespace safe_browsing | 47 } // namespace safe_browsing |
OLD | NEW |