OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_H_ | |
6 #define CHROME_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/compiler_specific.h" | |
14 #include "chrome/test/live_sync/live_sync_extension_helper.h" | |
15 #include "chrome/test/live_sync/live_sync_test.h" | |
16 | |
17 class Profile; | |
18 | |
19 class LiveExtensionsSyncTest : public LiveSyncTest { | |
20 public: | |
21 explicit LiveExtensionsSyncTest(TestType test_type); | |
22 virtual ~LiveExtensionsSyncTest(); | |
23 | |
24 protected: | |
25 // Like LiveSyncTest::SetupClients(), but also sets up | |
26 // |extension_helper_|. | |
27 virtual bool SetupClients() OVERRIDE WARN_UNUSED_RESULT; | |
28 | |
29 // Returns true iff the profile with index |index| has the same extensions | |
30 // as the verifier. | |
31 bool HasSameExtensionsAsVerifier(int index) WARN_UNUSED_RESULT; | |
32 | |
33 // Returns true iff all existing profiles have the same extensions | |
34 // as the verifier. | |
35 bool AllProfilesHaveSameExtensionsAsVerifier() WARN_UNUSED_RESULT; | |
36 | |
37 // Returns true iff all existing profiles have the same extensions. | |
38 bool AllProfilesHaveSameExtensions() WARN_UNUSED_RESULT; | |
39 | |
40 // Installs the extension for the given index to |profile|. | |
41 void InstallExtension(Profile* profile, int index); | |
42 | |
43 // Uninstalls the extension for the given index from |profile|. Assumes that | |
44 // it was previously installed. | |
45 void UninstallExtension(Profile* profile, int index); | |
46 | |
47 // Returns a vector containing the indices of all currently installed | |
48 // test extensions on |profile|. | |
49 std::vector<int> GetInstalledExtensions(Profile* profile); | |
50 | |
51 // Installs all pending synced extensions for |profile|. | |
52 void InstallExtensionsPendingForSync(Profile* profile); | |
53 | |
54 // Enables the extension for the given index on |profile|. | |
55 void EnableExtension(Profile* profile, int index); | |
56 | |
57 // Disables the extension for the given index on |profile|. | |
58 void DisableExtension(Profile* profile, int index); | |
59 | |
60 // Returns true if the extension with index |index| is enabled on |profile|. | |
61 bool IsExtensionEnabled(Profile* profile, int index); | |
62 | |
63 // Enables the extension for the given index in incognito mode on |profile|. | |
64 void IncognitoEnableExtension(Profile* profile, int index); | |
65 | |
66 // Disables the extension for the given index in incognito mode on |profile|. | |
67 void IncognitoDisableExtension(Profile* profile, int index); | |
68 | |
69 // Returns true if the extension with index |index| is enabled in incognito | |
70 // mode on |profile|. | |
71 bool IsIncognitoEnabled(Profile* profile, int index); | |
72 | |
73 // Returns a unique extension name based in the integer |index|. | |
74 static std::string CreateFakeExtensionName(int index); | |
75 | |
76 // Converts a fake extension name back into the index used to generate it. | |
77 // Returns true if successful, false on failure. | |
78 static bool ExtensionNameToIndex(const std::string& name, int* index); | |
79 | |
80 private: | |
81 LiveSyncExtensionHelper extension_helper_; | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(LiveExtensionsSyncTest); | |
84 }; | |
85 | |
86 class SingleClientLiveExtensionsSyncTest : public LiveExtensionsSyncTest { | |
87 public: | |
88 SingleClientLiveExtensionsSyncTest() | |
89 : LiveExtensionsSyncTest(SINGLE_CLIENT) {} | |
90 | |
91 virtual ~SingleClientLiveExtensionsSyncTest() {} | |
92 | |
93 private: | |
94 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveExtensionsSyncTest); | |
95 }; | |
96 | |
97 class TwoClientLiveExtensionsSyncTest : public LiveExtensionsSyncTest { | |
98 public: | |
99 TwoClientLiveExtensionsSyncTest() | |
100 : LiveExtensionsSyncTest(TWO_CLIENT) {} | |
101 | |
102 virtual ~TwoClientLiveExtensionsSyncTest() {} | |
103 | |
104 private: | |
105 DISALLOW_COPY_AND_ASSIGN(TwoClientLiveExtensionsSyncTest); | |
106 }; | |
107 | |
108 | |
109 #endif // CHROME_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_H_ | |
OLD | NEW |