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_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 #include "chrome/test/live_sync/sync_datatype_helper.h" |
| 12 |
| 13 #include <string> |
| 14 |
| 15 class PrefService; |
| 16 |
| 17 class PreferencesHelper : public SyncDatatypeHelper { |
| 18 public: |
| 19 // Used to access the preferences within a particular sync profile. |
| 20 static PrefService* GetPrefs(int index); |
| 21 |
| 22 // Used to access the preferences within the verifier sync profile. |
| 23 static 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 static 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 static void ChangeIntegerPref(int index, |
| 34 const char* pref_name, |
| 35 int new_value); |
| 36 |
| 37 // Changes the value of the double preference with name |pref_name| in the |
| 38 // profile with index |index| to |new_value|. Also changes its value in |
| 39 // |verifier| if DisableVerifier() hasn't been called. |
| 40 static void ChangeDoublePref(int index, |
| 41 const char* pref_name, |
| 42 double new_value); |
| 43 |
| 44 // Changes the value of the string preference with name |pref_name| in the |
| 45 // profile with index |index| to |new_value|. Also changes its value in |
| 46 // |verifier| if DisableVerifier() hasn't been called. |
| 47 static void ChangeStringPref(int index, |
| 48 const char* pref_name, |
| 49 const std::string& new_value); |
| 50 |
| 51 // Modifies the value of the string preference with name |pref_name| in the |
| 52 // profile with index |index| by appending |append_value| to its current |
| 53 // value. Also changes its value in |verifier| if DisableVerifier() hasn't |
| 54 // been called. |
| 55 static void AppendStringPref(int index, |
| 56 const char* pref_name, |
| 57 const std::string& append_value); |
| 58 |
| 59 // Changes the value of the file path preference with name |pref_name| in the |
| 60 // profile with index |index| to |new_value|. Also changes its value in |
| 61 // |verifier| if DisableVerifier() hasn't been called. |
| 62 static void ChangeFilePathPref(int index, |
| 63 const char* pref_name, |
| 64 const FilePath& new_value); |
| 65 |
| 66 // Changes the value of the list preference with name |pref_name| in the |
| 67 // profile with index |index| to |new_value|. Also changes its value in |
| 68 // |verifier| if DisableVerifier() hasn't been called. |
| 69 static void ChangeListPref(int index, |
| 70 const char* pref_name, |
| 71 const ListValue& new_value); |
| 72 |
| 73 // Used to verify that the boolean preference with name |pref_name| has the |
| 74 // same value across all profiles. Also checks |verifier| if DisableVerifier() |
| 75 // hasn't been called. |
| 76 static bool BooleanPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 77 |
| 78 // Used to verify that the integer preference with name |pref_name| has the |
| 79 // same value across all profiles. Also checks |verifier| if DisableVerifier() |
| 80 // hasn't been called. |
| 81 static bool IntegerPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 82 |
| 83 // Used to verify that the double 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 DoublePrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 87 |
| 88 // Used to verify that the string 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 StringPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 92 |
| 93 // Used to verify that the file path 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 FilePathPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 97 |
| 98 // Used to verify that the list 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 ListPrefMatches(const char* pref_name) WARN_UNUSED_RESULT; |
| 102 |
| 103 // Encrypts the Preferences datatype. |
| 104 static bool EnableEncryption(int index); |
| 105 |
| 106 // Checks if Preferences are encrypted. |
| 107 static bool IsEncrypted(int index); |
| 108 |
| 109 protected: |
| 110 PreferencesHelper(); |
| 111 virtual ~PreferencesHelper(); |
| 112 |
| 113 private: |
| 114 DISALLOW_COPY_AND_ASSIGN(PreferencesHelper); |
| 115 }; |
| 116 |
| 117 #endif // CHROME_TEST_LIVE_SYNC_PREFERENCES_HELPER_H_ |
OLD | NEW |