1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_ 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/compiler_specific.h" 10 #include "chrome/browser/sync/test/integration/sync_test.h" 11 #include "sync/api/string_ordinal.h" 12 13 class Profile; 14 15 namespace apps_helper { 16 17 // Returns true iff the profile with index |index| has the same apps (hosted, 18 // legacy packaged and platform) as the verifier. 19 bool HasSameAppsAsVerifier(int index) WARN_UNUSED_RESULT; 20 21 // Returns true iff all existing profiles have the same apps (hosted, 22 // legacy packaged and platform) as the verifier. 23 bool AllProfilesHaveSameAppsAsVerifier() WARN_UNUSED_RESULT; 24 25 // Installs the app for the given index to |profile|, and returns the extension 26 // ID of the new app. 27 std::string InstallApp(Profile* profile, int index); 28 29 // Installs the platform app for the given index to |profile|, and returns the 30 // extension ID of the new app. Indices passed to this method should be distinct 31 // from indices passed to InstallApp. 32 std::string InstallPlatformApp(Profile* profile, int index); 33 34 // Installs the app for the given index to all profiles (including the 35 // verifier), and returns the extension ID of the new app. 36 std::string InstallAppForAllProfiles(int index); 37 38 // Uninstalls the app for the given index from |profile|. Assumes that it was 39 // previously installed. 40 void UninstallApp(Profile* profile, int index); 41 42 // Installs all pending synced apps for |profile|. 43 void InstallAppsPendingForSync(Profile* profile); 44 45 // Enables the app for the given index on |profile|. 46 void EnableApp(Profile* profile, int index); 47 48 // Disables the app for the given index on |profile|. 49 void DisableApp(Profile* profile, int index); 50 51 // Enables the app for the given index in incognito mode on |profile|. 52 void IncognitoEnableApp(Profile* profile, int index); 53 54 // Disables the app for the given index in incognito mode on |profile|. 55 void IncognitoDisableApp(Profile* profile, int index); 56 57 // Gets the page ordinal value for the application at the given index on 58 // |profile|. 59 syncer::StringOrdinal GetPageOrdinalForApp(Profile* profile, int app_index); 60 61 // Sets a new |page_ordinal| value for the application at the given index 62 // on |profile|. 63 void SetPageOrdinalForApp( 64 Profile* profile, int app_index, 65 const syncer::StringOrdinal& page_ordinal); 66 67 // Gets the app launch ordinal value for the application at the given index on 68 // |profile|. 69 syncer::StringOrdinal GetAppLaunchOrdinalForApp( 70 Profile* profile, int app_index); 71 72 // Sets a new |page_ordinal| value for the application at the given index 73 // on |profile|. 74 void SetAppLaunchOrdinalForApp( 75 Profile* profile, int app_index, 76 const syncer::StringOrdinal& app_launch_ordinal); 77 78 // Copy the page and app launch ordinal value for the application at the given 79 // index on |profile_source| to |profile_destination|. 80 // The main intention of this is to properly setup the values on the verifier 81 // profile in situations where the other profiles have conflicting values. 82 void CopyNTPOrdinals(Profile* source, Profile* destination, int index); 83 84 // Fix any NTP icon collisions that are currently in |profile|. 85 void FixNTPOrdinalCollisions(Profile* profile); 86 87 // Waits until all profiles have the same set of apps as the verifier. 88 // 89 // Returns false on time out. 90 bool AwaitAllProfilesHaveSameAppsAsVerifier(); 91 92 } // namespace apps_helper 93 94 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_ 95