Commit 811be83c authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Delete some outdated syncer unit tests

This patch deletes a bunch of semi-related tests that are no longer
interesting because they only exercise the legacy codepath, and the
concepts being tested no longer exist in core sync machinery or at all.
Roughly, the deleted tests are about:
1. Naming-related requirements: outdated long ago, no longer relevant.
2. Hierarchy-related: now specific to bookmarks, have decent coverage
   under components/sync_bookmarks.
3. Local conflict-resolution: no longer implemented within the sync
   engine and a core responsibility of ModelTypeProcessor
   implementations, e.g. tested in ClientTagBasedModelTypeProcessorTest.

Change-Id: If8572374bff2ebd27e0c6798f79dcb7273d07883
Bug: 923287
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2257327Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781317}
parent c98dba7e
......@@ -13,6 +13,7 @@
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/model/conflict_resolution.h"
#include "components/sync/model/mock_model_type_change_processor.h"
#include "components/sync/model/model_error.h"
#include "components/sync/model/model_type_store_test_util.h"
......@@ -31,6 +32,7 @@ namespace {
using testing::_;
using testing::ElementsAre;
using testing::Eq;
using testing::Invoke;
using testing::IsEmpty;
using testing::NotNull;
......@@ -96,14 +98,14 @@ class SyncableServiceBasedBridgeTest : public ::testing::Test {
~SyncableServiceBasedBridgeTest() override {}
void InitializeBridge() {
void InitializeBridge(ModelType model_type = kModelType) {
real_processor_ =
std::make_unique<syncer::ClientTagBasedModelTypeProcessor>(
kModelType, /*dump_stack=*/base::DoNothing(),
model_type, /*dump_stack=*/base::DoNothing(),
/*commit_only=*/false);
mock_processor_.DelegateCallsByDefaultTo(real_processor_.get());
bridge_ = std::make_unique<SyncableServiceBasedBridge>(
kModelType,
model_type,
ModelTypeStoreTestUtil::FactoryForForwardingStore(store_.get()),
mock_processor_.CreateForwardingProcessor(), &syncable_service_);
}
......@@ -589,5 +591,56 @@ TEST(SyncableServiceBasedBridgeLocalChangeProcessorTest,
EXPECT_EQ(1U, in_memory_store.count(kClientTagHash));
}
TEST_F(SyncableServiceBasedBridgeTest, ConflictShouldUseRemote) {
InitializeBridge();
EntityData remote_data;
remote_data.client_tag_hash = kClientTagHash;
remote_data.specifics = GetTestSpecifics();
ASSERT_FALSE(remote_data.is_deleted());
EXPECT_THAT(bridge_->ResolveConflict("storagekey1", remote_data),
Eq(ConflictResolution::kUseRemote));
}
TEST_F(SyncableServiceBasedBridgeTest,
ConflictWithRemoteDeletionShouldUseLocal) {
InitializeBridge();
EntityData remote_data;
remote_data.client_tag_hash = kClientTagHash;
ASSERT_TRUE(remote_data.is_deleted());
EXPECT_THAT(bridge_->ResolveConflict("storagekey1", remote_data),
Eq(ConflictResolution::kUseLocal));
}
// This ensures that for extensions, the conflict is resolved in favor of the
// server, to prevent extensions from being reinstalled after uninstall.
TEST_F(SyncableServiceBasedBridgeTest,
ConflictWithRemoteExtensionUninstallShouldUseRemote) {
InitializeBridge(EXTENSIONS);
EntityData remote_data;
remote_data.client_tag_hash = kClientTagHash;
ASSERT_TRUE(remote_data.is_deleted());
EXPECT_THAT(bridge_->ResolveConflict("storagekey1", remote_data),
Eq(ConflictResolution::kUseRemote));
}
// Same as above but for APPS.
TEST_F(SyncableServiceBasedBridgeTest,
ConflictWithRemoteAppUninstallShouldUseRemote) {
InitializeBridge(APPS);
EntityData remote_data;
remote_data.client_tag_hash = kClientTagHash;
ASSERT_TRUE(remote_data.is_deleted());
EXPECT_THAT(bridge_->ResolveConflict("storagekey1", remote_data),
Eq(ConflictResolution::kUseRemote));
}
} // namespace
} // namespace syncer
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment