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

Side by Side Diff: sync/internal_api/public/change_record_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/change_record.h" 5 #include "sync/internal_api/public/change_record.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility>
8 9
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "base/test/values_test_util.h" 12 #include "base/test/values_test_util.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "sync/protocol/extension_specifics.pb.h" 14 #include "sync/protocol/extension_specifics.pb.h"
14 #include "sync/protocol/proto_value_conversions.h" 15 #include "sync/protocol/proto_value_conversions.h"
15 #include "sync/protocol/sync.pb.h" 16 #include "sync/protocol/sync.pb.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ~TestExtraChangeRecordData() override { 78 ~TestExtraChangeRecordData() override {
78 EXPECT_EQ(expected_to_value_calls_, to_value_calls_); 79 EXPECT_EQ(expected_to_value_calls_, to_value_calls_);
79 } 80 }
80 81
81 scoped_ptr<base::DictionaryValue> ToValue() const override { 82 scoped_ptr<base::DictionaryValue> ToValue() const override {
82 const_cast<TestExtraChangeRecordData*>(this)->to_value_calls_++; 83 const_cast<TestExtraChangeRecordData*>(this)->to_value_calls_++;
83 return dict_->CreateDeepCopy(); 84 return dict_->CreateDeepCopy();
84 } 85 }
85 86
86 void set_dictionary_value(scoped_ptr<base::DictionaryValue> dict) { 87 void set_dictionary_value(scoped_ptr<base::DictionaryValue> dict) {
87 dict_ = dict.Pass(); 88 dict_ = std::move(dict);
88 } 89 }
89 90
90 void set_expected_to_value_calls(size_t expectation) { 91 void set_expected_to_value_calls(size_t expectation) {
91 expected_to_value_calls_ = expectation; 92 expected_to_value_calls_ = expectation;
92 } 93 }
93 94
94 private: 95 private:
95 scoped_ptr<base::DictionaryValue> dict_; 96 scoped_ptr<base::DictionaryValue> dict_;
96 size_t to_value_calls_; 97 size_t to_value_calls_;
97 size_t expected_to_value_calls_; 98 size_t expected_to_value_calls_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 { 142 {
142 ChangeRecord record; 143 ChangeRecord record;
143 record.action = ChangeRecord::ACTION_DELETE; 144 record.action = ChangeRecord::ACTION_DELETE;
144 record.id = kTestId; 145 record.id = kTestId;
145 record.specifics = old_specifics; 146 record.specifics = old_specifics;
146 147
147 scoped_ptr<base::DictionaryValue> extra_value(new base::DictionaryValue()); 148 scoped_ptr<base::DictionaryValue> extra_value(new base::DictionaryValue());
148 extra_value->SetString("foo", "bar"); 149 extra_value->SetString("foo", "bar");
149 scoped_ptr<TestExtraChangeRecordData> extra( 150 scoped_ptr<TestExtraChangeRecordData> extra(
150 new TestExtraChangeRecordData()); 151 new TestExtraChangeRecordData());
151 extra->set_dictionary_value(extra_value.Pass()); 152 extra->set_dictionary_value(std::move(extra_value));
152 extra->set_expected_to_value_calls(2U); 153 extra->set_expected_to_value_calls(2U);
153 154
154 record.extra.reset(extra.release()); 155 record.extra.reset(extra.release());
155 scoped_ptr<base::DictionaryValue> value(record.ToValue()); 156 scoped_ptr<base::DictionaryValue> value(record.ToValue());
156 CheckChangeRecordValue(record, *value); 157 CheckChangeRecordValue(record, *value);
157 } 158 }
158 } 159 }
159 160
160 } // namespace 161 } // namespace
161 } // namespace syncer 162 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698