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_EXTENSIONS_HELPER_H_ 6#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_EXTENSIONS_HELPER_H_ 7 8#include <string> 9#include <vector> 10 11#include "base/basictypes.h" 12#include "base/compiler_specific.h" 13#include "chrome/browser/sync/test/integration/sync_test.h" 14 15class Profile; 16 17namespace extensions_helper { 18 19// Returns true iff the profile with index |index| has the same extensions 20// as the verifier. 21bool HasSameExtensionsAsVerifier(int index) WARN_UNUSED_RESULT; 22 23// Returns true iff all existing profiles have the same extensions 24// as the verifier. 25bool AllProfilesHaveSameExtensionsAsVerifier() WARN_UNUSED_RESULT; 26 27// Returns true iff all existing profiles have the same extensions. 28bool AllProfilesHaveSameExtensions() WARN_UNUSED_RESULT; 29 30// Installs the extension for the given index to |profile|, and returns the 31// extension ID of the new extension. 32std::string InstallExtension(Profile* profile, int index); 33 34// Installs the extension for the given index to all profiles (including the 35// verifier), and returns the extension ID of the new extension. 36std::string InstallExtensionForAllProfiles(int index); 37 38// Uninstalls the extension for the given index from |profile|. Assumes that 39// it was previously installed. 40void UninstallExtension(Profile* profile, int index); 41 42// Returns a vector containing the indices of all currently installed 43// test extensions on |profile|. 44std::vector<int> GetInstalledExtensions(Profile* profile); 45 46// Installs all pending synced extensions for |profile|. 47void InstallExtensionsPendingForSync(Profile* profile); 48 49// Enables the extension for the given index on |profile|. 50void EnableExtension(Profile* profile, int index); 51 52// Disables the extension for the given index on |profile|. 53void DisableExtension(Profile* profile, int index); 54 55// Returns true if the extension with index |index| is enabled on |profile|. 56bool IsExtensionEnabled(Profile* profile, int index); 57 58// Enables the extension for the given index in incognito mode on |profile|. 59void IncognitoEnableExtension(Profile* profile, int index); 60 61// Disables the extension for the given index in incognito mode on |profile|. 62void IncognitoDisableExtension(Profile* profile, int index); 63 64// Returns true if the extension with index |index| is enabled in incognito 65// mode on |profile|. 66bool IsIncognitoEnabled(Profile* profile, int index); 67 68// Returns a unique extension name based in the integer |index|. 69std::string CreateFakeExtensionName(int index); 70 71// Converts a fake extension name back into the index used to generate it. 72// Returns true if successful, false on failure. 73bool ExtensionNameToIndex(const std::string& name, int* index); 74 75} // namespace extensions_helper 76 77#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_EXTENSIONS_HELPER_H_ 78