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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2416133002: Implement local storage for App List in case app sync is off. (Closed)
Patch Set: Created 4 years, 2 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/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 3f2e4bc9e5ce84a0efb1925ae2109400bb203228..a15d538b06aafb0ade75c5d77aa72bcee5369383 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
@@ -2367,7 +2367,7 @@ TEST_F(ChromeLauncherControllerImplTest,
// Removing an item should simply close it and everything should shift.
SendPinChanges(syncer::SyncChangeList(), true);
- EXPECT_EQ("AppList, Chrome, App3, app2", GetPinnedAppStatus());
+ EXPECT_EQ("AppList, Chrome, app2", GetPinnedAppStatus());
}
// Check that a running and not pinned V2 application will be properly converted
@@ -4015,3 +4015,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());
+}

Powered by Google App Engine
This is Rietveld 408576698