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

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

Issue 394293003: Do not update AttachmentIds after uploading attachments to sync server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « sync/internal_api/write_transaction.cc ('k') | sync/syncable/mutable_entry.h » ('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 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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 entry.PutId(TestIdFactory::FromNumber(-1)); 1642 entry.PutId(TestIdFactory::FromNumber(-1));
1643 entry.PutAttachmentMetadata(attachment_metadata); 1643 entry.PutAttachmentMetadata(attachment_metadata);
1644 1644
1645 const sync_pb::AttachmentMetadata& entry_metadata = 1645 const sync_pb::AttachmentMetadata& entry_metadata =
1646 entry.GetAttachmentMetadata(); 1646 entry.GetAttachmentMetadata();
1647 ASSERT_EQ(2, entry_metadata.record_size()); 1647 ASSERT_EQ(2, entry_metadata.record_size());
1648 ASSERT_FALSE(entry_metadata.record(0).is_on_server()); 1648 ASSERT_FALSE(entry_metadata.record(0).is_on_server());
1649 ASSERT_FALSE(entry_metadata.record(1).is_on_server()); 1649 ASSERT_FALSE(entry_metadata.record(1).is_on_server());
1650 ASSERT_FALSE(entry.GetIsUnsynced()); 1650 ASSERT_FALSE(entry.GetIsUnsynced());
1651 1651
1652 // TODO(pavely): When we add server info to proto, add test for it here. 1652 entry.MarkAttachmentAsOnServer(attachment_id_proto);
1653 entry.UpdateAttachmentIdWithServerInfo(attachment_id_proto);
1654 1653
1655 ASSERT_TRUE(entry_metadata.record(0).is_on_server()); 1654 ASSERT_TRUE(entry_metadata.record(0).is_on_server());
1656 ASSERT_FALSE(entry_metadata.record(1).is_on_server()); 1655 ASSERT_FALSE(entry_metadata.record(1).is_on_server());
1657 ASSERT_TRUE(entry.GetIsUnsynced()); 1656 ASSERT_TRUE(entry.GetIsUnsynced());
1658 } 1657 }
1659 1658
1660 // Verify that deleted entries with attachments will retain the attachments. 1659 // Verify that deleted entries with attachments will retain the attachments.
1661 TEST_F(SyncableDirectoryTest, Directory_DeleteDoesNotUnlinkAttachments) { 1660 TEST_F(SyncableDirectoryTest, Directory_DeleteDoesNotUnlinkAttachments) {
1662 sync_pb::AttachmentMetadata attachment_metadata; 1661 sync_pb::AttachmentMetadata attachment_metadata;
1663 sync_pb::AttachmentMetadataRecord* record = attachment_metadata.add_record(); 1662 sync_pb::AttachmentMetadataRecord* record = attachment_metadata.add_record();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 // Delete the second entry, reload the Directory, see that the attachment is 1713 // Delete the second entry, reload the Directory, see that the attachment is
1715 // no loner linked. 1714 // no loner linked.
1716 DeleteEntry(id2); 1715 DeleteEntry(id2);
1717 SimulateSaveAndReloadDir(); 1716 SimulateSaveAndReloadDir();
1718 ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto)); 1717 ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto));
1719 } 1718 }
1720 1719
1721 } // namespace syncable 1720 } // namespace syncable
1722 1721
1723 } // namespace syncer 1722 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/write_transaction.cc ('k') | sync/syncable/mutable_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698