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 13class Profile; 14 15namespace 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. 19bool 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. 23bool 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. 27std::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. 32std::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. 36std::string InstallAppForAllProfiles(int index); 37 38// Uninstalls the app for the given index from |profile|. Assumes that it was 39// previously installed. 40void UninstallApp(Profile* profile, int index); 41 42// Installs all pending synced apps for |profile|. 43void InstallAppsPendingForSync(Profile* profile); 44 45// Enables the app for the given index on |profile|. 46void EnableApp(Profile* profile, int index); 47 48// Disables the app for the given index on |profile|. 49void DisableApp(Profile* profile, int index); 50 51// Enables the app for the given index in incognito mode on |profile|. 52void IncognitoEnableApp(Profile* profile, int index); 53 54// Disables the app for the given index in incognito mode on |profile|. 55void IncognitoDisableApp(Profile* profile, int index); 56 57// Gets the page ordinal value for the application at the given index on 58// |profile|. 59syncer::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|. 63void 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|. 69syncer::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|. 74void 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. 82void CopyNTPOrdinals(Profile* source, Profile* destination, int index); 83 84// Fix any NTP icon collisions that are currently in |profile|. 85void FixNTPOrdinalCollisions(Profile* profile); 86 87} // namespace apps_helper 88 89#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_APPS_HELPER_H_ 90