| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/directory_unittest.h" | 5 #include "sync/syncable/directory_unittest.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/test/values_test_util.h" | 8 #include "base/test/values_test_util.h" |
| 9 #include "sync/internal_api/public/base/attachment_id_proto.h" | 9 #include "sync/internal_api/public/base/attachment_id_proto.h" |
| 10 #include "sync/syncable/syncable_proto_util.h" | 10 #include "sync/syncable/syncable_proto_util.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 ASSERT_TRUE(base_version == e.GetBaseVersion()); | 225 ASSERT_TRUE(base_version == e.GetBaseVersion()); |
| 226 ASSERT_TRUE(server_version == e.GetServerVersion()); | 226 ASSERT_TRUE(server_version == e.GetServerVersion()); |
| 227 ASSERT_TRUE(is_del == e.GetIsDel()); | 227 ASSERT_TRUE(is_del == e.GetIsDel()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { | 230 TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { |
| 231 const int metas_to_create = 50; | 231 const int metas_to_create = 50; |
| 232 MetahandleSet expected_purges; | 232 MetahandleSet expected_purges; |
| 233 MetahandleSet all_handles; | 233 MetahandleSet all_handles; |
| 234 { | 234 { |
| 235 dir()->SetDownloadProgress(BOOKMARKS, BuildProgress(BOOKMARKS)); |
| 236 dir()->SetDownloadProgress(PREFERENCES, BuildProgress(PREFERENCES)); |
| 235 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); | 237 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); |
| 236 for (int i = 0; i < metas_to_create; i++) { | 238 for (int i = 0; i < metas_to_create; i++) { |
| 237 MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), "foo"); | 239 MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), "foo"); |
| 238 e.PutIsUnsynced(true); | 240 e.PutIsUnsynced(true); |
| 239 sync_pb::EntitySpecifics specs; | 241 sync_pb::EntitySpecifics specs; |
| 240 if (i % 2 == 0) { | 242 if (i % 2 == 0) { |
| 241 AddDefaultFieldValue(BOOKMARKS, &specs); | 243 AddDefaultFieldValue(BOOKMARKS, &specs); |
| 242 expected_purges.insert(e.GetMetahandle()); | 244 expected_purges.insert(e.GetMetahandle()); |
| 243 all_handles.insert(e.GetMetahandle()); | 245 all_handles.insert(e.GetMetahandle()); |
| 244 } else { | 246 } else { |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 // Delete the second entry, reload the Directory, see that the attachment is | 1716 // Delete the second entry, reload the Directory, see that the attachment is |
| 1715 // no loner linked. | 1717 // no loner linked. |
| 1716 DeleteEntry(id2); | 1718 DeleteEntry(id2); |
| 1717 SimulateSaveAndReloadDir(); | 1719 SimulateSaveAndReloadDir(); |
| 1718 ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto)); | 1720 ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto)); |
| 1719 } | 1721 } |
| 1720 | 1722 |
| 1721 } // namespace syncable | 1723 } // namespace syncable |
| 1722 | 1724 |
| 1723 } // namespace syncer | 1725 } // namespace syncer |
| OLD | NEW |