| Index: sync/engine/syncer_unittest.cc
|
| diff --git a/chrome/browser/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
|
| similarity index 98%
|
| rename from chrome/browser/sync/engine/syncer_unittest.cc
|
| rename to sync/engine/syncer_unittest.cc
|
| index 9e7ea5e920cb5a4a0b11e6ffa105fe8c47365245..9a66d98f248cf441754212d4d72fbe22cd3562ee 100644
|
| --- a/chrome/browser/sync/engine/syncer_unittest.cc
|
| +++ b/sync/engine/syncer_unittest.cc
|
| @@ -23,31 +23,31 @@
|
| #include "base/stringprintf.h"
|
| #include "base/time.h"
|
| #include "build/build_config.h"
|
| -#include "chrome/browser/sync/engine/get_commit_ids_command.h"
|
| -#include "chrome/browser/sync/engine/model_safe_worker.h"
|
| -#include "chrome/browser/sync/engine/net/server_connection_manager.h"
|
| -#include "chrome/browser/sync/engine/nigori_util.h"
|
| -#include "chrome/browser/sync/engine/process_updates_command.h"
|
| -#include "chrome/browser/sync/engine/syncer.h"
|
| -#include "chrome/browser/sync/engine/syncer_proto_util.h"
|
| -#include "chrome/browser/sync/engine/syncer_util.h"
|
| -#include "chrome/browser/sync/engine/syncproto.h"
|
| -#include "chrome/browser/sync/sessions/sync_session_context.h"
|
| -#include "chrome/browser/sync/syncable/model_type.h"
|
| -#include "chrome/browser/sync/syncable/syncable.h"
|
| -#include "chrome/browser/sync/test/engine/fake_model_worker.h"
|
| -#include "chrome/browser/sync/test/engine/mock_connection_manager.h"
|
| -#include "chrome/browser/sync/test/engine/test_directory_setter_upper.h"
|
| -#include "chrome/browser/sync/test/engine/test_id_factory.h"
|
| -#include "chrome/browser/sync/test/engine/test_syncable_utils.h"
|
| -#include "chrome/browser/sync/test/fake_encryptor.h"
|
| -#include "chrome/browser/sync/test/fake_extensions_activity_monitor.h"
|
| -#include "chrome/browser/sync/util/cryptographer.h"
|
| -#include "chrome/browser/sync/util/time.h"
|
| +#include "sync/engine/get_commit_ids_command.h"
|
| +#include "sync/engine/model_safe_worker.h"
|
| +#include "sync/engine/net/server_connection_manager.h"
|
| +#include "sync/engine/nigori_util.h"
|
| +#include "sync/engine/process_updates_command.h"
|
| +#include "sync/engine/syncer.h"
|
| +#include "sync/engine/syncer_proto_util.h"
|
| +#include "sync/engine/syncer_util.h"
|
| +#include "sync/engine/syncproto.h"
|
| #include "sync/protocol/bookmark_specifics.pb.h"
|
| #include "sync/protocol/nigori_specifics.pb.h"
|
| #include "sync/protocol/preference_specifics.pb.h"
|
| #include "sync/protocol/sync.pb.h"
|
| +#include "sync/sessions/sync_session_context.h"
|
| +#include "sync/syncable/model_type.h"
|
| +#include "sync/syncable/syncable.h"
|
| +#include "sync/test/engine/fake_model_worker.h"
|
| +#include "sync/test/engine/mock_connection_manager.h"
|
| +#include "sync/test/engine/test_directory_setter_upper.h"
|
| +#include "sync/test/engine/test_id_factory.h"
|
| +#include "sync/test/engine/test_syncable_utils.h"
|
| +#include "sync/test/fake_encryptor.h"
|
| +#include "sync/test/fake_extensions_activity_monitor.h"
|
| +#include "sync/util/cryptographer.h"
|
| +#include "sync/util/time.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| using base::TimeDelta;
|
| @@ -290,7 +290,12 @@ class SyncerTest : public testing::Test,
|
| syncable::Id parent_id;
|
| EntryFeature features[10];
|
|
|
| - static const CommitOrderingTest LAST_COMMIT_ITEM;
|
| + static CommitOrderingTest MakeLastCommitItem() {
|
| + CommitOrderingTest last_commit_item;
|
| + last_commit_item.commit_index = -1;
|
| + last_commit_item.id = TestIdFactory::root();
|
| + return last_commit_item;
|
| + }
|
| };
|
|
|
| void RunCommitOrderingTest(CommitOrderingTest* test) {
|
| @@ -1164,7 +1169,7 @@ TEST_F(SyncerTest, TestCommitListOrderingTwoItemsTall) {
|
| CommitOrderingTest items[] = {
|
| {1, ids_.FromNumber(-1001), ids_.FromNumber(-1000)},
|
| {0, ids_.FromNumber(-1000), ids_.FromNumber(0)},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1174,7 +1179,7 @@ TEST_F(SyncerTest, TestCommitListOrderingThreeItemsTall) {
|
| {1, ids_.FromNumber(-2001), ids_.FromNumber(-2000)},
|
| {0, ids_.FromNumber(-2000), ids_.FromNumber(0)},
|
| {2, ids_.FromNumber(-2002), ids_.FromNumber(-2001)},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1185,7 +1190,7 @@ TEST_F(SyncerTest, TestCommitListOrderingThreeItemsTallLimitedSize) {
|
| {1, ids_.FromNumber(-2001), ids_.FromNumber(-2000)},
|
| {0, ids_.FromNumber(-2000), ids_.FromNumber(0)},
|
| {2, ids_.FromNumber(-2002), ids_.FromNumber(-2001)},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1193,7 +1198,7 @@ TEST_F(SyncerTest, TestCommitListOrderingThreeItemsTallLimitedSize) {
|
| TEST_F(SyncerTest, TestCommitListOrderingSingleDeletedItem) {
|
| CommitOrderingTest items[] = {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1201,7 +1206,7 @@ TEST_F(SyncerTest, TestCommitListOrderingSingleDeletedItem) {
|
| TEST_F(SyncerTest, TestCommitListOrderingSingleUncommittedDeletedItem) {
|
| CommitOrderingTest items[] = {
|
| {-1, ids_.FromNumber(-1000), ids_.FromNumber(0), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1209,7 +1214,7 @@ TEST_F(SyncerTest, TestCommitListOrderingSingleUncommittedDeletedItem) {
|
| TEST_F(SyncerTest, TestCommitListOrderingSingleDeletedItemWithUnroll) {
|
| CommitOrderingTest items[] = {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1218,7 +1223,7 @@ TEST_F(SyncerTest,
|
| TestCommitListOrderingSingleLongDeletedItemWithUnroll) {
|
| CommitOrderingTest items[] = {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1227,7 +1232,7 @@ TEST_F(SyncerTest, TestCommitListOrderingTwoLongDeletedItemWithUnroll) {
|
| CommitOrderingTest items[] = {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| {-1, ids_.FromNumber(1001), ids_.FromNumber(1000), {DELETED, OLD_MTIME}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1238,7 +1243,7 @@ TEST_F(SyncerTest, TestCommitListOrdering3LongDeletedItemsWithSizeLimit) {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| {1, ids_.FromNumber(1001), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| {2, ids_.FromNumber(1002), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1247,7 +1252,7 @@ TEST_F(SyncerTest, TestCommitListOrderingTwoDeletedItemsWithUnroll) {
|
| CommitOrderingTest items[] = {
|
| {0, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED}},
|
| {-1, ids_.FromNumber(1001), ids_.FromNumber(1000), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1259,7 +1264,7 @@ TEST_F(SyncerTest, TestCommitListOrderingComplexDeletionScenario) {
|
| {1, ids_.FromNumber(1002), ids_.FromNumber(1001), {DELETED, OLD_MTIME}},
|
| {-1, ids_.FromNumber(1003), ids_.FromNumber(1001), {SYNCED}},
|
| {2, ids_.FromNumber(1004), ids_.FromNumber(1003), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1273,7 +1278,7 @@ TEST_F(SyncerTest,
|
| {-1, ids_.FromNumber(1003), ids_.FromNumber(1001), {SYNCED}},
|
| {2, ids_.FromNumber(1004), ids_.FromNumber(1003), {DELETED}},
|
| {3, ids_.FromNumber(1005), ids_.FromNumber(1003), {DELETED}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -1283,7 +1288,7 @@ TEST_F(SyncerTest, TestCommitListOrderingDeleteMovedItems) {
|
| {1, ids_.FromNumber(1000), ids_.FromNumber(0), {DELETED, OLD_MTIME}},
|
| {0, ids_.FromNumber(1001), ids_.FromNumber(1000), {DELETED, OLD_MTIME,
|
| MOVED_FROM_ROOT}},
|
| - CommitOrderingTest::LAST_COMMIT_ITEM,
|
| + CommitOrderingTest::MakeLastCommitItem(),
|
| };
|
| RunCommitOrderingTest(items);
|
| }
|
| @@ -4515,7 +4520,4 @@ TEST_F(SyncerPositionTiebreakingTest, MidLowHigh) {
|
| ExpectLocalOrderIsByServerId();
|
| }
|
|
|
| -const SyncerTest::CommitOrderingTest
|
| -SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
|
| -
|
| } // namespace browser_sync
|
|
|