| 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 "components/sync/base/proto_value_ptr.h" | 5 #include "components/sync/base/proto_value_ptr.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 DISALLOW_COPY_AND_ASSIGN(TestValue); | 106 DISALLOW_COPY_AND_ASSIGN(TestValue); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // Static initializers. | 109 // Static initializers. |
| 110 int TestValue::g_copy_count = 0; | 110 int TestValue::g_copy_count = 0; |
| 111 int TestValue::g_parse_count = 0; | 111 int TestValue::g_parse_count = 0; |
| 112 int TestValue::g_delete_count = 0; | 112 int TestValue::g_delete_count = 0; |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 typedef ProtoValuePtr<TestValue> TestPtr; | 116 using TestPtr = ProtoValuePtr<TestValue>; |
| 117 | 117 |
| 118 class ProtoValuePtrTest : public testing::Test { | 118 class ProtoValuePtrTest : public testing::Test { |
| 119 public: | 119 public: |
| 120 void SetUp() override { TestValue::ResetCounters(); } | 120 void SetUp() override { TestValue::ResetCounters(); } |
| 121 | 121 |
| 122 static bool WrappedValuesAreShared(const TestPtr& ptr1, const TestPtr& ptr2) { | 122 static bool WrappedValuesAreShared(const TestPtr& ptr1, const TestPtr& ptr2) { |
| 123 const TestValue& wrapped_value_1 = ptr1.value(); | 123 const TestValue& wrapped_value_1 = ptr1.value(); |
| 124 const TestValue& wrapped_value_2 = ptr2.value(); | 124 const TestValue& wrapped_value_2 = ptr2.value(); |
| 125 // Compare addresses. | 125 // Compare addresses. |
| 126 return &wrapped_value_1 == &wrapped_value_2; | 126 return &wrapped_value_1 == &wrapped_value_2; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 EXPECT_EQ(1, TestValue::parse_count()); | 240 EXPECT_EQ(1, TestValue::parse_count()); |
| 241 EXPECT_EQ(0, TestValue::copy_count()); | 241 EXPECT_EQ(0, TestValue::copy_count()); |
| 242 | 242 |
| 243 EXPECT_EQ(v1, ptr1->value()); | 243 EXPECT_EQ(v1, ptr1->value()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 EXPECT_EQ(1, TestValue::delete_count()); | 246 EXPECT_EQ(1, TestValue::delete_count()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace syncer | 249 } // namespace syncer |
| OLD | NEW |