| Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
|
| diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
|
| index 5ca223434d5449b244c5b3b6d6164bdfd74ed512..76e8ebfc12c462e5069909b4f03645bc5af9908d 100644
|
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
|
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
|
| @@ -345,6 +345,11 @@ class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest {
|
| if (auto_start_arc_test_)
|
| arc_test_.SetUp(profile());
|
|
|
| + // Wait until |extension_system| is signaled as started.
|
| + base::RunLoop run_loop;
|
| + extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure());
|
| + run_loop.Run();
|
| +
|
| app_service_ =
|
| app_list::AppListSyncableServiceFactory::GetForProfile(profile());
|
| StartAppSyncService(syncer::SyncDataList());
|
| @@ -4015,3 +4020,35 @@ TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) {
|
| EXPECT_TRUE(
|
| position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
|
| }
|
| +
|
| +// Test the case when sync app is turned off and we need to use local copy to
|
| +// support user's pins.
|
| +TEST_F(ChromeLauncherControllerImplTest, SyncOffLocalUpdate) {
|
| + InitLauncherController();
|
| +
|
| + extension_service_->AddExtension(extension1_.get());
|
| + extension_service_->AddExtension(extension2_.get());
|
| +
|
| + syncer::SyncChangeList sync_list;
|
| + InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId);
|
| + InsertAddPinChange(&sync_list, 1, extension1_->id());
|
| + InsertAddPinChange(&sync_list, 1, extension2_->id());
|
| + SendPinChanges(sync_list, true);
|
| +
|
| + EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
|
| +
|
| + syncer::SyncDataList copy_sync_list =
|
| + app_service_->GetAllSyncData(syncer::APP_LIST);
|
| +
|
| + app_service_->StopSyncing(syncer::APP_LIST);
|
| + RecreateChromeLauncher();
|
| +
|
| + // Pinned state should not change.
|
| + EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
|
| + launcher_controller_->UnpinAppWithID(extension2_->id());
|
| + EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus());
|
| +
|
| + // Resume syncing and sync information overrides local copy.
|
| + StartAppSyncService(copy_sync_list);
|
| + EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
|
| +}
|
|
|