OLD | NEW |
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 <memory> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace syncer { | 13 namespace syncer { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Simple test struct that wraps an integer | 17 // Simple test struct that wraps an integer |
18 struct IntValue { | 18 struct IntValue { |
19 public: | 19 public: |
20 explicit IntValue(int value) { value_ = value; } | 20 explicit IntValue(int value) { value_ = value; } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 static TestValue default_instance; | 92 static TestValue default_instance; |
93 default_instance.is_default_ = true; | 93 default_instance.is_default_ = true; |
94 return default_instance; | 94 return default_instance; |
95 } | 95 } |
96 | 96 |
97 private: | 97 private: |
98 static int g_copy_count; | 98 static int g_copy_count; |
99 static int g_parse_count; | 99 static int g_parse_count; |
100 static int g_delete_count; | 100 static int g_delete_count; |
101 | 101 |
102 scoped_ptr<IntValue> value_; | 102 std::unique_ptr<IntValue> value_; |
103 bool is_default_; | 103 bool is_default_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(TestValue); | 105 DISALLOW_COPY_AND_ASSIGN(TestValue); |
106 }; | 106 }; |
107 | 107 |
108 // Static initializers. | 108 // Static initializers. |
109 int TestValue::g_copy_count = 0; | 109 int TestValue::g_copy_count = 0; |
110 int TestValue::g_parse_count = 0; | 110 int TestValue::g_parse_count = 0; |
111 int TestValue::g_delete_count = 0; | 111 int TestValue::g_delete_count = 0; |
112 | 112 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |