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

Unified Diff: components/sync/syncable/directory_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/syncable/directory_unittest.h ('k') | components/sync/syncable/entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/directory_unittest.cc
diff --git a/sync/syncable/directory_unittest.cc b/components/sync/syncable/directory_unittest.cc
similarity index 96%
rename from sync/syncable/directory_unittest.cc
rename to components/sync/syncable/directory_unittest.cc
index b89bda498406e4095b1f10f3a4bbe2ceb4980f05..dc582a65d63a6b69a7b82a889a80a8b32ea456fa 100644
--- a/sync/syncable/directory_unittest.cc
+++ b/components/sync/syncable/directory_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/syncable/directory_unittest.h"
+#include "components/sync/syncable/directory_unittest.h"
#include <stddef.h>
#include <stdint.h>
@@ -14,13 +14,13 @@
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/values_test_util.h"
-#include "sync/internal_api/public/base/attachment_id_proto.h"
-#include "sync/syncable/syncable_proto_util.h"
-#include "sync/syncable/syncable_util.h"
-#include "sync/syncable/syncable_write_transaction.h"
-#include "sync/test/engine/test_syncable_utils.h"
-#include "sync/test/test_directory_backing_store.h"
-#include "sync/util/mock_unrecoverable_error_handler.h"
+#include "components/sync/base/attachment_id_proto.h"
+#include "components/sync/base/mock_unrecoverable_error_handler.h"
+#include "components/sync/syncable/syncable_proto_util.h"
+#include "components/sync/syncable/syncable_util.h"
+#include "components/sync/syncable/syncable_write_transaction.h"
+#include "components/sync/test/engine/test_syncable_utils.h"
+#include "components/sync/test/test_directory_backing_store.h"
using base::ExpectDictBooleanValue;
using base::ExpectDictStringValue;
@@ -60,11 +60,9 @@ void ExpectDataFromBookmarkFaviconEquals(BaseTransaction* trans,
const char SyncableDirectoryTest::kDirectoryName[] = "Foo";
-SyncableDirectoryTest::SyncableDirectoryTest() {
-}
+SyncableDirectoryTest::SyncableDirectoryTest() {}
-SyncableDirectoryTest::~SyncableDirectoryTest() {
-}
+SyncableDirectoryTest::~SyncableDirectoryTest() {}
void SyncableDirectoryTest::SetUp() {
ASSERT_TRUE(connection_.OpenInMemory());
@@ -111,8 +109,8 @@ void SyncableDirectoryTest::CreateEntry(const ModelType& model_type,
void SyncableDirectoryTest::CreateEntry(const ModelType& model_type,
const std::string& entryname,
const Id& id) {
- CreateEntryWithAttachmentMetadata(
- model_type, entryname, id, sync_pb::AttachmentMetadata());
+ CreateEntryWithAttachmentMetadata(model_type, entryname, id,
+ sync_pb::AttachmentMetadata());
}
void SyncableDirectoryTest::CreateEntryWithAttachmentMetadata(
@@ -212,7 +210,6 @@ Encryptor* SyncableDirectoryTest::encryptor() {
return &encryptor_;
}
-
TestUnrecoverableErrorHandler*
SyncableDirectoryTest::unrecoverable_error_handler() {
return &handler_;
@@ -298,8 +295,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest) {
// entries are marked dirty.
ASSERT_EQ(expected_dirty_metahandles.size(), snapshot.dirty_metas.size());
for (EntryKernelSet::const_iterator i = snapshot.dirty_metas.begin();
- i != snapshot.dirty_metas.end();
- ++i) {
+ i != snapshot.dirty_metas.end(); ++i) {
ASSERT_TRUE((*i)->is_dirty());
}
dir()->VacuumAfterSaveChanges(snapshot);
@@ -333,8 +329,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest) {
// entries are marked dirty.
EXPECT_EQ(expected_dirty_metahandles.size(), snapshot.dirty_metas.size());
for (EntryKernelSet::const_iterator i = snapshot.dirty_metas.begin();
- i != snapshot.dirty_metas.end();
- ++i) {
+ i != snapshot.dirty_metas.end(); ++i) {
EXPECT_TRUE((*i)->is_dirty());
}
dir()->VacuumAfterSaveChanges(snapshot);
@@ -424,8 +419,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest) {
// entries are marked dirty.
EXPECT_EQ(number_changed, snapshot.dirty_metas.size());
for (EntryKernelSet::const_iterator i = snapshot.dirty_metas.begin();
- i != snapshot.dirty_metas.end();
- ++i) {
+ i != snapshot.dirty_metas.end(); ++i) {
EXPECT_TRUE((*i)->is_dirty());
}
dir()->VacuumAfterSaveChanges(snapshot);
@@ -1063,8 +1057,8 @@ TEST_F(SyncableDirectoryTest, GetModelType) {
// It's critical that deletion records retain their datatype, so that
// they can be dispatched to the appropriate change processor.
- MutableEntry deleted_item(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "Deleted Item");
+ MutableEntry deleted_item(&trans, CREATE, BOOKMARKS, trans.root_id(),
+ "Deleted Item");
ASSERT_TRUE(item.good());
deleted_item.PutId(id_factory.NewServerId());
deleted_item.PutSpecifics(specifics);
@@ -1073,8 +1067,8 @@ TEST_F(SyncableDirectoryTest, GetModelType) {
deleted_item.PutIsDel(true);
ASSERT_EQ(datatype, deleted_item.GetModelType());
- MutableEntry server_folder(
- &trans, CREATE_NEW_UPDATE_ITEM, id_factory.NewServerId());
+ MutableEntry server_folder(&trans, CREATE_NEW_UPDATE_ITEM,
+ id_factory.NewServerId());
ASSERT_TRUE(server_folder.good());
server_folder.PutServerSpecifics(specifics);
server_folder.PutBaseVersion(1);
@@ -1082,8 +1076,8 @@ TEST_F(SyncableDirectoryTest, GetModelType) {
server_folder.PutServerIsDel(false);
ASSERT_EQ(datatype, server_folder.GetServerModelType());
- MutableEntry server_item(
- &trans, CREATE_NEW_UPDATE_ITEM, id_factory.NewServerId());
+ MutableEntry server_item(&trans, CREATE_NEW_UPDATE_ITEM,
+ id_factory.NewServerId());
ASSERT_TRUE(server_item.good());
server_item.PutServerSpecifics(specifics);
server_item.PutBaseVersion(1);
@@ -1300,8 +1294,8 @@ TEST_F(SyncableDirectoryTest, OldClientLeftUnsyncedDeletedLocalItem) {
WriteTransaction trans(FROM_HERE, UNITTEST, dir().get());
// Create an uncommitted tombstone entry.
- MutableEntry server_knows(
- &trans, CREATE, BOOKMARKS, id_factory.root(), "server_knows");
+ MutableEntry server_knows(&trans, CREATE, BOOKMARKS, id_factory.root(),
+ "server_knows");
server_knows.PutId(server_knows_id);
server_knows.PutIsUnsynced(true);
server_knows.PutIsDel(true);
@@ -1309,8 +1303,8 @@ TEST_F(SyncableDirectoryTest, OldClientLeftUnsyncedDeletedLocalItem) {
server_knows.PutServerVersion(4);
// Create a valid update entry.
- MutableEntry not_is_del(
- &trans, CREATE, BOOKMARKS, id_factory.root(), "not_is_del");
+ MutableEntry not_is_del(&trans, CREATE, BOOKMARKS, id_factory.root(),
+ "not_is_del");
not_is_del.PutId(not_is_del_id);
not_is_del.PutIsDel(false);
not_is_del.PutIsUnsynced(true);
@@ -1405,8 +1399,8 @@ TEST_F(SyncableDirectoryTest, BadPositionCountsAsCorruption) {
// a server update, then update its local specifics without updating its
// local unique position.
- MutableEntry child(
- &trans, CREATE_NEW_UPDATE_ITEM, id_factory.MakeServer("child"));
+ MutableEntry child(&trans, CREATE_NEW_UPDATE_ITEM,
+ id_factory.MakeServer("child"));
sync_pb::EntitySpecifics specifics;
AddDefaultFieldValue(BOOKMARKS, &specifics);
child.PutIsUnappliedUpdate(true);
@@ -1703,8 +1697,8 @@ TEST_F(SyncableDirectoryTest, StressTransactions) {
for (int i = 0; i < kThreadCount; ++i) {
thread_delegates[i].reset(new StressTransactionsDelegate(dir().get(), i));
- ASSERT_TRUE(base::PlatformThread::Create(
- 0, thread_delegates[i].get(), &threads[i]));
+ ASSERT_TRUE(base::PlatformThread::Create(0, thread_delegates[i].get(),
+ &threads[i]));
}
for (int i = 0; i < kThreadCount; ++i) {
@@ -1726,23 +1720,23 @@ TEST_F(SyncableDirectoryTest, MutableEntry_PutAttachmentMetadata) {
// Create an entry with attachment metadata and see that the attachment id
// is not linked.
- MutableEntry entry(
- &trans, CREATE, PREFERENCES, trans.root_id(), "some entry");
+ MutableEntry entry(&trans, CREATE, PREFERENCES, trans.root_id(),
+ "some entry");
entry.PutId(TestIdFactory::FromNumber(-1));
entry.PutIsUnsynced(true);
Directory::Metahandles metahandles;
ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto));
- dir()->GetMetahandlesByAttachmentId(
- &trans, attachment_id_proto, &metahandles);
+ dir()->GetMetahandlesByAttachmentId(&trans, attachment_id_proto,
+ &metahandles);
ASSERT_TRUE(metahandles.empty());
// Now add the attachment metadata and see that Directory believes it is
// linked.
entry.PutAttachmentMetadata(attachment_metadata);
ASSERT_TRUE(dir()->IsAttachmentLinked(attachment_id_proto));
- dir()->GetMetahandlesByAttachmentId(
- &trans, attachment_id_proto, &metahandles);
+ dir()->GetMetahandlesByAttachmentId(&trans, attachment_id_proto,
+ &metahandles);
ASSERT_FALSE(metahandles.empty());
ASSERT_EQ(metahandles[0], entry.GetMetahandle());
@@ -1750,8 +1744,8 @@ TEST_F(SyncableDirectoryTest, MutableEntry_PutAttachmentMetadata) {
sync_pb::AttachmentMetadata empty_attachment_metadata;
entry.PutAttachmentMetadata(empty_attachment_metadata);
ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto));
- dir()->GetMetahandlesByAttachmentId(
- &trans, attachment_id_proto, &metahandles);
+ dir()->GetMetahandlesByAttachmentId(&trans, attachment_id_proto,
+ &metahandles);
ASSERT_TRUE(metahandles.empty());
}
ASSERT_FALSE(dir()->IsAttachmentLinked(attachment_id_proto));
@@ -1768,8 +1762,8 @@ TEST_F(SyncableDirectoryTest, MutableEntry_UpdateAttachmentId) {
WriteTransaction trans(FROM_HERE, UNITTEST, dir().get());
- MutableEntry entry(
- &trans, CREATE, PREFERENCES, trans.root_id(), "some entry");
+ MutableEntry entry(&trans, CREATE, PREFERENCES, trans.root_id(),
+ "some entry");
entry.PutId(TestIdFactory::FromNumber(-1));
entry.PutAttachmentMetadata(attachment_metadata);
@@ -1808,8 +1802,8 @@ TEST_F(SyncableDirectoryTest, Directory_DeleteDoesNotUnlinkAttachments) {
// Create an entry with attachment metadata and see that the attachment id
// is linked.
- CreateEntryWithAttachmentMetadata(
- PREFERENCES, "some entry", id, attachment_metadata);
+ CreateEntryWithAttachmentMetadata(PREFERENCES, "some entry", id,
+ attachment_metadata);
ASSERT_TRUE(dir()->IsAttachmentLinked(attachment_id_proto));
// Delete the entry and see that it's still linked because the entry hasn't
@@ -1836,10 +1830,10 @@ TEST_F(SyncableDirectoryTest, Directory_LastReferenceUnlinksAttachments) {
// Create two entries, each referencing the attachment.
const Id id1 = TestIdFactory::FromNumber(-1);
const Id id2 = TestIdFactory::FromNumber(-2);
- CreateEntryWithAttachmentMetadata(
- PREFERENCES, "some entry", id1, attachment_metadata);
- CreateEntryWithAttachmentMetadata(
- PREFERENCES, "some other entry", id2, attachment_metadata);
+ CreateEntryWithAttachmentMetadata(PREFERENCES, "some entry", id1,
+ attachment_metadata);
+ CreateEntryWithAttachmentMetadata(PREFERENCES, "some other entry", id2,
+ attachment_metadata);
// See that the attachment is considered linked.
ASSERT_TRUE(dir()->IsAttachmentLinked(attachment_id_proto));
@@ -1866,10 +1860,10 @@ TEST_F(SyncableDirectoryTest, Directory_GetAttachmentIdsToUpload) {
*record->mutable_id() = attachment_id_proto;
const Id id1 = TestIdFactory::FromNumber(-1);
const Id id2 = TestIdFactory::FromNumber(-2);
- CreateEntryWithAttachmentMetadata(
- PREFERENCES, "some entry", id1, attachment_metadata);
- CreateEntryWithAttachmentMetadata(
- PREFERENCES, "some other entry", id2, attachment_metadata);
+ CreateEntryWithAttachmentMetadata(PREFERENCES, "some entry", id1,
+ attachment_metadata);
+ CreateEntryWithAttachmentMetadata(PREFERENCES, "some other entry", id2,
+ attachment_metadata);
// See that Directory reports that this attachment is not on the server.
AttachmentIdList ids;
« no previous file with comments | « components/sync/syncable/directory_unittest.h ('k') | components/sync/syncable/entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698