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

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

Issue 6357018: [SYNC] Tests to catch datatype manager behavior when datatype controller is b... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
===================================================================
--- chrome/browser/sync/glue/data_type_manager_impl_unittest.cc (revision 72487)
+++ chrome/browser/sync/glue/data_type_manager_impl_unittest.cc (working copy)
@@ -97,6 +97,20 @@
WillRepeatedly(Return(DataTypeController::NOT_RUNNING));
}
+ void SetBusyStartStopExpectations(DataTypeControllerMock* mock_dtc,
+ DataTypeController::State busy_state) {
+ InSequence seq;
+ EXPECT_CALL(*mock_dtc, state()).
+ WillRepeatedly(Return(DataTypeController::NOT_RUNNING));
+ EXPECT_CALL(*mock_dtc, Start(_)).
+ WillOnce(InvokeCallback((DataTypeController::OK)));
+ EXPECT_CALL(*mock_dtc, state()).
+ WillRepeatedly(Return(busy_state));
+ EXPECT_CALL(*mock_dtc, Stop()).Times(1);
+ EXPECT_CALL(*mock_dtc, state()).
+ WillRepeatedly(Return(DataTypeController::NOT_RUNNING));
+ }
+
void SetNotUsedExpectations(DataTypeControllerMock* mock_dtc) {
EXPECT_CALL(*mock_dtc, Start(_)).Times(0);
EXPECT_CALL(*mock_dtc, Stop()).Times(0);
@@ -160,6 +174,37 @@
EXPECT_EQ(DataTypeManager::STOPPED, dtm.state());
}
+TEST_F(DataTypeManagerImplTest, ConfigureOneStopWhileStarting) {
+ DataTypeControllerMock* bookmark_dtc = MakeBookmarkDTC();
+ SetBusyStartStopExpectations(bookmark_dtc,
+ DataTypeController::MODEL_STARTING);
+ controllers_[syncable::BOOKMARKS] = bookmark_dtc;
+ SetBackendExpectations(1);
+ DataTypeManagerImpl dtm(&backend_, controllers_);
+ types_.insert(syncable::BOOKMARKS);
+ SetConfigureStartExpectation();
+ SetConfigureDoneExpectation(DataTypeManager::OK);
+ dtm.Configure(types_);
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm.state());
+ dtm.Stop();
+ EXPECT_EQ(DataTypeManager::STOPPED, dtm.state());
+}
+
+TEST_F(DataTypeManagerImplTest, ConfigureOneStopWhileAssociating) {
+ DataTypeControllerMock* bookmark_dtc = MakeBookmarkDTC();
+ SetBusyStartStopExpectations(bookmark_dtc, DataTypeController::ASSOCIATING);
+ controllers_[syncable::BOOKMARKS] = bookmark_dtc;
+ SetBackendExpectations(1);
+ DataTypeManagerImpl dtm(&backend_, controllers_);
+ types_.insert(syncable::BOOKMARKS);
+ SetConfigureStartExpectation();
+ SetConfigureDoneExpectation(DataTypeManager::OK);
+ dtm.Configure(types_);
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm.state());
+ dtm.Stop();
+ EXPECT_EQ(DataTypeManager::STOPPED, dtm.state());
+}
+
TEST_F(DataTypeManagerImplTest, OneWaitingForCrypto) {
DataTypeControllerMock* password_dtc = MakePasswordDTC();
EXPECT_CALL(*password_dtc, state()).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698