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 <map> | 5 #include <map> |
6 #include <memory> | 6 #include <memory> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 void SetRulesetWithRules(const std::vector<proto::UrlRule>& rules) { | 374 void SetRulesetWithRules(const std::vector<proto::UrlRule>& rules) { |
375 TestRulesetPair test_ruleset_pair; | 375 TestRulesetPair test_ruleset_pair; |
376 ruleset_creator_.CreateRulesetWithRules(rules, &test_ruleset_pair); | 376 ruleset_creator_.CreateRulesetWithRules(rules, &test_ruleset_pair); |
377 ASSERT_NO_FATAL_FAILURE( | 377 ASSERT_NO_FATAL_FAILURE( |
378 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed)); | 378 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed)); |
379 } | 379 } |
380 | 380 |
381 void ToggleFeatures( | 381 void ToggleFeatures( |
382 std::unique_ptr<ScopedSubresourceFilterFeatureToggle> features) { | 382 std::unique_ptr<ScopedSubresourceFilterFeatureToggle> features) { |
383 scoped_feature_toggle_ = std::move(features); | 383 scoped_feature_toggle_ = std::move(features); |
384 ContentSubresourceFilterDriverFactory* driver_factory = | |
385 ContentSubresourceFilterDriverFactory::FromWebContents(web_contents()); | |
386 driver_factory->set_configuration_for_testing(GetActiveConfiguration()); | |
387 } | 384 } |
388 | 385 |
389 private: | 386 private: |
390 TestRulesetCreator ruleset_creator_; | 387 TestRulesetCreator ruleset_creator_; |
391 | 388 |
392 std::unique_ptr<ScopedSubresourceFilterFeatureToggle> scoped_feature_toggle_; | 389 std::unique_ptr<ScopedSubresourceFilterFeatureToggle> scoped_feature_toggle_; |
393 TestRulesetPublisher test_ruleset_publisher_; | 390 TestRulesetPublisher test_ruleset_publisher_; |
394 const bool measure_performance_; | 391 const bool measure_performance_; |
395 const bool whitelist_site_on_reload_; | 392 const bool whitelist_site_on_reload_; |
396 | 393 |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 std::string(kSubresourceFilterOnlySuffix)), | 1341 std::string(kSubresourceFilterOnlySuffix)), |
1345 ::testing::IsEmpty()); | 1342 ::testing::IsEmpty()); |
1346 | 1343 |
1347 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) + | 1344 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) + |
1348 std::string(kSubresourceFilterOnlySuffix)), | 1345 std::string(kSubresourceFilterOnlySuffix)), |
1349 ::testing::IsEmpty()); | 1346 ::testing::IsEmpty()); |
1350 } | 1347 } |
1351 #endif | 1348 #endif |
1352 | 1349 |
1353 } // namespace subresource_filter | 1350 } // namespace subresource_filter |
OLD | NEW |