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

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

Issue 2259523003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/tracked_preference_inc ident.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/tracked_preference_inc ident.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "chrome/common/safe_browsing/csd.pb.h" 11 #include "chrome/common/safe_browsing/csd.pb.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace safe_browsing { 14 namespace safe_browsing {
15 15
16 namespace { 16 namespace {
17 17
18 std::unique_ptr<Incident> MakeIncident(bool changed, bool is_personal) { 18 std::unique_ptr<Incident> MakeIncident(bool changed, bool is_personal) {
19 std::unique_ptr<ClientIncidentReport_IncidentData_TrackedPreferenceIncident> 19 std::unique_ptr<ClientIncidentReport_IncidentData_TrackedPreferenceIncident>
20 incident(new ClientIncidentReport_IncidentData_TrackedPreferenceIncident); 20 incident(new ClientIncidentReport_IncidentData_TrackedPreferenceIncident);
21 21
22 incident->set_path("foo"); 22 incident->set_path("foo");
23 incident->set_atomic_value("bar"); 23 incident->set_atomic_value("bar");
24 incident->set_value_state( 24 incident->set_value_state(
25 changed 25 changed
26 ? ClientIncidentReport_IncidentData_TrackedPreferenceIncident_ValueSta te_CHANGED 26 ? ClientIncidentReport_IncidentData_TrackedPreferenceIncident_ValueSta te_CHANGED
27 : ClientIncidentReport_IncidentData_TrackedPreferenceIncident_ValueSta te_CLEARED); 27 : ClientIncidentReport_IncidentData_TrackedPreferenceIncident_ValueSta te_CLEARED);
28 return base::WrapUnique( 28 return base::MakeUnique<TrackedPreferenceIncident>(std::move(incident),
29 new TrackedPreferenceIncident(std::move(incident), is_personal)); 29 is_personal);
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 TEST(TrackedPreferenceIncident, GetType) { 34 TEST(TrackedPreferenceIncident, GetType) {
35 ASSERT_EQ(IncidentType::TRACKED_PREFERENCE, 35 ASSERT_EQ(IncidentType::TRACKED_PREFERENCE,
36 MakeIncident(false, false)->GetType()); 36 MakeIncident(false, false)->GetType());
37 } 37 }
38 38
39 // Tests that GetKey returns the preference path. 39 // Tests that GetKey returns the preference path.
(...skipping 18 matching lines...) Expand all
58 std::unique_ptr<ClientIncidentReport_IncidentData> impersonal( 58 std::unique_ptr<ClientIncidentReport_IncidentData> impersonal(
59 MakeIncident(false, false)->TakePayload()); 59 MakeIncident(false, false)->TakePayload());
60 ASSERT_TRUE(impersonal->tracked_preference().has_atomic_value()); 60 ASSERT_TRUE(impersonal->tracked_preference().has_atomic_value());
61 61
62 std::unique_ptr<ClientIncidentReport_IncidentData> personal( 62 std::unique_ptr<ClientIncidentReport_IncidentData> personal(
63 MakeIncident(false, true)->TakePayload()); 63 MakeIncident(false, true)->TakePayload());
64 ASSERT_FALSE(personal->tracked_preference().has_atomic_value()); 64 ASSERT_FALSE(personal->tracked_preference().has_atomic_value());
65 } 65 }
66 66
67 } // namespace safe_browsing 67 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698