OLD | NEW |
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 #include "components/subresource_filter/core/browser/subresource_filter_features
_test_support.h" | 5 #include "components/subresource_filter/core/browser/subresource_filter_features
_test_support.h" |
6 | 6 |
| 7 #include <ostream> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
| 10 #include "base/json/json_writer.h" |
9 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/trace_event/trace_event_argument.h" |
| 15 #include "base/values.h" |
12 | 16 |
13 namespace subresource_filter { | 17 namespace subresource_filter { |
14 namespace testing { | 18 namespace testing { |
15 | 19 |
16 // ScopedSubresourceFilterConfigurator ---------------------------------------- | 20 // ScopedSubresourceFilterConfigurator ---------------------------------------- |
17 | 21 |
18 ScopedSubresourceFilterConfigurator::ScopedSubresourceFilterConfigurator( | 22 ScopedSubresourceFilterConfigurator::ScopedSubresourceFilterConfigurator( |
19 scoped_refptr<ConfigurationList> configs_list) | 23 scoped_refptr<ConfigurationList> configs_list) |
20 : original_config_(GetAndSetActivateConfigurations(configs_list)) {} | 24 : original_config_(GetAndSetActivateConfigurations(configs_list)) {} |
21 | 25 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 80 } |
77 | 81 |
78 scoped_configuration_.ResetConfiguration(); | 82 scoped_configuration_.ResetConfiguration(); |
79 scoped_feature_list_ = base::MakeUnique<base::test::ScopedFeatureList>(); | 83 scoped_feature_list_ = base::MakeUnique<base::test::ScopedFeatureList>(); |
80 scoped_feature_list_->InitFromCommandLine(enabled_features, | 84 scoped_feature_list_->InitFromCommandLine(enabled_features, |
81 disabled_features); | 85 disabled_features); |
82 } | 86 } |
83 | 87 |
84 ScopedSubresourceFilterFeatureToggle::~ScopedSubresourceFilterFeatureToggle() {} | 88 ScopedSubresourceFilterFeatureToggle::~ScopedSubresourceFilterFeatureToggle() {} |
85 | 89 |
| 90 std::ostream& operator<<(std::ostream& os, const Configuration& config) { |
| 91 std::unique_ptr<base::Value> value = config.ToTracedValue()->ToBaseValue(); |
| 92 base::DictionaryValue* dict; |
| 93 value->GetAsDictionary(&dict); |
| 94 std::string json; |
| 95 base::JSONWriter::WriteWithOptions( |
| 96 *dict, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); |
| 97 return os << json; |
| 98 } |
| 99 |
86 } // namespace testing | 100 } // namespace testing |
87 } // namespace subresource_filter | 101 } // namespace subresource_filter |
OLD | NEW |