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

Side by Side Diff: sync/protocol/proto_value_conversions_unittest.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 4 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
« no previous file with comments | « sync/internal_api/syncapi_unittest.cc ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Keep this file in sync with the .proto files in this directory. 5 // Keep this file in sync with the .proto files in this directory.
6 6
7 #include "sync/protocol/proto_value_conversions.h" 7 #include "sync/protocol/proto_value_conversions.h"
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); 185 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics));
186 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE, 186 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE,
187 static_cast<int>(value->size())); 187 static_cast<int>(value->size()));
188 } 188 }
189 189
190 namespace { 190 namespace {
191 // Returns whether the given value has specifics under the entries in the given 191 // Returns whether the given value has specifics under the entries in the given
192 // path. 192 // path.
193 bool ValueHasSpecifics(const DictionaryValue& value, 193 bool ValueHasSpecifics(const DictionaryValue& value,
194 const std::string& path) { 194 const std::string& path) {
195 ListValue* entities_list = NULL; 195 const ListValue* entities_list = NULL;
196 DictionaryValue* entry_dictionary = NULL; 196 DictionaryValue* entry_dictionary = NULL;
197 DictionaryValue* specifics_dictionary = NULL; 197 DictionaryValue* specifics_dictionary = NULL;
198 198
199 if (!value.GetList(path, &entities_list)) 199 if (!value.GetList(path, &entities_list))
200 return false; 200 return false;
201 201
202 if (!entities_list->GetDictionary(0, &entry_dictionary)) 202 if (!entities_list->GetDictionary(0, &entry_dictionary))
203 return false; 203 return false;
204 204
205 return entry_dictionary->GetDictionary("specifics", 205 return entry_dictionary->GetDictionary("specifics",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 scoped_ptr<DictionaryValue> value_without_specifics( 245 scoped_ptr<DictionaryValue> value_without_specifics(
246 ClientToServerResponseToValue(message, false /* include_specifics */)); 246 ClientToServerResponseToValue(message, false /* include_specifics */));
247 EXPECT_FALSE(value_without_specifics->empty()); 247 EXPECT_FALSE(value_without_specifics->empty());
248 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), 248 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()),
249 "get_updates.entries")); 249 "get_updates.entries"));
250 } 250 }
251 251
252 } // namespace 252 } // namespace
253 } // namespace syncer 253 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/syncapi_unittest.cc ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698