Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1884)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/blacklist_load_incident_unittest.cc

Issue 1870003002: Convert //chrome/browser/safe_browsing from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/blacklist_load_inciden t.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_inciden t.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/ptr_util.h"
10 #include "chrome/common/safe_browsing/csd.pb.h" 11 #include "chrome/common/safe_browsing/csd.pb.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace safe_browsing { 14 namespace safe_browsing {
14 15
15 namespace { 16 namespace {
16 17
17 scoped_ptr<Incident> MakeIncident(const char* path) { 18 std::unique_ptr<Incident> MakeIncident(const char* path) {
18 scoped_ptr<ClientIncidentReport_IncidentData_BlacklistLoadIncident> incident( 19 std::unique_ptr<ClientIncidentReport_IncidentData_BlacklistLoadIncident>
19 new ClientIncidentReport_IncidentData_BlacklistLoadIncident); 20 incident(new ClientIncidentReport_IncidentData_BlacklistLoadIncident);
20 incident->set_path(path); 21 incident->set_path(path);
21 return make_scoped_ptr(new BlacklistLoadIncident(std::move(incident))); 22 return base::WrapUnique(new BlacklistLoadIncident(std::move(incident)));
22 } 23 }
23 24
24 } // namespace 25 } // namespace
25 26
26 TEST(BlacklistLoadIncident, GetType) { 27 TEST(BlacklistLoadIncident, GetType) {
27 ASSERT_EQ(IncidentType::BLACKLIST_LOAD, MakeIncident("foo")->GetType()); 28 ASSERT_EQ(IncidentType::BLACKLIST_LOAD, MakeIncident("foo")->GetType());
28 } 29 }
29 30
30 // Tests that GetKey returns the dll path. 31 // Tests that GetKey returns the dll path.
31 TEST(BlacklistLoadIncident, KeyIsPath) { 32 TEST(BlacklistLoadIncident, KeyIsPath) {
32 ASSERT_EQ(std::string("foo"), MakeIncident("foo")->GetKey()); 33 ASSERT_EQ(std::string("foo"), MakeIncident("foo")->GetKey());
33 } 34 }
34 35
35 // Tests that GetDigest returns the same value for the same incident. 36 // Tests that GetDigest returns the same value for the same incident.
36 TEST(BlacklistLoadIncident, SameIncidentSameDigest) { 37 TEST(BlacklistLoadIncident, SameIncidentSameDigest) {
37 ASSERT_EQ(MakeIncident("foo")->ComputeDigest(), 38 ASSERT_EQ(MakeIncident("foo")->ComputeDigest(),
38 MakeIncident("foo")->ComputeDigest()); 39 MakeIncident("foo")->ComputeDigest());
39 } 40 }
40 41
41 // Tests that GetDigest returns different values for different incidents. 42 // Tests that GetDigest returns different values for different incidents.
42 TEST(BlacklistLoadIncident, DifferentIncidentDifferentDigest) { 43 TEST(BlacklistLoadIncident, DifferentIncidentDifferentDigest) {
43 ASSERT_NE(MakeIncident("foo")->ComputeDigest(), 44 ASSERT_NE(MakeIncident("foo")->ComputeDigest(),
44 MakeIncident("bar")->ComputeDigest()); 45 MakeIncident("bar")->ComputeDigest());
45 } 46 }
46 47
47 } // namespace safe_browsing 48 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698