| OLD | NEW |
| 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 "components/sync/syncable/parent_child_index.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "sync/syncable/entry_kernel.h" | 12 #include "components/sync/syncable/entry_kernel.h" |
| 13 #include "sync/syncable/syncable_util.h" | 13 #include "components/sync/syncable/syncable_util.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace syncer { | 16 namespace syncer { |
| 17 namespace syncable { | 17 namespace syncable { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 static const std::string kCacheGuid = "8HhNIHlEOCGQbIAALr9QEg=="; | 21 static const std::string kCacheGuid = "8HhNIHlEOCGQbIAALr9QEg=="; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 EntryKernel* MakeBookmark(int n, int pos, bool is_dir) { | 86 EntryKernel* MakeBookmark(int n, int pos, bool is_dir) { |
| 87 // Mimics a regular bookmark or folder. | 87 // Mimics a regular bookmark or folder. |
| 88 EntryKernel* bm = new EntryKernel(); | 88 EntryKernel* bm = new EntryKernel(); |
| 89 bm->put(META_HANDLE, n); | 89 bm->put(META_HANDLE, n); |
| 90 bm->put(BASE_VERSION, 10); | 90 bm->put(BASE_VERSION, 10); |
| 91 bm->put(SERVER_VERSION, 10); | 91 bm->put(SERVER_VERSION, 10); |
| 92 bm->put(IS_DIR, is_dir); | 92 bm->put(IS_DIR, is_dir); |
| 93 bm->put(ID, GetBookmarkId(n)); | 93 bm->put(ID, GetBookmarkId(n)); |
| 94 bm->put(PARENT_ID, GetBookmarkRootId()); | 94 bm->put(PARENT_ID, GetBookmarkRootId()); |
| 95 | 95 |
| 96 bm->put(UNIQUE_BOOKMARK_TAG, | 96 bm->put(UNIQUE_BOOKMARK_TAG, syncable::GenerateSyncableBookmarkHash( |
| 97 syncable::GenerateSyncableBookmarkHash(kCacheGuid, | 97 kCacheGuid, bm->ref(ID).GetServerId())); |
| 98 bm->ref(ID).GetServerId())); | |
| 99 | 98 |
| 100 UniquePosition unique_pos = | 99 UniquePosition unique_pos = |
| 101 UniquePosition::FromInt64(pos, bm->ref(UNIQUE_BOOKMARK_TAG)); | 100 UniquePosition::FromInt64(pos, bm->ref(UNIQUE_BOOKMARK_TAG)); |
| 102 bm->put(UNIQUE_POSITION, unique_pos); | 101 bm->put(UNIQUE_POSITION, unique_pos); |
| 103 bm->put(SERVER_UNIQUE_POSITION, unique_pos); | 102 bm->put(SERVER_UNIQUE_POSITION, unique_pos); |
| 104 | 103 |
| 105 owned_entry_kernels_.push_back(bm); | 104 owned_entry_kernels_.push_back(bm); |
| 106 return bm; | 105 return bm; |
| 107 } | 106 } |
| 108 | 107 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 const OrderedChildSet* children = index_.GetChildren(type_root_id); | 515 const OrderedChildSet* children = index_.GetChildren(type_root_id); |
| 517 ASSERT_TRUE(children); | 516 ASSERT_TRUE(children); |
| 518 EXPECT_EQ(2UL, children->size()); | 517 EXPECT_EQ(2UL, children->size()); |
| 519 const OrderedChildSet* children_bad = index_.GetChildren(bad_type_root_id); | 518 const OrderedChildSet* children_bad = index_.GetChildren(bad_type_root_id); |
| 520 ASSERT_TRUE(children_bad); | 519 ASSERT_TRUE(children_bad); |
| 521 EXPECT_EQ(2UL, children_bad->size()); | 520 EXPECT_EQ(2UL, children_bad->size()); |
| 522 } | 521 } |
| 523 | 522 |
| 524 } // namespace syncable | 523 } // namespace syncable |
| 525 } // namespace syncer | 524 } // namespace syncer |
| 526 | |
| OLD | NEW |