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

Side by Side Diff: base/values_unittest.cc

Issue 7618021: base: Fix the TODO in ListValue::Remove(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/values.cc ('k') | chrome/browser/chromeos/user_cros_settings_provider.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <limits> 5 #include <limits>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_TRUE(list.Remove(0, NULL)); 229 EXPECT_TRUE(list.Remove(0, NULL));
230 EXPECT_TRUE(deletion_flag); 230 EXPECT_TRUE(deletion_flag);
231 EXPECT_EQ(0U, list.GetSize()); 231 EXPECT_EQ(0U, list.GetSize());
232 } 232 }
233 233
234 { 234 {
235 ListValue list; 235 ListValue list;
236 DeletionTestValue* value = new DeletionTestValue(&deletion_flag); 236 DeletionTestValue* value = new DeletionTestValue(&deletion_flag);
237 list.Append(value); 237 list.Append(value);
238 EXPECT_FALSE(deletion_flag); 238 EXPECT_FALSE(deletion_flag);
239 EXPECT_EQ(0, list.Remove(*value)); 239 size_t index = 0;
240 list.Remove(*value, &index);
241 EXPECT_EQ(0U, index);
240 EXPECT_TRUE(deletion_flag); 242 EXPECT_TRUE(deletion_flag);
241 EXPECT_EQ(0U, list.GetSize()); 243 EXPECT_EQ(0U, list.GetSize());
242 } 244 }
243 } 245 }
244 246
245 TEST(ValuesTest, DictionaryDeletion) { 247 TEST(ValuesTest, DictionaryDeletion) {
246 std::string key = "test"; 248 std::string key = "test";
247 bool deletion_flag = true; 249 bool deletion_flag = true;
248 250
249 { 251 {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 std::string sub_collide_key_value; 687 std::string sub_collide_key_value;
686 EXPECT_TRUE(res_sub_dict->GetString("sub_collide_key", 688 EXPECT_TRUE(res_sub_dict->GetString("sub_collide_key",
687 &sub_collide_key_value)); 689 &sub_collide_key_value));
688 EXPECT_EQ("sub_collide_key_value_merge", sub_collide_key_value); // Replaced. 690 EXPECT_EQ("sub_collide_key_value_merge", sub_collide_key_value); // Replaced.
689 std::string sub_merge_key_value; 691 std::string sub_merge_key_value;
690 EXPECT_TRUE(res_sub_dict->GetString("sub_merge_key", &sub_merge_key_value)); 692 EXPECT_TRUE(res_sub_dict->GetString("sub_merge_key", &sub_merge_key_value));
691 EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value); // Merged in. 693 EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value); // Merged in.
692 } 694 }
693 695
694 } // namespace base 696 } // namespace base
OLDNEW
« no previous file with comments | « base/values.cc ('k') | chrome/browser/chromeos/user_cros_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698