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

Side by Side Diff: components/subresource_filter/core/browser/subresource_filter_features_test_support.h

Issue 2844063002: Add support for multiple simultaneous subresource_filter::Configurations. (Closed)
Patch Set: Minimal polish, still missing unittests for multiple simultaneous configs. Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_T EST_SUPPORT_H_ 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_T EST_SUPPORT_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_T EST_SUPPORT_H_ 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_T EST_SUPPORT_H_
7 7
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/scoped_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
11 #include "components/subresource_filter/core/browser/subresource_filter_features .h" 11 #include "components/subresource_filter/core/browser/subresource_filter_features .h"
12 12
13 namespace subresource_filter { 13 namespace subresource_filter {
14 namespace testing { 14 namespace testing {
15 15
16 // Helper class to override the active subresource filtering configuration to be 16 // Helper class to override the active subresource filtering configuration to be
17 // used in tests while the instance is in scope. 17 // used in tests while the instance is in scope.
18 // 18 //
19 // Configuration overrides can be nested, and will take effect regardless of 19 // Configuration overrides can be nested, and will take effect regardless of
20 // field trial, feature, and/or variation parameter states. 20 // field trial, feature, and/or variation parameter states.
21 class ScopedSubresourceFilterConfigurator { 21 class ScopedSubresourceFilterConfigurator {
22 public: 22 public:
23 explicit ScopedSubresourceFilterConfigurator( 23 explicit ScopedSubresourceFilterConfigurator(
24 scoped_refptr<ConfigurationList> configs = nullptr); 24 scoped_refptr<ConfigurationList> config_list = nullptr);
25 explicit ScopedSubresourceFilterConfigurator(Configuration config); 25 explicit ScopedSubresourceFilterConfigurator(Configuration config);
26 explicit ScopedSubresourceFilterConfigurator(
27 std::vector<Configuration> configs);
26 ~ScopedSubresourceFilterConfigurator(); 28 ~ScopedSubresourceFilterConfigurator();
27 29
28 void ResetConfiguration(Configuration config); 30 void ResetConfiguration(Configuration config);
29 31
30 private: 32 private:
31 scoped_refptr<ConfigurationList> original_config_; 33 scoped_refptr<ConfigurationList> original_config_;
32 34
33 DISALLOW_COPY_AND_ASSIGN(ScopedSubresourceFilterConfigurator); 35 DISALLOW_COPY_AND_ASSIGN(ScopedSubresourceFilterConfigurator);
34 }; 36 };
35 37
(...skipping 16 matching lines...) Expand all
52 ScopedSubresourceFilterConfigurator scoped_configuration_; 54 ScopedSubresourceFilterConfigurator scoped_configuration_;
53 base::test::ScopedFeatureList scoped_feature_list_; 55 base::test::ScopedFeatureList scoped_feature_list_;
54 56
55 DISALLOW_COPY_AND_ASSIGN(ScopedSubresourceFilterFeatureToggle); 57 DISALLOW_COPY_AND_ASSIGN(ScopedSubresourceFilterFeatureToggle);
56 }; 58 };
57 59
58 } // namespace testing 60 } // namespace testing
59 } // namespace subresource_filter 61 } // namespace subresource_filter
60 62
61 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURE S_TEST_SUPPORT_H_ 63 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURE S_TEST_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698