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

Unified Diff: components/browser_sync/profile_sync_service_startup_unittest.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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/browser_sync/profile_sync_service_startup_unittest.cc
diff --git a/components/browser_sync/profile_sync_service_startup_unittest.cc b/components/browser_sync/profile_sync_service_startup_unittest.cc
index 68944ca021a6b789b33bff9cb6bc2b1c3ff7cd81..7e9d8b9a59fdf6fb9e39c29d84ff7619611b6197 100644
--- a/components/browser_sync/profile_sync_service_startup_unittest.cc
+++ b/components/browser_sync/profile_sync_service_startup_unittest.cc
@@ -33,8 +33,9 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using sync_driver::DataTypeManager;
-using sync_driver::DataTypeManagerMock;
+using syncer::DataTypeManager;
+using syncer::DataTypeManagerMock;
+using syncer::SyncBackendHostMock;
using testing::_;
using testing::AnyNumber;
using testing::DoAll;
@@ -49,7 +50,7 @@ const char kGaiaId[] = "12345";
const char kEmail[] = "test_user@gmail.com";
const char kDummyPassword[] = "";
-class SyncServiceObserverMock : public sync_driver::SyncServiceObserver {
+class SyncServiceObserverMock : public syncer::SyncServiceObserver {
public:
SyncServiceObserverMock();
virtual ~SyncServiceObserverMock();
@@ -70,7 +71,7 @@ ACTION_P(InvokeOnConfigureStart, sync_service) {
ACTION_P3(InvokeOnConfigureDone, sync_service, error_callback, result) {
DataTypeManager::ConfigureResult configure_result =
static_cast<DataTypeManager::ConfigureResult>(result);
- if (result.status == sync_driver::DataTypeManager::ABORTED)
+ if (result.status == syncer::DataTypeManager::ABORTED)
error_callback.Run(&configure_result);
sync_service->OnConfigureDone(configure_result);
}
@@ -97,8 +98,7 @@ class ProfileSyncServiceStartupTest : public testing::Test {
sync_service_.reset(new ProfileSyncService(std::move(init_params)));
sync_service_->RegisterDataTypeController(
- base::MakeUnique<sync_driver::FakeDataTypeController>(
- syncer::BOOKMARKS));
+ base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS));
sync_service_->AddObserver(&observer_);
}
@@ -108,7 +108,7 @@ class ProfileSyncServiceStartupTest : public testing::Test {
}
void SetError(DataTypeManager::ConfigureResult* result) {
- sync_driver::DataTypeStatusTable::TypeErrorMap errors;
+ syncer::DataTypeStatusTable::TypeErrorMap errors;
errors[syncer::BOOKMARKS] =
syncer::SyncError(FROM_HERE, syncer::SyncError::UNRECOVERABLE_ERROR,
"Error", syncer::BOOKMARKS);
@@ -155,8 +155,8 @@ class ProfileSyncServiceStartupTest : public testing::Test {
ProfileSyncServiceBundle profile_sync_service_bundle_;
std::unique_ptr<ProfileSyncService> sync_service_;
SyncServiceObserverMock observer_;
- sync_driver::DataTypeStatusTable data_type_status_table_;
- SyncApiComponentFactoryMock* component_factory_ = nullptr;
+ syncer::DataTypeStatusTable data_type_status_table_;
+ syncer::SyncApiComponentFactoryMock* component_factory_ = nullptr;
};
class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest {
@@ -171,7 +171,7 @@ class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest {
TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
// We've never completed startup.
- pref_service()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete);
+ pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
CreateSyncService(ProfileSyncService::MANUAL_START);
SetUpSyncBackendHost();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
@@ -183,10 +183,9 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
sync_service_->Initialize();
// Preferences should be back to defaults.
- EXPECT_EQ(0,
- pref_service()->GetInt64(sync_driver::prefs::kSyncLastSyncedTime));
+ EXPECT_EQ(0, pref_service()->GetInt64(syncer::prefs::kSyncLastSyncedTime));
EXPECT_FALSE(
- pref_service()->GetBoolean(sync_driver::prefs::kSyncFirstSetupComplete));
+ pref_service()->GetBoolean(syncer::prefs::kSyncFirstSetupComplete));
Mock::VerifyAndClearExpectations(data_type_manager);
// Then start things up.
@@ -213,7 +212,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
// TODO(pavely): Reenable test once android is switched to oauth2.
TEST_F(ProfileSyncServiceStartupTest, DISABLED_StartNoCredentials) {
// We've never completed startup.
- pref_service()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete);
+ pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
CreateSyncService(ProfileSyncService::MANUAL_START);
// Should not actually start, rather just clean things up and wait
@@ -224,10 +223,9 @@ TEST_F(ProfileSyncServiceStartupTest, DISABLED_StartNoCredentials) {
sync_service_->Initialize();
// Preferences should be back to defaults.
- EXPECT_EQ(0,
- pref_service()->GetInt64(sync_driver::prefs::kSyncLastSyncedTime));
+ EXPECT_EQ(0, pref_service()->GetInt64(syncer::prefs::kSyncLastSyncedTime));
EXPECT_FALSE(
- pref_service()->GetBoolean(sync_driver::prefs::kSyncFirstSetupComplete));
+ pref_service()->GetBoolean(syncer::prefs::kSyncFirstSetupComplete));
// Then start things up.
auto sync_blocker = sync_service_->GetSetupInProgressHandle();
@@ -284,7 +282,7 @@ TEST_F(ProfileSyncServiceStartupCrosTest, StartCrosNoCredentials) {
EXPECT_CALL(*component_factory_, CreateDataTypeManager(_, _, _, _, _))
.Times(0);
EXPECT_CALL(*component_factory_, CreateSyncBackendHost(_, _, _, _)).Times(0);
- pref_service()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete);
+ pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
sync_service_->Initialize();
@@ -299,7 +297,7 @@ TEST_F(ProfileSyncServiceStartupCrosTest, StartCrosNoCredentials) {
TEST_F(ProfileSyncServiceStartupCrosTest, StartFirstTime) {
SetUpSyncBackendHost();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
- pref_service()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete);
+ pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
EXPECT_CALL(*data_type_manager, Configure(_, _));
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
@@ -336,12 +334,12 @@ TEST_F(ProfileSyncServiceStartupTest, StartNormal) {
// therefore being left unset.
TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
// Clear the datatype preference fields (simulating bug 154940).
- pref_service()->ClearPref(sync_driver::prefs::kSyncKeepEverythingSynced);
+ pref_service()->ClearPref(syncer::prefs::kSyncKeepEverythingSynced);
syncer::ModelTypeSet user_types = syncer::UserTypes();
for (syncer::ModelTypeSet::Iterator iter = user_types.First(); iter.Good();
iter.Inc()) {
pref_service()->ClearPref(
- sync_driver::SyncPrefs::GetPrefNameForDataType(iter.Get()));
+ syncer::SyncPrefs::GetPrefNameForDataType(iter.Get()));
}
// Pre load the tokens
@@ -359,8 +357,8 @@ TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
IssueTestTokens(account_id);
sync_service_->Initialize();
- EXPECT_TRUE(pref_service()->GetBoolean(
- sync_driver::prefs::kSyncKeepEverythingSynced));
+ EXPECT_TRUE(
+ pref_service()->GetBoolean(syncer::prefs::kSyncKeepEverythingSynced));
}
// Verify that the recovery of datatype preferences doesn't overwrite a valid
@@ -368,8 +366,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) {
// Explicitly set Keep Everything Synced to false and have only bookmarks
// enabled.
- pref_service()->SetBoolean(sync_driver::prefs::kSyncKeepEverythingSynced,
- false);
+ pref_service()->SetBoolean(syncer::prefs::kSyncKeepEverythingSynced, false);
// Pre load the tokens
CreateSyncService(ProfileSyncService::MANUAL_START);
@@ -385,8 +382,8 @@ TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) {
IssueTestTokens(account_id);
sync_service_->Initialize();
- EXPECT_FALSE(pref_service()->GetBoolean(
- sync_driver::prefs::kSyncKeepEverythingSynced));
+ EXPECT_FALSE(
+ pref_service()->GetBoolean(syncer::prefs::kSyncKeepEverythingSynced));
}
TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
@@ -395,7 +392,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
CreateSyncService(ProfileSyncService::MANUAL_START);
// Disable sync through policy.
- pref_service()->SetBoolean(sync_driver::prefs::kSyncManaged, true);
+ pref_service()->SetBoolean(syncer::prefs::kSyncManaged, true);
EXPECT_CALL(*component_factory_, CreateDataTypeManager(_, _, _, _, _))
.Times(0);
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
@@ -423,7 +420,7 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) {
EXPECT_CALL(*data_type_manager, state())
.WillOnce(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- pref_service()->SetBoolean(sync_driver::prefs::kSyncManaged, true);
+ pref_service()->SetBoolean(syncer::prefs::kSyncManaged, true);
EXPECT_FALSE(sync_service_->IsBackendInitialized());
// Note that PSS no longer references |data_type_manager| after stopping.
@@ -433,7 +430,7 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) {
Mock::VerifyAndClearExpectations(data_type_manager);
EXPECT_CALL(*component_factory_, CreateDataTypeManager(_, _, _, _, _))
.Times(0);
- pref_service()->ClearPref(sync_driver::prefs::kSyncManaged);
+ pref_service()->ClearPref(syncer::prefs::kSyncManaged);
EXPECT_FALSE(sync_service_->IsBackendInitialized());
EXPECT_FALSE(sync_service_->IsSyncActive());
}
@@ -469,7 +466,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartDownloadFailed) {
SyncBackendHostMock* mock_sbh = SetUpSyncBackendHost();
mock_sbh->set_fail_initial_download(true);
- pref_service()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete);
+ pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
sync_service_->Initialize();

Powered by Google App Engine
This is Rietveld 408576698