| 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 "components/sync/syncable/parent_child_index.h" | 5 #include "components/sync/syncable/parent_child_index.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "components/sync/base/hash_util.h" |
| 11 #include "components/sync/syncable/entry_kernel.h" | 12 #include "components/sync/syncable/entry_kernel.h" |
| 12 #include "components/sync/syncable/syncable_util.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 namespace syncable { | 16 namespace syncable { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const char kCacheGuid[] = "8HhNIHlEOCGQbIAALr9QEg=="; | 20 const char kCacheGuid[] = "8HhNIHlEOCGQbIAALr9QEg=="; |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 EntryKernel* MakeBookmark(int n, int pos, bool is_dir) { | 81 EntryKernel* MakeBookmark(int n, int pos, bool is_dir) { |
| 82 // Mimics a regular bookmark or folder. | 82 // Mimics a regular bookmark or folder. |
| 83 EntryKernel* bm = new EntryKernel(); | 83 EntryKernel* bm = new EntryKernel(); |
| 84 bm->put(META_HANDLE, n); | 84 bm->put(META_HANDLE, n); |
| 85 bm->put(BASE_VERSION, 10); | 85 bm->put(BASE_VERSION, 10); |
| 86 bm->put(SERVER_VERSION, 10); | 86 bm->put(SERVER_VERSION, 10); |
| 87 bm->put(IS_DIR, is_dir); | 87 bm->put(IS_DIR, is_dir); |
| 88 bm->put(ID, GetBookmarkId(n)); | 88 bm->put(ID, GetBookmarkId(n)); |
| 89 bm->put(PARENT_ID, GetBookmarkRootId()); | 89 bm->put(PARENT_ID, GetBookmarkRootId()); |
| 90 | 90 |
| 91 bm->put(UNIQUE_BOOKMARK_TAG, syncable::GenerateSyncableBookmarkHash( | 91 bm->put(UNIQUE_BOOKMARK_TAG, GenerateSyncableBookmarkHash( |
| 92 kCacheGuid, bm->ref(ID).GetServerId())); | 92 kCacheGuid, bm->ref(ID).GetServerId())); |
| 93 | 93 |
| 94 UniquePosition unique_pos = | 94 UniquePosition unique_pos = |
| 95 UniquePosition::FromInt64(pos, bm->ref(UNIQUE_BOOKMARK_TAG)); | 95 UniquePosition::FromInt64(pos, bm->ref(UNIQUE_BOOKMARK_TAG)); |
| 96 bm->put(UNIQUE_POSITION, unique_pos); | 96 bm->put(UNIQUE_POSITION, unique_pos); |
| 97 bm->put(SERVER_UNIQUE_POSITION, unique_pos); | 97 bm->put(SERVER_UNIQUE_POSITION, unique_pos); |
| 98 | 98 |
| 99 owned_entry_kernels_.push_back(base::WrapUnique(bm)); | 99 owned_entry_kernels_.push_back(base::WrapUnique(bm)); |
| 100 return bm; | 100 return bm; |
| 101 } | 101 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 const OrderedChildSet* children = index_.GetChildren(type_root_id); | 510 const OrderedChildSet* children = index_.GetChildren(type_root_id); |
| 511 ASSERT_TRUE(children); | 511 ASSERT_TRUE(children); |
| 512 EXPECT_EQ(2UL, children->size()); | 512 EXPECT_EQ(2UL, children->size()); |
| 513 const OrderedChildSet* children_bad = index_.GetChildren(bad_type_root_id); | 513 const OrderedChildSet* children_bad = index_.GetChildren(bad_type_root_id); |
| 514 ASSERT_TRUE(children_bad); | 514 ASSERT_TRUE(children_bad); |
| 515 EXPECT_EQ(2UL, children_bad->size()); | 515 EXPECT_EQ(2UL, children_bad->size()); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace syncable | 518 } // namespace syncable |
| 519 } // namespace syncer | 519 } // namespace syncer |
| OLD | NEW |