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

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: Cleaned up Created 4 years, 12 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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <string> 9 #include <string>
10 #include <utility>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/test/values_test_util.h" 14 #include "base/test/values_test_util.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "sync/protocol/extension_specifics.pb.h" 16 #include "sync/protocol/extension_specifics.pb.h"
17 #include "sync/protocol/proto_value_conversions.h" 17 #include "sync/protocol/proto_value_conversions.h"
18 #include "sync/protocol/sync.pb.h" 18 #include "sync/protocol/sync.pb.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 ~TestExtraChangeRecordData() override { 80 ~TestExtraChangeRecordData() override {
81 EXPECT_EQ(expected_to_value_calls_, to_value_calls_); 81 EXPECT_EQ(expected_to_value_calls_, to_value_calls_);
82 } 82 }
83 83
84 scoped_ptr<base::DictionaryValue> ToValue() const override { 84 scoped_ptr<base::DictionaryValue> ToValue() const override {
85 const_cast<TestExtraChangeRecordData*>(this)->to_value_calls_++; 85 const_cast<TestExtraChangeRecordData*>(this)->to_value_calls_++;
86 return dict_->CreateDeepCopy(); 86 return dict_->CreateDeepCopy();
87 } 87 }
88 88
89 void set_dictionary_value(scoped_ptr<base::DictionaryValue> dict) { 89 void set_dictionary_value(scoped_ptr<base::DictionaryValue> dict) {
90 dict_ = dict.Pass(); 90 dict_ = std::move(dict);
91 } 91 }
92 92
93 void set_expected_to_value_calls(size_t expectation) { 93 void set_expected_to_value_calls(size_t expectation) {
94 expected_to_value_calls_ = expectation; 94 expected_to_value_calls_ = expectation;
95 } 95 }
96 96
97 private: 97 private:
98 scoped_ptr<base::DictionaryValue> dict_; 98 scoped_ptr<base::DictionaryValue> dict_;
99 size_t to_value_calls_; 99 size_t to_value_calls_;
100 size_t expected_to_value_calls_; 100 size_t expected_to_value_calls_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 { 144 {
145 ChangeRecord record; 145 ChangeRecord record;
146 record.action = ChangeRecord::ACTION_DELETE; 146 record.action = ChangeRecord::ACTION_DELETE;
147 record.id = kTestId; 147 record.id = kTestId;
148 record.specifics = old_specifics; 148 record.specifics = old_specifics;
149 149
150 scoped_ptr<base::DictionaryValue> extra_value(new base::DictionaryValue()); 150 scoped_ptr<base::DictionaryValue> extra_value(new base::DictionaryValue());
151 extra_value->SetString("foo", "bar"); 151 extra_value->SetString("foo", "bar");
152 scoped_ptr<TestExtraChangeRecordData> extra( 152 scoped_ptr<TestExtraChangeRecordData> extra(
153 new TestExtraChangeRecordData()); 153 new TestExtraChangeRecordData());
154 extra->set_dictionary_value(extra_value.Pass()); 154 extra->set_dictionary_value(std::move(extra_value));
155 extra->set_expected_to_value_calls(2U); 155 extra->set_expected_to_value_calls(2U);
156 156
157 record.extra.reset(extra.release()); 157 record.extra.reset(extra.release());
158 scoped_ptr<base::DictionaryValue> value(record.ToValue()); 158 scoped_ptr<base::DictionaryValue> value(record.ToValue());
159 CheckChangeRecordValue(record, *value); 159 CheckChangeRecordValue(record, *value);
160 } 160 }
161 } 161 }
162 162
163 } // namespace 163 } // namespace
164 } // namespace syncer 164 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/base/progress_marker_map.cc ('k') | sync/internal_api/public/sessions/commit_counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698