Chromium Code Reviews| Index: chrome/browser/sync/test/integration/apps_helper.cc |
| diff --git a/chrome/browser/sync/test/integration/apps_helper.cc b/chrome/browser/sync/test/integration/apps_helper.cc |
| index 2b76b4d893f1a08c1eb0db477edf4cceb5feff38..bb764f66d75b03fec99a71d5c2658d67e393b3e0 100644 |
| --- a/chrome/browser/sync/test/integration/apps_helper.cc |
| +++ b/chrome/browser/sync/test/integration/apps_helper.cc |
| @@ -35,16 +35,22 @@ std::string CreateFakeAppName(int index) { |
| namespace apps_helper { |
| +bool HasSameApps(Profile* profile1, Profile* profile2) { |
| + return SyncAppHelper::GetInstance()->AppStatesMatch(profile1, profile2); |
| +} |
| + |
| bool HasSameAppsAsVerifier(int index) { |
|
Nicolas Zea
2016/03/31 19:01:21
can this be deleted?
shadi
2016/03/31 22:46:47
Done.
|
| - return SyncAppHelper::GetInstance()->AppStatesMatch( |
| - test()->GetProfile(index), test()->verifier()); |
| + return HasSameApps(test()->GetProfile(index), test()->verifier()); |
| } |
| -bool AllProfilesHaveSameAppsAsVerifier() { |
| - for (int i = 0; i < test()->num_clients(); ++i) { |
| - if (!HasSameAppsAsVerifier(i)) { |
| - DVLOG(1) << "Profile " << i << " doesn't have the same apps as the" |
| - " verifier profile."; |
| +bool AllProfilesHaveSameApps() { |
| + std::vector<Profile*> profiles = test()->GetAllProfiles(); |
| + std::vector<Profile*>::iterator it = profiles.begin(); |
| + Profile* profile0 = *it; |
|
Nicolas Zea
2016/03/31 19:01:21
nit: have this be part of for loop? I think you ca
shadi
2016/03/31 22:46:47
Done.
|
| + ++it; |
| + for (; it != profiles.end(); ++it) { |
| + if (!HasSameApps(profile0, *it)) { |
| + DVLOG(1) << "Profiles apps do not match."; |
| return false; |
| } |
| } |
| @@ -66,9 +72,14 @@ std::string InstallPlatformApp(Profile* profile, int index) { |
| } |
| std::string InstallAppForAllProfiles(int index) { |
| - for (int i = 0; i < test()->num_clients(); ++i) |
| - InstallApp(test()->GetProfile(i), index); |
| - return InstallApp(test()->verifier(), index); |
| + std::string extension_id; |
| + std::vector<Profile*> profiles = test()->GetAllProfiles(); |
| + for (std::vector<Profile*>::iterator it = profiles.begin(); |
| + it != profiles.end(); |
| + ++it) { |
| + extension_id = InstallApp(*it, index); |
| + } |
| + return extension_id; |
| } |
| void UninstallApp(Profile* profile, int index) { |
| @@ -86,6 +97,11 @@ void DisableApp(Profile* profile, int index) { |
| profile, CreateFakeAppName(index)); |
| } |
| +bool IsAppEnabled(Profile* profile, int index) { |
| + return SyncExtensionHelper::GetInstance()->IsExtensionEnabled( |
| + profile, CreateFakeAppName(index)); |
| +} |
| + |
| void IncognitoEnableApp(Profile* profile, int index) { |
| return SyncExtensionHelper::GetInstance()->IncognitoEnableExtension( |
| profile, CreateFakeAppName(index)); |
| @@ -96,6 +112,11 @@ void IncognitoDisableApp(Profile* profile, int index) { |
| profile, CreateFakeAppName(index)); |
| } |
| +bool IsIncognitoEnabled(Profile* profile, int index) { |
| + return SyncExtensionHelper::GetInstance()->IsIncognitoEnabled( |
| + profile, CreateFakeAppName(index)); |
| +} |
| + |
| void InstallAppsPendingForSync(Profile* profile) { |
| SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync(profile); |
| } |