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

Unified Diff: components/sync/driver/glue/sync_backend_host_impl_unittest.cc

Issue 2203673002: [Sync] Move //components/sync_driver to //components/sync/driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sd-a
Patch Set: Full change rebased on static lib. Created 4 years, 4 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
Index: components/sync/driver/glue/sync_backend_host_impl_unittest.cc
diff --git a/components/sync_driver/glue/sync_backend_host_impl_unittest.cc b/components/sync/driver/glue/sync_backend_host_impl_unittest.cc
similarity index 86%
rename from components/sync_driver/glue/sync_backend_host_impl_unittest.cc
rename to components/sync/driver/glue/sync_backend_host_impl_unittest.cc
index 106666bc17b6cdeaa4439ef89a5db54f24470139..ec9f8b4a3c08e0c14a8e4d5ab77a1171a843402d 100644
--- a/components/sync_driver/glue/sync_backend_host_impl_unittest.cc
+++ b/components/sync/driver/glue/sync_backend_host_impl_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 "components/sync_driver/glue/sync_backend_host_impl.h"
+#include "components/sync/driver/glue/sync_backend_host_impl.h"
#include <stdint.h>
@@ -31,6 +31,10 @@
#include "components/sync/core/network_resources.h"
#include "components/sync/core/sync_manager_factory.h"
#include "components/sync/core/test/fake_sync_manager.h"
+#include "components/sync/driver/device_info.h"
+#include "components/sync/driver/fake_sync_client.h"
+#include "components/sync/driver/sync_frontend.h"
+#include "components/sync/driver/sync_prefs.h"
#include "components/sync/engine/model_safe_worker.h"
#include "components/sync/engine/passive_model_worker.h"
#include "components/sync/protocol/encryption.pb.h"
@@ -39,10 +43,6 @@
#include "components/sync/sessions/status_counters.h"
#include "components/sync/sessions/update_counters.h"
#include "components/sync/test/callback_counter.h"
-#include "components/sync_driver/device_info.h"
-#include "components/sync_driver/fake_sync_client.h"
-#include "components/sync_driver/sync_frontend.h"
-#include "components/sync_driver/sync_prefs.h"
#include "components/syncable_prefs/pref_service_syncable.h"
#include "components/syncable_prefs/testing_pref_service_syncable.h"
#include "google/cacheinvalidation/include/types.h"
@@ -89,16 +89,14 @@ class MockSyncFrontend : public sync_driver::SyncFrontend {
const std::string&,
bool));
MOCK_METHOD0(OnSyncCycleCompleted, void());
- MOCK_METHOD1(OnConnectionStatusChange,
- void(syncer::ConnectionStatus status));
+ MOCK_METHOD1(OnConnectionStatusChange, void(syncer::ConnectionStatus status));
MOCK_METHOD0(OnClearServerDataSucceeded, void());
MOCK_METHOD0(OnClearServerDataFailed, void());
MOCK_METHOD2(OnPassphraseRequired,
void(syncer::PassphraseRequiredReason,
const sync_pb::EncryptedData&));
MOCK_METHOD0(OnPassphraseAccepted, void());
- MOCK_METHOD2(OnEncryptedTypesChanged,
- void(syncer::ModelTypeSet, bool));
+ MOCK_METHOD2(OnEncryptedTypesChanged, void(syncer::ModelTypeSet, bool));
MOCK_METHOD0(OnEncryptionComplete, void());
MOCK_METHOD1(OnMigrationNeededForTypes, void(syncer::ModelTypeSet));
MOCK_METHOD1(OnProtocolEvent, void(const syncer::ProtocolEvent&));
@@ -108,10 +106,9 @@ class MockSyncFrontend : public sync_driver::SyncFrontend {
void(syncer::ModelType, const syncer::UpdateCounters&));
MOCK_METHOD2(OnDirectoryTypeStatusCounterUpdated,
void(syncer::ModelType, const syncer::StatusCounters&));
- MOCK_METHOD1(OnExperimentsChanged,
- void(const syncer::Experiments&));
+ MOCK_METHOD1(OnExperimentsChanged, void(const syncer::Experiments&));
MOCK_METHOD1(OnActionableError,
- void(const syncer::SyncProtocolError& sync_error));
+ void(const syncer::SyncProtocolError& sync_error));
MOCK_METHOD0(OnSyncConfigureRetry, void());
MOCK_METHOD1(
OnLocalSetPassphraseEncryption,
@@ -121,7 +118,7 @@ class MockSyncFrontend : public sync_driver::SyncFrontend {
class FakeSyncManagerFactory : public syncer::SyncManagerFactory {
public:
explicit FakeSyncManagerFactory(FakeSyncManager** fake_manager)
- : fake_manager_(fake_manager) {
+ : fake_manager_(fake_manager) {
*fake_manager_ = NULL;
}
~FakeSyncManagerFactory() override {}
@@ -129,9 +126,9 @@ class FakeSyncManagerFactory : public syncer::SyncManagerFactory {
// SyncManagerFactory implementation. Called on the sync thread.
std::unique_ptr<SyncManager> CreateSyncManager(
const std::string& /* name */) override {
- *fake_manager_ = new FakeSyncManager(initial_sync_ended_types_,
- progress_marker_types_,
- configure_fail_types_);
+ *fake_manager_ =
+ new FakeSyncManager(initial_sync_ended_types_, progress_marker_types_,
+ configure_fail_types_);
return std::unique_ptr<SyncManager>(*fake_manager_);
}
@@ -170,8 +167,7 @@ class BackendSyncClient : public sync_driver::FakeSyncClient {
class SyncBackendHostTest : public testing::Test {
protected:
- SyncBackendHostTest()
- : fake_manager_(NULL) {}
+ SyncBackendHostTest() : fake_manager_(NULL) {}
~SyncBackendHostTest() override {}
@@ -182,10 +178,8 @@ class SyncBackendHostTest : public testing::Test {
sync_prefs_.reset(new sync_driver::SyncPrefs(&pref_service_));
backend_.reset(new SyncBackendHostImpl(
- "dummyDebugName", &sync_client_,
- base::ThreadTaskRunnerHandle::Get(),
- nullptr,
- sync_prefs_->AsWeakPtr(),
+ "dummyDebugName", &sync_client_, base::ThreadTaskRunnerHandle::Get(),
+ nullptr, sync_prefs_->AsWeakPtr(),
temp_dir_.path().Append(base::FilePath(kTestSyncDir))));
credentials_.account_id = "user@example.com";
credentials_.email = "user@example.com";
@@ -221,13 +215,12 @@ class SyncBackendHostTest : public testing::Test {
// Synchronously initializes the backend.
void InitializeBackend(bool expect_success) {
- EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)).
- WillOnce(InvokeWithoutArgs(QuitMessageLoop));
+ EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success))
+ .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
SyncBackendHost::HttpPostProviderFactoryGetter
http_post_provider_factory_getter =
base::Bind(&syncer::NetworkResources::GetHttpPostProviderFactory,
- base::Unretained(network_resources_.get()),
- nullptr,
+ base::Unretained(network_resources_.get()), nullptr,
base::Bind(&EmptyNetworkTimeUpdate));
backend_->Initialize(
&mock_frontend_, std::unique_ptr<base::Thread>(),
@@ -239,9 +232,8 @@ class SyncBackendHostTest : public testing::Test {
base::Closure(), http_post_provider_factory_getter,
std::move(saved_nigori_state_));
base::RunLoop run_loop;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
- run_loop.QuitClosure(),
- TestTimeouts::action_timeout());
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
run_loop.Run();
// |fake_manager_factory_|'s fake_manager() is set on the sync
// thread, but we can rely on the message loop barriers to
@@ -257,15 +249,14 @@ class SyncBackendHostTest : public testing::Test {
sync_driver::BackendDataTypeConfigurer::DataTypeConfigStateMap
config_state_map;
sync_driver::BackendDataTypeConfigurer::SetDataTypesState(
- sync_driver::BackendDataTypeConfigurer::CONFIGURE_ACTIVE,
- types_to_add,
+ sync_driver::BackendDataTypeConfigurer::CONFIGURE_ACTIVE, types_to_add,
&config_state_map);
sync_driver::BackendDataTypeConfigurer::SetDataTypesState(
- sync_driver::BackendDataTypeConfigurer::DISABLED,
- types_to_remove, &config_state_map);
+ sync_driver::BackendDataTypeConfigurer::DISABLED, types_to_remove,
+ &config_state_map);
sync_driver::BackendDataTypeConfigurer::SetDataTypesState(
- sync_driver::BackendDataTypeConfigurer::UNREADY,
- types_to_unapply, &config_state_map);
+ sync_driver::BackendDataTypeConfigurer::UNREADY, types_to_unapply,
+ &config_state_map);
types_to_add.PutAll(syncer::ControlTypes());
syncer::ModelTypeSet ready_types = backend_->ConfigureDataTypes(
@@ -274,9 +265,8 @@ class SyncBackendHostTest : public testing::Test {
base::Bind(&SyncBackendHostTest::OnDownloadRetry,
base::Unretained(this)));
base::RunLoop run_loop;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
- run_loop.QuitClosure(),
- TestTimeouts::action_timeout());
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
run_loop.Run();
return ready_types;
}
@@ -287,9 +277,7 @@ class SyncBackendHostTest : public testing::Test {
base::MessageLoop::current()->QuitWhenIdle();
}
- void OnDownloadRetry() {
- NOTIMPLEMENTED();
- }
+ void OnDownloadRetry() { NOTIMPLEMENTED(); }
base::MessageLoop message_loop_;
base::ScopedTempDir temp_dir_;
@@ -315,8 +303,9 @@ TEST_F(SyncBackendHostTest, InitShutdown) {
EXPECT_EQ(syncer::ControlTypes(),
fake_manager_->GetAndResetDownloadedTypes());
EXPECT_EQ(syncer::ControlTypes(), fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- syncer::ControlTypes()).Empty());
+ EXPECT_TRUE(fake_manager_
+ ->GetTypesWithEmptyProgressMarkerToken(syncer::ControlTypes())
+ .Empty());
}
// Test first time sync scenario. All types should be properly configured.
@@ -325,8 +314,9 @@ TEST_F(SyncBackendHostTest, FirstTimeSync) {
EXPECT_EQ(syncer::ControlTypes(),
fake_manager_->GetAndResetDownloadedTypes());
EXPECT_EQ(syncer::ControlTypes(), fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- syncer::ControlTypes()).Empty());
+ EXPECT_TRUE(fake_manager_
+ ->GetTypesWithEmptyProgressMarkerToken(syncer::ControlTypes())
+ .Empty());
syncer::ModelTypeSet ready_types = ConfigureDataTypes(
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
@@ -339,8 +329,9 @@ TEST_F(SyncBackendHostTest, FirstTimeSync) {
Difference(enabled_types_, syncer::ControlTypes())));
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Test the restart after setting up sync scenario. No enabled types should be
@@ -352,23 +343,27 @@ TEST_F(SyncBackendHostTest, Restart) {
fake_manager_factory_->set_initial_sync_ended_types(enabled_types_);
InitializeBackend(true);
EXPECT_TRUE(fake_manager_->GetAndResetDownloadedTypes().Empty());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
syncer::ModelTypeSet ready_types = ConfigureDataTypes(
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
syncer::ModelTypeSet());
EXPECT_EQ(enabled_types_, ready_types);
EXPECT_TRUE(fake_manager_->GetAndResetDownloadedTypes().Empty());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Test a sync restart scenario where some types had never finished configuring.
@@ -378,8 +373,7 @@ TEST_F(SyncBackendHostTest, PartialTypes) {
// Set sync manager behavior before passing it down. All types have progress
// markers, but nigori and bookmarks are missing initial sync ended.
syncer::ModelTypeSet partial_types(syncer::NIGORI, syncer::BOOKMARKS);
- syncer::ModelTypeSet full_types =
- Difference(enabled_types_, partial_types);
+ syncer::ModelTypeSet full_types = Difference(enabled_types_, partial_types);
fake_manager_factory_->set_progress_marker_types(enabled_types_);
fake_manager_factory_->set_initial_sync_ended_types(full_types);
@@ -400,13 +394,15 @@ TEST_F(SyncBackendHostTest, PartialTypes) {
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
syncer::ModelTypeSet());
EXPECT_EQ(full_types, ready_types);
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(partial_types, fake_manager_->GetAndResetDownloadedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Test the behavior when we lose the sync db. Although we already have types
@@ -438,12 +434,14 @@ TEST_F(SyncBackendHostTest, LostDB) {
ready_types);
EXPECT_TRUE(fake_manager_->GetAndResetDownloadedTypes().HasAll(
Difference(enabled_types_, syncer::ControlTypes())));
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
TEST_F(SyncBackendHostTest, DisableTypes) {
@@ -458,11 +456,13 @@ TEST_F(SyncBackendHostTest, DisableTypes) {
syncer::ModelTypeSet(syncer::NIGORI)),
ready_types);
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
// Then disable two datatypes.
syncer::ModelTypeSet disabled_types(syncer::BOOKMARKS,
@@ -481,8 +481,9 @@ TEST_F(SyncBackendHostTest, DisableTypes) {
Intersection(fake_manager_->GetAndResetCleanedTypes(), old_types));
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
TEST_F(SyncBackendHostTest, AddTypes) {
@@ -497,15 +498,16 @@ TEST_F(SyncBackendHostTest, AddTypes) {
syncer::ModelTypeSet(syncer::NIGORI)),
ready_types);
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
// Then add two datatypes.
- syncer::ModelTypeSet new_types(syncer::EXTENSIONS,
- syncer::APPS);
+ syncer::ModelTypeSet new_types(syncer::EXTENSIONS, syncer::APPS);
enabled_types_.PutAll(new_types);
ready_types = ConfigureDataTypes(
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
@@ -516,12 +518,14 @@ TEST_F(SyncBackendHostTest, AddTypes) {
new_types.Put(syncer::NIGORI);
EXPECT_EQ(syncer::Difference(enabled_types_, new_types), ready_types);
EXPECT_EQ(new_types, fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// And and disable in the same configuration.
@@ -537,18 +541,19 @@ TEST_F(SyncBackendHostTest, AddDisableTypes) {
syncer::ModelTypeSet(syncer::NIGORI)),
ready_types);
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
// Then add two datatypes.
syncer::ModelTypeSet old_types = enabled_types_;
syncer::ModelTypeSet disabled_types(syncer::BOOKMARKS,
syncer::SEARCH_ENGINES);
- syncer::ModelTypeSet new_types(syncer::EXTENSIONS,
- syncer::APPS);
+ syncer::ModelTypeSet new_types(syncer::EXTENSIONS, syncer::APPS);
enabled_types_.PutAll(new_types);
enabled_types_.RemoveAll(disabled_types);
ready_types = ConfigureDataTypes(
@@ -584,8 +589,8 @@ TEST_F(SyncBackendHostTest, NewlySupportedTypes) {
// Does nothing.
InitializeBackend(true);
EXPECT_TRUE(fake_manager_->GetAndResetDownloadedTypes().Empty());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- old_types).Empty());
+ EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(), old_types)
+ .Empty());
EXPECT_EQ(old_types, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(new_types, fake_manager_->GetTypesWithEmptyProgressMarkerToken(
enabled_types_));
@@ -599,12 +604,14 @@ TEST_F(SyncBackendHostTest, NewlySupportedTypes) {
EXPECT_EQ(syncer::Difference(old_types, syncer::ModelTypeSet(syncer::NIGORI)),
ready_types);
EXPECT_EQ(new_types, fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Test the newly supported types scenario, but with the presence of partial
@@ -616,8 +623,7 @@ TEST_F(SyncBackendHostTest, NewlySupportedTypesWithPartialTypes) {
// markers and initial sync ended except the new types.
syncer::ModelTypeSet old_types = enabled_types_;
syncer::ModelTypeSet partial_types(syncer::NIGORI, syncer::BOOKMARKS);
- syncer::ModelTypeSet full_types =
- Difference(enabled_types_, partial_types);
+ syncer::ModelTypeSet full_types = Difference(enabled_types_, partial_types);
fake_manager_factory_->set_progress_marker_types(old_types);
fake_manager_factory_->set_initial_sync_ended_types(full_types);
syncer::ModelTypeSet new_types(syncer::APP_SETTINGS,
@@ -645,12 +651,14 @@ TEST_F(SyncBackendHostTest, NewlySupportedTypesWithPartialTypes) {
EXPECT_EQ(full_types, ready_types);
EXPECT_EQ(Union(new_types, partial_types),
fake_manager_->GetAndResetDownloadedTypes());
- EXPECT_TRUE(Intersection(fake_manager_->GetAndResetCleanedTypes(),
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ Intersection(fake_manager_->GetAndResetCleanedTypes(), enabled_types_)
+ .Empty());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->GetAndResetEnabledTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Verify that downloading control types only downloads those types that do
@@ -661,8 +669,7 @@ TEST_F(SyncBackendHostTest, DownloadControlTypes) {
// info are new types without progress markers or initial sync ended, while
// all other types have been fully downloaded and applied.
syncer::ModelTypeSet new_types(syncer::EXPERIMENTS, syncer::NIGORI);
- syncer::ModelTypeSet old_types =
- Difference(enabled_types_, new_types);
+ syncer::ModelTypeSet old_types = Difference(enabled_types_, new_types);
fake_manager_factory_->set_progress_marker_types(old_types);
fake_manager_factory_->set_initial_sync_ended_types(old_types);
@@ -673,8 +680,9 @@ TEST_F(SyncBackendHostTest, DownloadControlTypes) {
EXPECT_EQ(Difference(syncer::ModelTypeSet::All(), enabled_types_),
fake_manager_->GetAndResetCleanedTypes());
EXPECT_EQ(enabled_types_, fake_manager_->InitialSyncEndedTypes());
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- enabled_types_).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(enabled_types_)
+ .Empty());
}
// Fail to download control types. It's believed that there is a server bug
@@ -725,8 +733,8 @@ TEST_F(SyncBackendHostTest, DownloadControlTypesRestart) {
// setup hasn't been completed. This test ensures that cleanup happens.
TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) {
const char* nonsense = "slon";
- base::FilePath temp_directory = temp_dir_.path().Append(
- base::FilePath(kTestSyncDir));
+ base::FilePath temp_directory =
+ temp_dir_.path().Append(base::FilePath(kTestSyncDir));
base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3");
ASSERT_TRUE(base::CreateDirectory(temp_directory));
ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense)));
@@ -760,8 +768,8 @@ TEST_F(SyncBackendHostTest, DisableThenPurgeType) {
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
error_types);
EXPECT_EQ(syncer::Difference(enabled_types_, error_types), ready_types);
- EXPECT_TRUE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- error_types).Empty());
+ EXPECT_TRUE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(error_types).Empty());
// Lastly explicitly disable the error types, which should result in a purge.
enabled_types_.RemoveAll(error_types);
@@ -769,8 +777,8 @@ TEST_F(SyncBackendHostTest, DisableThenPurgeType) {
enabled_types_, Difference(syncer::ModelTypeSet::All(), enabled_types_),
syncer::ModelTypeSet());
EXPECT_EQ(syncer::Difference(enabled_types_, error_types), ready_types);
- EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken(
- error_types).Empty());
+ EXPECT_FALSE(
+ fake_manager_->GetTypesWithEmptyProgressMarkerToken(error_types).Empty());
}
// Test that a call to ClearServerData is forwarded to the underlying
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl.cc ('k') | components/sync/driver/glue/sync_backend_host_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698