| OLD | NEW |
| 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 3997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |