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

Side by Side Diff: base/values.cc

Issue 3163020: Fix DictionaryValue::Equals() to also detect differences in key names. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix test expectations Created 10 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 | « no previous file | base/values_unittest.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/values.h" 5 #include "base/values.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 10
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (other->GetType() != GetType()) 332 if (other->GetType() != GetType())
333 return false; 333 return false;
334 334
335 const DictionaryValue* other_dict = 335 const DictionaryValue* other_dict =
336 static_cast<const DictionaryValue*>(other); 336 static_cast<const DictionaryValue*>(other);
337 key_iterator lhs_it(begin_keys()); 337 key_iterator lhs_it(begin_keys());
338 key_iterator rhs_it(other_dict->begin_keys()); 338 key_iterator rhs_it(other_dict->begin_keys());
339 while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) { 339 while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
340 Value* lhs; 340 Value* lhs;
341 Value* rhs; 341 Value* rhs;
342 if (!GetWithoutPathExpansion(*lhs_it, &lhs) || 342 if (*lhs_it != *rhs_it ||
343 !GetWithoutPathExpansion(*lhs_it, &lhs) ||
343 !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) || 344 !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
344 !lhs->Equals(rhs)) { 345 !lhs->Equals(rhs)) {
345 return false; 346 return false;
346 } 347 }
347 ++lhs_it; 348 ++lhs_it;
348 ++rhs_it; 349 ++rhs_it;
349 } 350 }
350 if (lhs_it != end_keys() || rhs_it != other_dict->end_keys()) 351 if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
351 return false; 352 return false;
352 353
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 return false; 1031 return false;
1031 } 1032 }
1032 if (lhs_it != end() || rhs_it != other_list->end()) 1033 if (lhs_it != end() || rhs_it != other_list->end())
1033 return false; 1034 return false;
1034 1035
1035 return true; 1036 return true;
1036 } 1037 }
1037 1038
1038 ValueSerializer::~ValueSerializer() { 1039 ValueSerializer::~ValueSerializer() {
1039 } 1040 }
OLDNEW
« no previous file with comments | « no previous file | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698