Chromium Code Reviews| Index: chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc |
| diff --git a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc |
| index 50056eef95ce4cfdb92fd095c2c8bd746f4b7713..e38c0eedea7ef914929a446dfb0d4cc2ae4f058c 100644 |
| --- a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc |
| +++ b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc |
| @@ -35,6 +35,15 @@ bool AllProfilesHaveSameAppListAsVerifier() { |
| AllProfilesHaveSameAppListAsVerifier(); |
| } |
| +const app_list::AppListSyncableService::SyncItem* GetSyncItem( |
| + Profile* profile, |
| + const std::string& app_id) { |
| + app_list::AppListSyncableService* service = |
| + app_list::AppListSyncableServiceFactory::GetForProfile(profile); |
| + return service->GetSyncItem(app_id); |
| +} |
| + |
|
tapted
2013/12/19 01:20:57
nit: remove extra blank line
stevenjb
2013/12/19 01:48:44
Done.
|
| + |
| } // namespace |
| class TwoClientAppListSyncTest : public SyncTest { |
| @@ -398,3 +407,69 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppListSyncTest, Move) { |
| ASSERT_TRUE(AwaitQuiescence()); |
| ASSERT_TRUE(AllProfilesHaveSameAppListAsVerifier()); |
| } |
| + |
| +// Install a Default App on both clients, then sync. Remove the app on one |
| +// client and sync. Ensure that the app is removed on the other client and |
| +// that a REMOVE_DEFAULT_APP entry exists. |
| +IN_PROC_BROWSER_TEST_F(TwoClientAppListSyncTest, RemoveDefault) { |
| + ASSERT_TRUE(SetupClients()); |
| + ASSERT_TRUE(SetupSync()); |
| + |
| + int i = 0; |
| + |
| + // Install a non-default app. |
| + InstallApp(GetProfile(0), i); |
| + InstallApp(GetProfile(1), i); |
| + InstallApp(verifier(), i); |
| + ++i; |
| + |
| + // Install a default app in Profile 0 only. |
| + int default_app_index = i; |
|
tapted
2013/12/19 01:20:57
`i` seems a bit out of place, outside of a loop. S
stevenjb
2013/12/19 01:48:44
Done.
|
| + std::string default_app_id = InstallApp(GetProfile(0), default_app_index); |
| + InstallApp(verifier(), default_app_index); |
| + SyncAppListHelper::GetInstance()->CopyOrdinalsToVerifier( |
| + GetProfile(0), default_app_id); |
| + |
| + ASSERT_TRUE(AwaitQuiescence()); |
| + InstallAppsPendingForSync(GetProfile(0)); |
| + InstallAppsPendingForSync(GetProfile(1)); |
| + ASSERT_TRUE(AllProfilesHaveSameAppListAsVerifier()); |
| + |
| + // Flag Default app in Profile 1. |
| + extensions::ExtensionSystem::Get(GetProfile(1))-> |
| + extension_service()->extension_prefs()-> |
| + UpdateExtensionPref(default_app_id, "was_installed_by_default", |
| + new base::FundamentalValue(true)); |
| + |
| + // Remove the default app in Profile 0 and verifier, ensure it was removed |
| + // in Profile 1. |
| + UninstallApp(GetProfile(0), default_app_index); |
| + UninstallApp(verifier(), default_app_index); |
| + ASSERT_TRUE(AwaitQuiescence()); |
| + ASSERT_TRUE(AllProfilesHaveSameAppListAsVerifier()); |
| + |
| + // Ensure that a REMOVE_DEFAULT_APP SyncItem entry exists in Profile 1. |
| + const app_list::AppListSyncableService::SyncItem* sync_item = |
| + GetSyncItem(GetProfile(1), default_app_id); |
| + ASSERT_TRUE(sync_item); |
| + ASSERT_EQ(sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP, |
| + sync_item->item_type); |
| + |
| + // Re-Install the same app in Profile 0. |
| + std::string app_id2 = InstallApp(GetProfile(0), default_app_index); |
| + EXPECT_EQ(default_app_id, app_id2); |
| + InstallApp(verifier(), default_app_index); |
| + sync_item = GetSyncItem(GetProfile(0), app_id2); |
| + EXPECT_EQ(sync_pb::AppListSpecifics::TYPE_APP, sync_item->item_type); |
| + |
| + ASSERT_TRUE(AwaitQuiescence()); |
| + InstallAppsPendingForSync(GetProfile(0)); |
| + InstallAppsPendingForSync(GetProfile(1)); |
| + ASSERT_TRUE(AllProfilesHaveSameAppListAsVerifier()); |
| + |
| + // Ensure that the REMOVE_DEFAULT_APP SyncItem entry in Profile 1 is replaced |
| + // with an APP entry after an install. |
| + sync_item = GetSyncItem(GetProfile(1), app_id2); |
| + ASSERT_TRUE(sync_item); |
| + EXPECT_EQ(sync_pb::AppListSpecifics::TYPE_APP, sync_item->item_type); |
| +} |