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.
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_
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"
15 namespace apps_helper
{
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
;
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
;
25 // Installs the app for the given index to |profile|, and returns the extension
27 std::string
InstallApp(Profile
* profile
, int index
);
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
);
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
);
38 // Uninstalls the app for the given index from |profile|. Assumes that it was
39 // previously installed.
40 void UninstallApp(Profile
* profile
, int index
);
42 // Installs all pending synced apps for |profile|.
43 void InstallAppsPendingForSync(Profile
* profile
);
45 // Enables the app for the given index on |profile|.
46 void EnableApp(Profile
* profile
, int index
);
48 // Disables the app for the given index on |profile|.
49 void DisableApp(Profile
* profile
, int index
);
51 // Enables the app for the given index in incognito mode on |profile|.
52 void IncognitoEnableApp(Profile
* profile
, int index
);
54 // Disables the app for the given index in incognito mode on |profile|.
55 void IncognitoDisableApp(Profile
* profile
, int index
);
57 // Gets the page ordinal value for the application at the given index on
59 syncer::StringOrdinal
GetPageOrdinalForApp(Profile
* profile
, int app_index
);
61 // Sets a new |page_ordinal| value for the application at the given index
63 void SetPageOrdinalForApp(
64 Profile
* profile
, int app_index
,
65 const syncer::StringOrdinal
& page_ordinal
);
67 // Gets the app launch ordinal value for the application at the given index on
69 syncer::StringOrdinal
GetAppLaunchOrdinalForApp(
70 Profile
* profile
, int app_index
);
72 // Sets a new |page_ordinal| value for the application at the given index
74 void SetAppLaunchOrdinalForApp(
75 Profile
* profile
, int app_index
,
76 const syncer::StringOrdinal
& app_launch_ordinal
);
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
);
84 // Fix any NTP icon collisions that are currently in |profile|.
85 void FixNTPOrdinalCollisions(Profile
* profile
);
87 // Waits until all profiles have the same set of apps. In case verifier profile
88 // is enabled, it waits until all profiles match the verifier.
90 // Returns false on time out.
91 bool AwaitAllProfilesHaveSameApps();
93 } // namespace apps_helper
95 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_