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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_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/variations_seed_signat ure_incident.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_incident.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(bool alternate) { 18 std::unique_ptr<Incident> MakeIncident(bool alternate) {
18 scoped_ptr<ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> 19 std::unique_ptr<
20 ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident>
19 incident( 21 incident(
20 new ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident) ; 22 new ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident) ;
21 if (alternate) { 23 if (alternate) {
22 incident->set_variations_seed_signature( 24 incident->set_variations_seed_signature(
23 "AEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz" 25 "AEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz"
24 "L7tXVLhURxUQcpiMg9eMLWO0U="); 26 "L7tXVLhURxUQcpiMg9eMLWO0U=");
25 } else { 27 } else {
26 incident->set_variations_seed_signature( 28 incident->set_variations_seed_signature(
27 "MEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz" 29 "MEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz"
28 "L7tXVLhURxUQcpiMg9eMLWO0U="); 30 "L7tXVLhURxUQcpiMg9eMLWO0U=");
29 } 31 }
30 return make_scoped_ptr( 32 return base::WrapUnique(
31 new VariationsSeedSignatureIncident(std::move(incident))); 33 new VariationsSeedSignatureIncident(std::move(incident)));
32 } 34 }
33 35
34 } // namespace 36 } // namespace
35 37
36 TEST(VariationsSeedSignatureIncident, GetType) { 38 TEST(VariationsSeedSignatureIncident, GetType) {
37 ASSERT_EQ(IncidentType::VARIATIONS_SEED_SIGNATURE, 39 ASSERT_EQ(IncidentType::VARIATIONS_SEED_SIGNATURE,
38 MakeIncident(false)->GetType()); 40 MakeIncident(false)->GetType());
39 } 41 }
40 42
(...skipping 11 matching lines...) Expand all
52 MakeIncident(false)->ComputeDigest()); 54 MakeIncident(false)->ComputeDigest());
53 } 55 }
54 56
55 // Tests that GetDigest returns different values for different incidents. 57 // Tests that GetDigest returns different values for different incidents.
56 TEST(VariationsSeedSignatureIncident, DifferentIncidentDifferentDigest) { 58 TEST(VariationsSeedSignatureIncident, DifferentIncidentDifferentDigest) {
57 EXPECT_NE(MakeIncident(false)->ComputeDigest(), 59 EXPECT_NE(MakeIncident(false)->ComputeDigest(),
58 MakeIncident(true)->ComputeDigest()); 60 MakeIncident(true)->ComputeDigest());
59 } 61 }
60 62
61 } // namespace safe_browsing 63 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698