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_PREFERENCES_SYNC_TEST_H_ | |
6 #define CHROME_TEST_LIVE_SYNC_LIVE_PREFERENCES_SYNC_TEST_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include "chrome/test/live_sync/live_sync_test.h" | |
11 | |
12 class PrefService; | |
13 | |
14 class LivePreferencesSyncTest : public LiveSyncTest { | |
15 public: | |
16 explicit LivePreferencesSyncTest(TestType test_type); | |
17 virtual ~LivePreferencesSyncTest(); | |
18 | |
19 // Used to access the preferences within a particular sync profile. | |
20 PrefService* GetPrefs(int index); | |
21 | |
22 // Used to access the preferences within the verifier sync profile. | |
23 PrefService* GetVerifierPrefs(); | |
24 | |
25 // Inverts the value of the boolean preference with name |pref_name| in the | |
26 // profile with index |index|. Also inverts its value in |verifier| if | |
27 // DisableVerifier() hasn't been called. | |
28 void ChangeBooleanPref(int index, const char* pref_name); | |
29 | |
30 // Changes the value of the integer preference with name |pref_name| in the | |
31 // profile with index |index| to |new_value|. Also changes its value in | |
32 // |verifier| if DisableVerifier() hasn't been called. | |
33 void ChangeIntegerPref(int index, const char* pref_name, int new_value); | |
34 | |
35 // Changes the value of the double preference with name |pref_name| in the | |
36 // profile with index |index| to |new_value|. Also changes its value in | |
37 // |verifier| if DisableVerifier() hasn't been called. | |
38 void ChangeDoublePref(int index, const char* pref_name, double new_value); | |
39 | |
40 // Changes the value of the string preference with name |pref_name| in the | |
41 // profile with index |index| to |new_value|. Also changes its value in | |
42 // |verifier| if DisableVerifier() hasn't been called. | |
43 void ChangeStringPref(int index, | |
44 const char* pref_name, | |
45 const std::string& new_value); | |
46 | |
47 // Modifies the value of the string preference with name |pref_name| in the | |
48 // profile with index |index| by appending |append_value| to its current | |
49 // value. Also changes its value in |verifier| if DisableVerifier() hasn't | |
50 // been called. | |
51 void AppendStringPref(int index, | |
52 const char* pref_name, | |
53 const std::string& append_value); | |
54 | |
55 // Changes the value of the file path preference with name |pref_name| in the | |
56 // profile with index |index| to |new_value|. Also changes its value in | |
57 // |verifier| if DisableVerifier() hasn't been called. | |
58 void ChangeFilePathPref(int index, | |
59 const char* pref_name, | |
60 const FilePath& new_value); | |
61 | |
62 // Changes the value of the list preference with name |pref_name| in the | |
63 // profile with index |index| to |new_value|. Also changes its value in | |
64 // |verifier| if DisableVerifier() hasn't been called. | |
65 void ChangeListPref(int index, | |
66 const char* pref_name, | |
67 const ListValue& new_value); | |
68 | |
69 // Used to verify that the boolean preference with name |pref_name| has the | |
70 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
71 // hasn't been called. | |
72 bool BooleanPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
73 | |
74 // Used to verify that the integer preference with name |pref_name| has the | |
75 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
76 // hasn't been called. | |
77 bool IntegerPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
78 | |
79 // Used to verify that the double preference with name |pref_name| has the | |
80 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
81 // hasn't been called. | |
82 bool DoublePrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
83 | |
84 // Used to verify that the string preference with name |pref_name| has the | |
85 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
86 // hasn't been called. | |
87 bool StringPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
88 | |
89 // Used to verify that the file path preference with name |pref_name| has the | |
90 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
91 // hasn't been called. | |
92 bool FilePathPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
93 | |
94 // Used to verify that the list preference with name |pref_name| has the | |
95 // same value across all profiles. Also checks |verifier| if DisableVerifier() | |
96 // hasn't been called. | |
97 bool ListPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; | |
98 | |
99 // After calling this method, changes made to a profile's PrefService will no | |
100 // longer be reflected in the verifier profile. | |
101 void DisableVerifier(); | |
102 | |
103 // Encrypt Preferences datatype. | |
104 bool EnableEncryption(int index); | |
105 | |
106 // Check if Preferences are encrypted. | |
107 bool IsEncrypted(int index); | |
108 | |
109 private: | |
110 // Indicates whether preference operations should also update the verifier | |
111 // profile's PrefService or not. | |
112 bool use_verifier_prefs_; | |
113 | |
114 DISALLOW_COPY_AND_ASSIGN(LivePreferencesSyncTest); | |
115 }; | |
116 | |
117 class SingleClientLivePreferencesSyncTest : public LivePreferencesSyncTest { | |
118 public: | |
119 SingleClientLivePreferencesSyncTest() | |
120 : LivePreferencesSyncTest(SINGLE_CLIENT) {} | |
121 virtual ~SingleClientLivePreferencesSyncTest() {} | |
122 | |
123 private: | |
124 DISALLOW_COPY_AND_ASSIGN(SingleClientLivePreferencesSyncTest); | |
125 }; | |
126 | |
127 class TwoClientLivePreferencesSyncTest : public LivePreferencesSyncTest { | |
128 public: | |
129 TwoClientLivePreferencesSyncTest() : LivePreferencesSyncTest(TWO_CLIENT) {} | |
130 virtual ~TwoClientLivePreferencesSyncTest() {} | |
131 | |
132 private: | |
133 DISALLOW_COPY_AND_ASSIGN(TwoClientLivePreferencesSyncTest); | |
134 }; | |
135 | |
136 class MultipleClientLivePreferencesSyncTest : public LivePreferencesSyncTest { | |
137 public: | |
138 MultipleClientLivePreferencesSyncTest() | |
139 : LivePreferencesSyncTest(MULTIPLE_CLIENT) {} | |
140 virtual ~MultipleClientLivePreferencesSyncTest() {} | |
141 | |
142 private: | |
143 DISALLOW_COPY_AND_ASSIGN(MultipleClientLivePreferencesSyncTest); | |
144 }; | |
145 | |
146 class ManyClientLivePreferencesSyncTest : public LivePreferencesSyncTest { | |
147 public: | |
148 ManyClientLivePreferencesSyncTest() : LivePreferencesSyncTest(MANY_CLIENT) {} | |
149 virtual ~ManyClientLivePreferencesSyncTest() {} | |
150 | |
151 private: | |
152 DISALLOW_COPY_AND_ASSIGN(ManyClientLivePreferencesSyncTest); | |
153 }; | |
154 | |
155 #endif // CHROME_TEST_LIVE_SYNC_LIVE_PREFERENCES_SYNC_TEST_H_ | |
OLD | NEW |