Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / extensions_helper.h
blobc4b021f1049401c472bb618f63826490c5ddec62
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_EXTENSIONS_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_EXTENSIONS_HELPER_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/sync/test/integration/sync_test.h"
15 class Profile;
17 namespace extensions_helper {
19 // Returns true iff the profile with index |index| has the same extensions
20 // as the verifier.
21 bool HasSameExtensionsAsVerifier(int index) WARN_UNUSED_RESULT;
23 // Returns true iff all existing profiles have the same extensions
24 // as the verifier.
25 bool AllProfilesHaveSameExtensionsAsVerifier() WARN_UNUSED_RESULT;
27 // Returns true iff all existing profiles have the same extensions.
28 bool AllProfilesHaveSameExtensions() WARN_UNUSED_RESULT;
30 // Installs the extension for the given index to |profile|, and returns the
31 // extension ID of the new extension.
32 std::string InstallExtension(Profile* profile, int index);
34 // Installs the extension for the given index to all profiles (including the
35 // verifier), and returns the extension ID of the new extension.
36 std::string InstallExtensionForAllProfiles(int index);
38 // Uninstalls the extension for the given index from |profile|. Assumes that
39 // it was previously installed.
40 void UninstallExtension(Profile* profile, int index);
42 // Returns a vector containing the indices of all currently installed
43 // test extensions on |profile|.
44 std::vector<int> GetInstalledExtensions(Profile* profile);
46 // Installs all pending synced extensions for |profile|.
47 void InstallExtensionsPendingForSync(Profile* profile);
49 // Enables the extension for the given index on |profile|.
50 void EnableExtension(Profile* profile, int index);
52 // Disables the extension for the given index on |profile|.
53 void DisableExtension(Profile* profile, int index);
55 // Returns true if the extension with index |index| is enabled on |profile|.
56 bool IsExtensionEnabled(Profile* profile, int index);
58 // Enables the extension for the given index in incognito mode on |profile|.
59 void IncognitoEnableExtension(Profile* profile, int index);
61 // Disables the extension for the given index in incognito mode on |profile|.
62 void IncognitoDisableExtension(Profile* profile, int index);
64 // Returns true if the extension with index |index| is enabled in incognito
65 // mode on |profile|.
66 bool IsIncognitoEnabled(Profile* profile, int index);
68 // Returns a unique extension name based in the integer |index|.
69 std::string CreateFakeExtensionName(int index);
71 // Converts a fake extension name back into the index used to generate it.
72 // Returns true if successful, false on failure.
73 bool ExtensionNameToIndex(const std::string& name, int* index);
75 // Runs the message loop until AllProfilesHaveSameExtensionsAsVerifier()
76 // is true. Returns false on timeout.
77 bool AwaitAllProfilesHaveSameExtensionsAsVerifier();
79 } // namespace extensions_helper
81 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_EXTENSIONS_HELPER_H_