Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/test/live_sync/preferences_helper.h

Issue 7259005: Allow sync integration tests to operate on multiple datatypes: Preferences + Bookmarks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actual patch set. (Moves show up as adds / deletes. Hard to review) Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_PREFERENCES_HELPER_H_
6 #define CHROME_TEST_LIVE_SYNC_PREFERENCES_HELPER_H_
7 #pragma once
8
9 #include "base/file_path.h"
10 #include "base/values.h"
11
12 #include <string>
13
14 class PrefService;
15 class LiveSyncTest;
16
17 class PreferencesHelper {
18 public:
19 PreferencesHelper();
20 ~PreferencesHelper();
ncarter (slow) 2011/07/06 17:48:52 I'm doing pros/cons of whether this should be a no
Raghu Simha 2011/07/07 02:14:04 Maybe I'm missing something, but I don't see the b
ncarter (slow) 2011/07/07 02:30:34 The only difference is in readability; it allows y
21
22 // Associates an instance of LiveSyncTest with PreferencesHelper. Must be
23 // called before any of the helper methods below can be used.
24 static void AssociateWithTest(LiveSyncTest* test);
25
26 // Returns |test_| after making sure it is a valid pointer.
27 static LiveSyncTest* test();
28
29 // Used to access the preferences within a particular sync profile.
30 static PrefService* GetPrefs(int index);
31
32 // Used to access the preferences within the verifier sync profile.
33 static PrefService* GetVerifierPrefs();
34
35 // Inverts the value of the boolean preference with name |pref_name| in the
36 // profile with index |index|. Also inverts its value in |verifier| if
37 // DisableVerifier() hasn't been called.
38 static void ChangeBooleanPref(int index, const char* pref_name);
39
40 // Changes the value of the integer 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 static void ChangeIntegerPref(int index,
44 const char* pref_name,
45 int new_value);
46
47 // Changes the value of the double preference with name |pref_name| in the
48 // profile with index |index| to |new_value|. Also changes its value in
49 // |verifier| if DisableVerifier() hasn't been called.
50 static void ChangeDoublePref(int index,
51 const char* pref_name,
52 double new_value);
53
54 // Changes the value of the string preference with name |pref_name| in the
55 // profile with index |index| to |new_value|. Also changes its value in
56 // |verifier| if DisableVerifier() hasn't been called.
57 static void ChangeStringPref(int index,
58 const char* pref_name,
59 const std::string& new_value);
60
61 // Modifies the value of the string preference with name |pref_name| in the
62 // profile with index |index| by appending |append_value| to its current
63 // value. Also changes its value in |verifier| if DisableVerifier() hasn't
64 // been called.
65 static void AppendStringPref(int index,
66 const char* pref_name,
67 const std::string& append_value);
68
69 // Changes the value of the file path preference with name |pref_name| in the
70 // profile with index |index| to |new_value|. Also changes its value in
71 // |verifier| if DisableVerifier() hasn't been called.
72 static void ChangeFilePathPref(int index,
73 const char* pref_name,
74 const FilePath& new_value);
75
76 // Changes the value of the list preference with name |pref_name| in the
77 // profile with index |index| to |new_value|. Also changes its value in
78 // |verifier| if DisableVerifier() hasn't been called.
79 static void ChangeListPref(int index,
80 const char* pref_name,
81 const ListValue& new_value);
82
83 // Used to verify that the boolean preference with name |pref_name| has the
84 // same value across all profiles. Also checks |verifier| if DisableVerifier()
85 // hasn't been called.
86 static bool BooleanPrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
87
88 // Used to verify that the integer preference with name |pref_name| has the
89 // same value across all profiles. Also checks |verifier| if DisableVerifier()
90 // hasn't been called.
91 static bool IntegerPrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
92
93 // Used to verify that the double preference with name |pref_name| has the
94 // same value across all profiles. Also checks |verifier| if DisableVerifier()
95 // hasn't been called.
96 static bool DoublePrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
97
98 // Used to verify that the string preference with name |pref_name| has the
99 // same value across all profiles. Also checks |verifier| if DisableVerifier()
100 // hasn't been called.
101 static bool StringPrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
102
103 // Used to verify that the file path preference with name |pref_name| has the
104 // same value across all profiles. Also checks |verifier| if DisableVerifier()
105 // hasn't been called.
106 static bool FilePathPrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
107
108 // Used to verify that the list preference with name |pref_name| has the
109 // same value across all profiles. Also checks |verifier| if DisableVerifier()
110 // hasn't been called.
111 static bool ListPrefMatches(const char* pref_name) WARN_UNUSED_RESULT;
112
113 // Encrypts the Preferences datatype.
114 static bool EnableEncryption(int index);
115
116 // Checks if Preferences are encrypted.
117 static bool IsEncrypted(int index);
118
119 private:
120 // The LiveSyncTest instance associated with this helper object.
121 static LiveSyncTest* test_;
122
123 DISALLOW_COPY_AND_ASSIGN(PreferencesHelper);
124 };
125
126 #endif // CHROME_TEST_LIVE_SYNC_PREFERENCES_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698