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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed)); | 371 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed)); |
372 } | 372 } |
373 | 373 |
374 void ResetConfiguration(Configuration config) { | 374 void ResetConfiguration(Configuration config) { |
375 scoped_configuration_.ResetConfiguration(std::move(config)); | 375 scoped_configuration_.ResetConfiguration(std::move(config)); |
376 } | 376 } |
377 | 377 |
378 void ResetConfigurationToEnableOnPhishingSites( | 378 void ResetConfigurationToEnableOnPhishingSites( |
379 bool measure_performance = false, | 379 bool measure_performance = false, |
380 bool whitelist_site_on_reload = false) { | 380 bool whitelist_site_on_reload = false) { |
381 Configuration config( | 381 Configuration config = Configuration::MakePresetForLiveRunOnPhishingSites(); |
382 subresource_filter::ActivationLevel::ENABLED, | 382 config.activation_options.performance_measurement_rate = |
383 subresource_filter::ActivationScope::ACTIVATION_LIST, | 383 measure_performance ? 1.0 : 0.0; |
384 subresource_filter::ActivationList::PHISHING_INTERSTITIAL); | 384 config.activation_options.should_whitelist_site_on_reload = |
385 config.performance_measurement_rate = measure_performance ? 1.0 : 0.0; | 385 whitelist_site_on_reload; |
386 config.should_whitelist_site_on_reload = whitelist_site_on_reload; | |
387 ResetConfiguration(std::move(config)); | 386 ResetConfiguration(std::move(config)); |
388 } | 387 } |
389 | 388 |
390 private: | 389 private: |
391 TestRulesetCreator ruleset_creator_; | 390 TestRulesetCreator ruleset_creator_; |
392 ScopedSubresourceFilterConfigurator scoped_configuration_; | 391 ScopedSubresourceFilterConfigurator scoped_configuration_; |
393 TestRulesetPublisher test_ruleset_publisher_; | 392 TestRulesetPublisher test_ruleset_publisher_; |
394 | 393 |
395 std::unique_ptr<safe_browsing::TestSafeBrowsingServiceFactory> sb_factory_; | 394 std::unique_ptr<safe_browsing::TestSafeBrowsingServiceFactory> sb_factory_; |
396 // Owned by the V4Database. | 395 // Owned by the V4Database. |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 std::string(kSubresourceFilterOnlySuffix)), | 1458 std::string(kSubresourceFilterOnlySuffix)), |
1460 ::testing::IsEmpty()); | 1459 ::testing::IsEmpty()); |
1461 | 1460 |
1462 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) + | 1461 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) + |
1463 std::string(kSubresourceFilterOnlySuffix)), | 1462 std::string(kSubresourceFilterOnlySuffix)), |
1464 ::testing::IsEmpty()); | 1463 ::testing::IsEmpty()); |
1465 } | 1464 } |
1466 #endif | 1465 #endif |
1467 | 1466 |
1468 } // namespace subresource_filter | 1467 } // namespace subresource_filter |
OLD | NEW |