Mihai Sardarescu | 160ec66 | 2018-07-18 21:13:51 | [diff] [blame] | 1 | // Copyright 2018 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 COMPONENTS_UNIFIED_CONSENT_SCOPED_UNIFIED_CONSENT_H_ |
| 6 | #define COMPONENTS_UNIFIED_CONSENT_SCOPED_UNIFIED_CONSENT_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | #include "base/macros.h" |
| 11 | #include "base/test/scoped_feature_list.h" |
Mihai Sardarescu | 160ec66 | 2018-07-18 21:13:51 | [diff] [blame] | 12 | |
| 13 | namespace unified_consent { |
| 14 | |
Thomas Tangl | 460a5861 | 2018-11-30 12:06:52 | [diff] [blame] | 15 | // State of the "Unified Consent" feature. |
| 16 | enum class UnifiedConsentFeatureState { |
| 17 | // Unified consent is disabled. |
| 18 | kDisabled, |
| 19 | // Unified consent is enabled. |
| 20 | kEnabled, |
| 21 | }; |
| 22 | |
Mihai Sardarescu | 160ec66 | 2018-07-18 21:13:51 | [diff] [blame] | 23 | // Changes the unified consent feature state while it is in scope. Useful for |
| 24 | // tests. |
| 25 | // Also enables the feature |switches::kSyncUserConsentSeparateType| as |
| 26 | // unified consent depends on its. |
| 27 | class ScopedUnifiedConsent { |
| 28 | public: |
| 29 | explicit ScopedUnifiedConsent(UnifiedConsentFeatureState state); |
| 30 | ~ScopedUnifiedConsent(); |
| 31 | |
| 32 | private: |
Mihai Sardarescu | 160ec66 | 2018-07-18 21:13:51 | [diff] [blame] | 33 | base::test::ScopedFeatureList unified_consent_feature_list_; |
| 34 | |
| 35 | DISALLOW_COPY_AND_ASSIGN(ScopedUnifiedConsent); |
| 36 | }; |
| 37 | |
| 38 | } // namespace unified_consent |
| 39 | |
| 40 | #endif // COMPONENTS_UNIFIED_CONSENT_SCOPED_UNIFIED_CONSENT_H_ |