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

Unified Diff: chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copy paste :( Created 9 years, 8 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: chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc
index c0c229038d81551fb31ce24c1080feb50e8d0aea..ee3f42f0d6448c70a6358e1cee0c48552850be31 100644
--- a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc
@@ -63,8 +63,8 @@ class FrontendDataTypeControllerFake : public FrontendDataTypeController {
virtual bool StartModels() {
return mock_->StartModels();
}
- virtual void CleanupState() {
- mock_->CleanupState();
+ virtual void CleanUpState() {
+ mock_->CleanUpState();
}
virtual void RecordUnrecoverableError(
const tracked_objects::Location& from_here,
@@ -122,13 +122,13 @@ class FrontendDataTypeControllerTest : public testing::Test {
}
void SetStopExpectations() {
- EXPECT_CALL(*dtc_mock_, CleanupState());
+ EXPECT_CALL(*dtc_mock_, CleanUpState());
EXPECT_CALL(service_, DeactivateDataType(_, _));
EXPECT_CALL(*model_associator_, DisassociateModels());
}
void SetStartFailExpectations(DataTypeController::StartResult result) {
- EXPECT_CALL(*dtc_mock_, CleanupState());
+ EXPECT_CALL(*dtc_mock_, CleanUpState());
EXPECT_CALL(*dtc_mock_, RecordStartFailure(result));
EXPECT_CALL(start_callback_, Run(result,_));
}
@@ -169,6 +169,16 @@ TEST_F(FrontendDataTypeControllerTest, StartFirstRun) {
EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
}
+TEST_F(FrontendDataTypeControllerTest, AbortDuringStartModels) {
+ EXPECT_CALL(*dtc_mock_, StartModels()).WillOnce(Return(false));
+ SetStartFailExpectations(DataTypeController::ABORTED);
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
+ frontend_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run));
+ EXPECT_EQ(DataTypeController::MODEL_STARTING, frontend_dtc_->state());
+ frontend_dtc_->Stop();
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
+}
+
TEST_F(FrontendDataTypeControllerTest, StartAssociationFailed) {
SetStartExpectations();
EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()).
@@ -215,7 +225,6 @@ TEST_F(FrontendDataTypeControllerTest, Stop) {
SetAssociateExpectations();
SetActivateExpectations(DataTypeController::OK);
SetStopExpectations();
-
EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
frontend_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run));
EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
@@ -232,7 +241,6 @@ TEST_F(FrontendDataTypeControllerTest, OnUnrecoverableError) {
WillOnce(InvokeWithoutArgs(frontend_dtc_.get(),
&FrontendDataTypeController::Stop));
SetStopExpectations();
-
EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
frontend_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run));
EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());

Powered by Google App Engine
This is Rietveld 408576698