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

Unified Diff: components/sync/driver/non_ui_data_type_controller_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/non_ui_data_type_controller_unittest.cc
diff --git a/components/sync_driver/non_ui_data_type_controller_unittest.cc b/components/sync/driver/non_ui_data_type_controller_unittest.cc
similarity index 89%
rename from components/sync_driver/non_ui_data_type_controller_unittest.cc
rename to components/sync/driver/non_ui_data_type_controller_unittest.cc
index e041f3299d09825e6af97bbf07a4d010aff49e90..f7ab1d506d54f46a7139672d6e0f85b4e97adef8 100644
--- a/components/sync_driver/non_ui_data_type_controller_unittest.cc
+++ b/components/sync/driver/non_ui_data_type_controller_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/non_ui_data_type_controller.h"
+#include "components/sync/driver/non_ui_data_type_controller.h"
#include <memory>
#include <vector>
@@ -22,11 +22,11 @@
#include "base/tracked_objects.h"
#include "components/sync/api/fake_syncable_service.h"
#include "components/sync/api/sync_change.h"
+#include "components/sync/driver/data_type_controller_mock.h"
+#include "components/sync/driver/fake_sync_client.h"
+#include "components/sync/driver/generic_change_processor_factory.h"
+#include "components/sync/driver/non_ui_data_type_controller_mock.h"
#include "components/sync/engine/model_safe_worker.h"
-#include "components/sync_driver/data_type_controller_mock.h"
-#include "components/sync_driver/fake_sync_client.h"
-#include "components/sync_driver/generic_change_processor_factory.h"
-#include "components/sync_driver/non_ui_data_type_controller_mock.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -80,27 +80,25 @@ class SharedChangeProcessorMock : public SharedChangeProcessor {
MOCK_METHOD0(Disconnect, bool());
MOCK_METHOD2(ProcessSyncChanges,
syncer::SyncError(const tracked_objects::Location&,
- const syncer::SyncChangeList&));
+ const syncer::SyncChangeList&));
MOCK_CONST_METHOD2(GetAllSyncDataReturnError,
syncer::SyncError(syncer::ModelType,
syncer::SyncDataList*));
MOCK_METHOD0(GetSyncCount, int());
- MOCK_METHOD1(SyncModelHasUserCreatedNodes,
- bool(bool*));
+ MOCK_METHOD1(SyncModelHasUserCreatedNodes, bool(bool*));
MOCK_METHOD0(CryptoReadyIfNecessary, bool());
MOCK_CONST_METHOD1(GetDataTypeContext, bool(std::string*));
protected:
virtual ~SharedChangeProcessorMock() {}
- MOCK_METHOD2(OnUnrecoverableError, void(const tracked_objects::Location&,
- const std::string&));
+ MOCK_METHOD2(OnUnrecoverableError,
+ void(const tracked_objects::Location&, const std::string&));
private:
DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessorMock);
};
-class NonUIDataTypeControllerFake
- : public NonUIDataTypeController {
+class NonUIDataTypeControllerFake : public NonUIDataTypeController {
public:
NonUIDataTypeControllerFake(
SyncClient* sync_client,
@@ -122,9 +120,7 @@ class NonUIDataTypeControllerFake
// Prevent tasks from being posted on the backend thread until
// UnblockBackendTasks() is called.
- void BlockBackendTasks() {
- blocked_ = true;
- }
+ void BlockBackendTasks() { blocked_ = true; }
// Post pending tasks on the backend thread and start allowing tasks
// to be posted on the backend thread again.
@@ -187,8 +183,7 @@ class NonUIDataTypeControllerFake
class SyncNonUIDataTypeControllerTest : public testing::Test,
public FakeSyncClient {
public:
- SyncNonUIDataTypeControllerTest()
- : backend_thread_("dbthread") {}
+ SyncNonUIDataTypeControllerTest() : backend_thread_("dbthread") {}
void SetUp() override {
backend_thread_.Start();
@@ -256,17 +251,13 @@ class SyncNonUIDataTypeControllerTest : public testing::Test,
}
void Start() {
- non_ui_dtc_->LoadModels(
- base::Bind(&ModelLoadCallbackMock::Run,
- base::Unretained(&model_load_callback_)));
- non_ui_dtc_->StartAssociating(
- base::Bind(&StartCallbackMock::Run,
- base::Unretained(&start_callback_)));
+ non_ui_dtc_->LoadModels(base::Bind(
+ &ModelLoadCallbackMock::Run, base::Unretained(&model_load_callback_)));
+ non_ui_dtc_->StartAssociating(base::Bind(
+ &StartCallbackMock::Run, base::Unretained(&start_callback_)));
}
- static void SignalDone(WaitableEvent* done) {
- done->Signal();
- }
+ static void SignalDone(WaitableEvent* done) { done->Signal(); }
base::MessageLoopForUI message_loop_;
base::Thread backend_thread_;
@@ -315,9 +306,8 @@ TEST_F(SyncNonUIDataTypeControllerTest, AbortDuringStartModels) {
EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(false));
EXPECT_CALL(*dtc_mock_.get(), StopModels());
EXPECT_EQ(DataTypeController::NOT_RUNNING, non_ui_dtc_->state());
- non_ui_dtc_->LoadModels(
- base::Bind(&ModelLoadCallbackMock::Run,
- base::Unretained(&model_load_callback_)));
+ non_ui_dtc_->LoadModels(base::Bind(&ModelLoadCallbackMock::Run,
+ base::Unretained(&model_load_callback_)));
WaitForDTC();
EXPECT_EQ(DataTypeController::MODEL_STARTING, non_ui_dtc_->state());
non_ui_dtc_->Stop();
@@ -342,10 +332,8 @@ TEST_F(SyncNonUIDataTypeControllerTest, StartAssociationFailed) {
// Set up association to fail with an association failed error.
EXPECT_EQ(DataTypeController::NOT_RUNNING, non_ui_dtc_->state());
syncable_service_.set_merge_data_and_start_syncing_error(
- syncer::SyncError(FROM_HERE,
- syncer::SyncError::DATATYPE_ERROR,
- "Sync Error",
- non_ui_dtc_->type()));
+ syncer::SyncError(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
+ "Sync Error", non_ui_dtc_->type()));
Start();
WaitForDTC();
EXPECT_EQ(DataTypeController::DISABLED, non_ui_dtc_->state());
@@ -370,8 +358,7 @@ TEST_F(SyncNonUIDataTypeControllerTest,
EXPECT_EQ(DataTypeController::NOT_RUNNING, non_ui_dtc_->state());
}
-TEST_F(SyncNonUIDataTypeControllerTest,
- StartAssociationCryptoNotReady) {
+TEST_F(SyncNonUIDataTypeControllerTest, StartAssociationCryptoNotReady) {
SetStartExpectations();
SetStartFailExpectations(DataTypeController::NEEDS_CRYPTO);
// Set up association to fail with a NEEDS_CRYPTO error.
@@ -403,14 +390,11 @@ TEST_F(SyncNonUIDataTypeControllerTest, AbortDuringAssociation) {
EXPECT_CALL(*change_processor_.get(), SyncModelHasUserCreatedNodes(_))
.WillOnce(DoAll(SignalEvent(&wait_for_db_thread_pause),
WaitOnEvent(&pause_db_thread),
- SetArgumentPointee<0>(true),
- Return(true)));
+ SetArgumentPointee<0>(true), Return(true)));
EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_, _))
.WillOnce(
- Return(syncer::SyncError(FROM_HERE,
- syncer::SyncError::DATATYPE_ERROR,
- "Disconnected.",
- AUTOFILL_PROFILE)));
+ Return(syncer::SyncError(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
+ "Disconnected.", AUTOFILL_PROFILE)));
EXPECT_CALL(*dtc_mock_.get(), StopModels());
EXPECT_CALL(*change_processor_.get(), Disconnect())
.WillOnce(DoAll(SignalEvent(&pause_db_thread), Return(true)));
@@ -495,9 +479,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, OnSingleDataTypeUnrecoverableError) {
testing::Mock::VerifyAndClearExpectations(&start_callback_);
EXPECT_CALL(model_load_callback_, Run(_, _));
- syncer::SyncError error(FROM_HERE,
- syncer::SyncError::DATATYPE_ERROR,
- "error",
+ syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, "error",
non_ui_dtc_->type());
backend_thread_.task_runner()->PostTask(
FROM_HERE,
« no previous file with comments | « components/sync/driver/non_ui_data_type_controller_mock.cc ('k') | components/sync/driver/non_ui_model_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698