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 1539843002: Convert Pass()→std::move() in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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>
8
7 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
9 11
10 namespace syncer { 12 namespace syncer {
11 13
12 namespace { 14 namespace {
13 15
14 // Simple test struct that wraps an integer 16 // Simple test struct that wraps an integer
15 struct IntValue { 17 struct IntValue {
16 public: 18 public:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 64
63 void Swap(TestValue* src) { 65 void Swap(TestValue* src) {
64 // Expected to always swap with an initialized instance. 66 // Expected to always swap with an initialized instance.
65 // The current instance must always be an uninitialized one. 67 // The current instance must always be an uninitialized one.
66 // Not expected either value to be default. 68 // Not expected either value to be default.
67 ASSERT_FALSE(is_initialized()); 69 ASSERT_FALSE(is_initialized());
68 ASSERT_FALSE(is_default()); 70 ASSERT_FALSE(is_default());
69 ASSERT_TRUE(src->is_initialized()); 71 ASSERT_TRUE(src->is_initialized());
70 ASSERT_FALSE(src->is_default()); 72 ASSERT_FALSE(src->is_default());
71 // Not exactly swap, but good enough for the test. 73 // Not exactly swap, but good enough for the test.
72 value_ = src->value_.Pass(); 74 value_ = std::move(src->value_);
73 } 75 }
74 76
75 void ParseFromArray(const void* blob, int length) { 77 void ParseFromArray(const void* blob, int length) {
76 // Similarly to CopyFrom this is expected to be called on 78 // Similarly to CopyFrom this is expected to be called on
77 // an uninitialized instance. 79 // an uninitialized instance.
78 ASSERT_FALSE(is_initialized()); 80 ASSERT_FALSE(is_initialized());
79 ASSERT_FALSE(is_default()); 81 ASSERT_FALSE(is_default());
80 // The blob is an address of an integer 82 // The blob is an address of an integer
81 ASSERT_EQ(static_cast<int>(sizeof(int)), length); 83 ASSERT_EQ(static_cast<int>(sizeof(int)), length);
82 value_.reset(new IntValue(*static_cast<const int*>(blob))); 84 value_.reset(new IntValue(*static_cast<const int*>(blob)));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 EXPECT_EQ(1, TestValue::parse_count()); 239 EXPECT_EQ(1, TestValue::parse_count());
238 EXPECT_EQ(0, TestValue::copy_count()); 240 EXPECT_EQ(0, TestValue::copy_count());
239 241
240 EXPECT_EQ(v1, ptr1->value()); 242 EXPECT_EQ(v1, ptr1->value());
241 } 243 }
242 244
243 EXPECT_EQ(1, TestValue::delete_count()); 245 EXPECT_EQ(1, TestValue::delete_count());
244 } 246 }
245 247
246 } // namespace syncer 248 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698