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

Unified Diff: components/sync/driver/non_blocking_data_type_controller_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/sync/driver/non_blocking_data_type_controller_unittest.cc
diff --git a/components/sync/driver/non_blocking_data_type_controller_unittest.cc b/components/sync/driver/non_blocking_data_type_controller_unittest.cc
index 011b85ec8401ef280977cb22326f298014b2302f..38c54208e3863462078d27ed6e57a34dd5b2f9ed 100644
--- a/components/sync/driver/non_blocking_data_type_controller_unittest.cc
+++ b/components/sync/driver/non_blocking_data_type_controller_unittest.cc
@@ -22,21 +22,21 @@
#include "components/sync/driver/sync_prefs.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace sync_driver {
+namespace syncer {
class SyncClient;
-} // namespace sync_driver
+} // namespace syncer
-namespace sync_driver_v2 {
+namespace syncer {
namespace {
-syncer::ModelType kTestModelType = syncer::AUTOFILL;
+ModelType kTestModelType = AUTOFILL;
// Implementation of NonBlockingDataTypeController being tested.
// It posts all tasks to current thread.
class TestDataTypeController : public NonBlockingDataTypeController {
public:
- explicit TestDataTypeController(sync_driver::SyncClient* sync_client)
+ explicit TestDataTypeController(SyncClient* sync_client)
: NonBlockingDataTypeController(kTestModelType,
base::Closure(),
sync_client) {}
@@ -51,8 +51,7 @@ class TestDataTypeController : public NonBlockingDataTypeController {
};
// Mock change processor to observe calls to DisableSync.
-class MockModelTypeChangeProcessor
- : public syncer_v2::FakeModelTypeChangeProcessor {
+class MockModelTypeChangeProcessor : public FakeModelTypeChangeProcessor {
public:
explicit MockModelTypeChangeProcessor(int* disable_sync_call_count)
: disable_sync_call_count_(disable_sync_call_count) {}
@@ -80,9 +79,9 @@ class NonBlockingDataTypeControllerTest : public testing::Test {
void TearDown() override { PumpLoop(); }
protected:
- std::unique_ptr<syncer_v2::ModelTypeChangeProcessor> CreateProcessor(
- syncer::ModelType type,
- syncer_v2::ModelTypeService* service) {
+ std::unique_ptr<ModelTypeChangeProcessor> CreateProcessor(
+ ModelType type,
+ ModelTypeService* service) {
auto processor = base::MakeUnique<MockModelTypeChangeProcessor>(
&disable_sync_call_count_);
processor_ = processor.get();
@@ -91,37 +90,34 @@ class NonBlockingDataTypeControllerTest : public testing::Test {
// Gets controller from NOT_RUNNING to RUNNING state.
void ActivateController() {
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING,
- controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
controller_.LoadModels(
base::Bind(&NonBlockingDataTypeControllerTest::LoadModelsDone,
base::Unretained(this)));
- EXPECT_EQ(sync_driver::DataTypeController::MODEL_STARTING,
- controller_.state());
+ EXPECT_EQ(DataTypeController::MODEL_STARTING, controller_.state());
PumpLoop();
- EXPECT_EQ(sync_driver::DataTypeController::MODEL_LOADED,
- controller_.state());
+ EXPECT_EQ(DataTypeController::MODEL_LOADED, controller_.state());
controller_.StartAssociating(
base::Bind(&NonBlockingDataTypeControllerTest::AssociationDone,
base::Unretained(this)));
- EXPECT_EQ(sync_driver::DataTypeController::RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::RUNNING, controller_.state());
}
- void LoadModelsDone(syncer::ModelType type, const syncer::SyncError& error) {}
+ void LoadModelsDone(ModelType type, const SyncError& error) {}
- void AssociationDone(sync_driver::DataTypeController::ConfigureResult result,
- const syncer::SyncMergeResult& local_merge_result,
- const syncer::SyncMergeResult& syncer_merge_result) {}
+ void AssociationDone(DataTypeController::ConfigureResult result,
+ const SyncMergeResult& local_merge_result,
+ const SyncMergeResult& syncer_merge_result) {}
void PumpLoop() { base::RunLoop().RunUntilIdle(); }
int disable_sync_call_count_;
base::MessageLoop message_loop_;
- sync_driver::FakeSyncClient sync_client_;
- sync_driver::SyncPrefs sync_prefs_;
+ FakeSyncClient sync_client_;
+ SyncPrefs sync_prefs_;
MockModelTypeChangeProcessor* processor_;
- syncer_v2::StubModelTypeService model_type_service_;
+ StubModelTypeService model_type_service_;
TestDataTypeController controller_;
};
@@ -136,7 +132,7 @@ TEST_F(NonBlockingDataTypeControllerTest, StopWhenDatatypeEnabled) {
controller_.Stop();
PumpLoop();
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
// Ensure that DisableSync is not called and service still has valid change
// processor.
EXPECT_EQ(0, disable_sync_call_count_);
@@ -153,12 +149,12 @@ TEST_F(NonBlockingDataTypeControllerTest, StopWhenDatatypeDisabled) {
// Disable datatype through preferences.
sync_prefs_.SetKeepEverythingSynced(false);
- sync_prefs_.SetPreferredDataTypes(syncer::ModelTypeSet(kTestModelType),
- syncer::ModelTypeSet());
+ sync_prefs_.SetPreferredDataTypes(ModelTypeSet(kTestModelType),
+ ModelTypeSet());
controller_.Stop();
PumpLoop();
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
// Ensure that DisableSync is called and change processor is reset.
EXPECT_EQ(1, disable_sync_call_count_);
EXPECT_FALSE(model_type_service_.HasChangeProcessor());
@@ -175,7 +171,7 @@ TEST_F(NonBlockingDataTypeControllerTest, StopWithInitialSyncPrefs) {
sync_prefs_.ClearPreferences();
controller_.Stop();
PumpLoop();
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
// Ensure that DisableSync is called and change processor is reset.
EXPECT_EQ(1, disable_sync_call_count_);
EXPECT_FALSE(model_type_service_.HasChangeProcessor());
@@ -187,17 +183,17 @@ TEST_F(NonBlockingDataTypeControllerTest, StopBeforeLoadModels) {
// Enable datatype through preferences.
sync_prefs_.SetFirstSetupComplete();
sync_prefs_.SetKeepEverythingSynced(true);
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
// Clearing preferences emulates signing out.
sync_prefs_.ClearPreferences();
controller_.Stop();
PumpLoop();
- EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_.state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller_.state());
// Ensure that DisableSync is not called.
EXPECT_EQ(0, disable_sync_call_count_);
}
} // namespace
-} // namespace sync_driver_v2
+} // namespace syncer
« no previous file with comments | « components/sync/driver/non_blocking_data_type_controller.cc ('k') | components/sync/driver/non_ui_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698