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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 2349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 // applications are not allowed to be mixed with shortcuts, it should show up 2360 // applications are not allowed to be mixed with shortcuts, it should show up
2361 // at the end of the list. 2361 // at the end of the list.
2362 syncer::SyncChangeList sync_list2; 2362 syncer::SyncChangeList sync_list2;
2363 InsertAddPinChange(&sync_list2, 0, extension3_->id()); 2363 InsertAddPinChange(&sync_list2, 0, extension3_->id());
2364 InsertAddPinChange(&sync_list2, 1, extension1_->id()); 2364 InsertAddPinChange(&sync_list2, 1, extension1_->id());
2365 SendPinChanges(sync_list2, true); 2365 SendPinChanges(sync_list2, true);
2366 EXPECT_EQ("AppList, Chrome, App3, App1, app2", GetPinnedAppStatus()); 2366 EXPECT_EQ("AppList, Chrome, App3, App1, app2", GetPinnedAppStatus());
2367 2367
2368 // Removing an item should simply close it and everything should shift. 2368 // Removing an item should simply close it and everything should shift.
2369 SendPinChanges(syncer::SyncChangeList(), true); 2369 SendPinChanges(syncer::SyncChangeList(), true);
2370 EXPECT_EQ("AppList, Chrome, App3, app2", GetPinnedAppStatus()); 2370 EXPECT_EQ("AppList, Chrome, app2", GetPinnedAppStatus());
2371 } 2371 }
2372 2372
2373 // Check that a running and not pinned V2 application will be properly converted 2373 // Check that a running and not pinned V2 application will be properly converted
2374 // between locked and pinned when the order gets changed through a profile / 2374 // between locked and pinned when the order gets changed through a profile /
2375 // policy change. 2375 // policy change.
2376 TEST_F(ChromeLauncherControllerImplTest, 2376 TEST_F(ChromeLauncherControllerImplTest,
2377 RestoreDefaultAndRunningV2AppsResyncOrder) { 2377 RestoreDefaultAndRunningV2AppsResyncOrder) {
2378 InitLauncherController(); 2378 InitLauncherController();
2379 syncer::SyncChangeList sync_list0; 2379 syncer::SyncChangeList sync_list0;
2380 InsertAddPinChange(&sync_list0, 0, extension1_->id()); 2380 InsertAddPinChange(&sync_list0, 0, extension1_->id());
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 app_service_->GetPinPosition(extension_misc::kChromeAppId))); 4008 app_service_->GetPinPosition(extension_misc::kChromeAppId)));
4009 EXPECT_TRUE( 4009 EXPECT_TRUE(
4010 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); 4010 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
4011 EXPECT_TRUE( 4011 EXPECT_TRUE(
4012 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); 4012 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
4013 EXPECT_TRUE( 4013 EXPECT_TRUE(
4014 position_2.Equals(app_service_->GetPinPosition(extension2_->id()))); 4014 position_2.Equals(app_service_->GetPinPosition(extension2_->id())));
4015 EXPECT_TRUE( 4015 EXPECT_TRUE(
4016 position_3.Equals(app_service_->GetPinPosition(extension3_->id()))); 4016 position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
4017 } 4017 }
4018
4019 // Test the case when sync app is turned off and we need to use local copy to
4020 // support user's pins.
4021 TEST_F(ChromeLauncherControllerImplTest, SyncOffLocalUpdate) {
4022 InitLauncherController();
4023
4024 extension_service_->AddExtension(extension1_.get());
4025 extension_service_->AddExtension(extension2_.get());
4026
4027 syncer::SyncChangeList sync_list;
4028 InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId);
4029 InsertAddPinChange(&sync_list, 1, extension1_->id());
4030 InsertAddPinChange(&sync_list, 1, extension2_->id());
4031 SendPinChanges(sync_list, true);
4032
4033 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4034
4035 syncer::SyncDataList copy_sync_list =
4036 app_service_->GetAllSyncData(syncer::APP_LIST);
4037
4038 app_service_->StopSyncing(syncer::APP_LIST);
4039 RecreateChromeLauncher();
4040
4041 // Pinned state should not change.
4042 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4043 launcher_controller_->UnpinAppWithID(extension2_->id());
4044 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus());
4045
4046 // Resume syncing and sync information overrides local copy.
4047 StartAppSyncService(copy_sync_list);
4048 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4049 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698