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

Unified Diff: components/sync_driver/ui_data_type_controller_unittest.cc

Issue 1024223002: [Sync] Split model association into multiple UI tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 years, 9 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 | « components/sync_driver/ui_data_type_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/ui_data_type_controller_unittest.cc
diff --git a/components/sync_driver/ui_data_type_controller_unittest.cc b/components/sync_driver/ui_data_type_controller_unittest.cc
index 0082c166265a174c71727b3f7210f7e4fc55dc2c..f6f2b94ce8708d977a6004837ff7f49a2f619ab7 100644
--- a/components/sync_driver/ui_data_type_controller_unittest.cc
+++ b/components/sync_driver/ui_data_type_controller_unittest.cc
@@ -83,6 +83,7 @@ class SyncUIDataTypeControllerTest : public testing::Test,
preference_dtc_->StartAssociating(
base::Bind(&StartCallbackMock::Run,
base::Unretained(&start_callback_)));
+ PumpLoop();
}
void PumpLoop() {
@@ -126,6 +127,19 @@ TEST_F(SyncUIDataTypeControllerTest, StartStop) {
EXPECT_FALSE(syncable_service_.syncing());
}
+// Start and then stop the DTC before the Start had a chance to perform
+// association. Verify that the service never started and is NOT_RUNNING.
+TEST_F(SyncUIDataTypeControllerTest, StartStopBeforeAssociation) {
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, preference_dtc_->state());
+ EXPECT_FALSE(syncable_service_.syncing());
+ message_loop_.PostTask(FROM_HERE,
+ base::Bind(&UIDataTypeController::Stop,
+ preference_dtc_));
+ Start();
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, preference_dtc_->state());
+ EXPECT_FALSE(syncable_service_.syncing());
+}
+
// Start the DTC when no user nodes are created. Verify that the callback
// is called with OK_FIRST_RUN. Stop the DTC.
TEST_F(SyncUIDataTypeControllerTest, StartStopFirstRun) {
« no previous file with comments | « components/sync_driver/ui_data_type_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698