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

Side by Side Diff: sync/syncable/parent_child_index_unittest.cc

Issue 1008993004: Sync: Handle empty (implicit) ParentId in GetPredecessorId and GetSuccessorId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added extra unit test. Created 5 years, 9 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/syncable/parent_child_index.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/syncable/parent_child_index.h" 5 #include "sync/syncable/parent_child_index.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 EntryKernel* p1 = MakeUniqueClientItem(PREFERENCES, 1); 382 EntryKernel* p1 = MakeUniqueClientItem(PREFERENCES, 1);
383 EntryKernel* p2 = MakeUniqueClientItem(PREFERENCES, 2); 383 EntryKernel* p2 = MakeUniqueClientItem(PREFERENCES, 2);
384 384
385 index_.Insert(p1); 385 index_.Insert(p1);
386 index_.Insert(p2); 386 index_.Insert(p2);
387 387
388 EXPECT_TRUE(index_.Contains(p1)); 388 EXPECT_TRUE(index_.Contains(p1));
389 EXPECT_TRUE(index_.Contains(p2)); 389 EXPECT_TRUE(index_.Contains(p2));
390 390
391 // Items should appear under the type root 391 // Items should appear under the type root
392 const OrderedChildSet* children = index_.GetChildren(type_root_id); 392 const OrderedChildSet* children = index_.GetChildren(type_root);
393 ASSERT_TRUE(children); 393 ASSERT_TRUE(children);
394 EXPECT_EQ(2UL, children->size()); 394 EXPECT_EQ(2UL, children->size());
395 395
396 EXPECT_EQ(2UL, index_.GetSiblings(p1)->size());
397 EXPECT_EQ(2UL, index_.GetSiblings(p2)->size());
398
396 index_.Remove(p1); 399 index_.Remove(p1);
397 400
398 EXPECT_FALSE(index_.Contains(p1)); 401 EXPECT_FALSE(index_.Contains(p1));
399 EXPECT_TRUE(index_.Contains(p2)); 402 EXPECT_TRUE(index_.Contains(p2));
400 children = index_.GetChildren(type_root_id); 403 children = index_.GetChildren(type_root_id);
401 ASSERT_TRUE(children); 404 ASSERT_TRUE(children);
402 EXPECT_EQ(1UL, children->size()); 405 EXPECT_EQ(1UL, children->size());
403 406
404 index_.Remove(p2); 407 index_.Remove(p2);
405 408
406 EXPECT_FALSE(index_.Contains(p2)); 409 EXPECT_FALSE(index_.Contains(p2));
407 children = index_.GetChildren(type_root_id); 410 children = index_.GetChildren(type_root);
408 ASSERT_EQ(nullptr, children); 411 ASSERT_EQ(nullptr, children);
409 412
410 index_.Remove(type_root); 413 index_.Remove(type_root);
411 EXPECT_EQ(Id(), IndexKnownModelTypeRootId(PREFERENCES)); 414 EXPECT_EQ(Id(), IndexKnownModelTypeRootId(PREFERENCES));
412 } 415 }
413 416
414 } // namespace syncable 417 } // namespace syncable
415 } // namespace syncer 418 } // namespace syncer
416 419
OLDNEW
« no previous file with comments | « sync/syncable/parent_child_index.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698