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

Side by Side Diff: sync/internal_api/public/util/proto_value_ptr_unittest.cc

Issue 1609923002: Fix remaining incompatibilities between scoped_ptr and unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 "sync/internal_api/public/util/proto_value_ptr.h" 5 #include "sync/internal_api/public/util/proto_value_ptr.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 27 matching lines...) Expand all
38 g_parse_count = 0; 38 g_parse_count = 0;
39 g_delete_count = 0; 39 g_delete_count = 0;
40 } 40 }
41 41
42 static int copy_count() { return g_copy_count; } 42 static int copy_count() { return g_copy_count; }
43 static int parse_count() { return g_parse_count; } 43 static int parse_count() { return g_parse_count; }
44 static int delete_count() { return g_delete_count; } 44 static int delete_count() { return g_delete_count; }
45 45
46 int value() const { return value_->value(); } 46 int value() const { return value_->value(); }
47 IntValue* value_ptr() const { return value_.get(); } 47 IntValue* value_ptr() const { return value_.get(); }
48 bool is_initialized() const { return value_; } 48 bool is_initialized() const { return !!value_; }
49 bool is_default() const { return is_default_; } 49 bool is_default() const { return is_default_; }
50 50
51 // TestValue uses the default traits struct with ProtoValuePtr<TestValue>. 51 // TestValue uses the default traits struct with ProtoValuePtr<TestValue>.
52 // The following 4 functions are expected by the traits struct to exist 52 // The following 4 functions are expected by the traits struct to exist
53 // in this class. 53 // in this class.
54 void CopyFrom(const TestValue& from) { 54 void CopyFrom(const TestValue& from) {
55 // Expected to always copy from an initialized instance 55 // Expected to always copy from an initialized instance
56 // to an uninitialized one. 56 // to an uninitialized one.
57 // Not expected either value to be default. 57 // Not expected either value to be default.
58 ASSERT_FALSE(is_initialized()); 58 ASSERT_FALSE(is_initialized());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 EXPECT_EQ(1, TestValue::parse_count()); 239 EXPECT_EQ(1, TestValue::parse_count());
240 EXPECT_EQ(0, TestValue::copy_count()); 240 EXPECT_EQ(0, TestValue::copy_count());
241 241
242 EXPECT_EQ(v1, ptr1->value()); 242 EXPECT_EQ(v1, ptr1->value());
243 } 243 }
244 244
245 EXPECT_EQ(1, TestValue::delete_count()); 245 EXPECT_EQ(1, TestValue::delete_count());
246 } 246 }
247 247
248 } // namespace syncer 248 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698