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

Side by Side Diff: chrome/browser/subresource_filter/subresource_filter_browsertest.cc

Issue 2844063002: Add support for multiple simultaneous subresource_filter::Configurations. (Closed)
Patch Set: Comment nit. Created 3 years, 7 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 #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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed)); 356 test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed));
357 } 357 }
358 358
359 void ResetConfiguration(Configuration config) { 359 void ResetConfiguration(Configuration config) {
360 scoped_configuration_.ResetConfiguration(std::move(config)); 360 scoped_configuration_.ResetConfiguration(std::move(config));
361 } 361 }
362 362
363 void ResetConfigurationToEnableOnPhishingSites( 363 void ResetConfigurationToEnableOnPhishingSites(
364 bool measure_performance = false, 364 bool measure_performance = false,
365 bool whitelist_site_on_reload = false) { 365 bool whitelist_site_on_reload = false) {
366 Configuration config( 366 Configuration config = Configuration::MakePresetForLiveRunOnPhishingSites();
367 subresource_filter::ActivationLevel::ENABLED, 367 config.activation_options.performance_measurement_rate =
368 subresource_filter::ActivationScope::ACTIVATION_LIST, 368 measure_performance ? 1.0 : 0.0;
369 subresource_filter::ActivationList::PHISHING_INTERSTITIAL); 369 config.activation_options.should_whitelist_site_on_reload =
370 config.performance_measurement_rate = measure_performance ? 1.0 : 0.0; 370 whitelist_site_on_reload;
371 config.should_whitelist_site_on_reload = whitelist_site_on_reload;
372 ResetConfiguration(std::move(config)); 371 ResetConfiguration(std::move(config));
373 } 372 }
374 373
375 private: 374 private:
376 TestRulesetCreator ruleset_creator_; 375 TestRulesetCreator ruleset_creator_;
377 ScopedSubresourceFilterConfigurator scoped_configuration_; 376 ScopedSubresourceFilterConfigurator scoped_configuration_;
378 TestRulesetPublisher test_ruleset_publisher_; 377 TestRulesetPublisher test_ruleset_publisher_;
379 378
380 std::unique_ptr<safe_browsing::TestSafeBrowsingServiceFactory> sb_factory_; 379 std::unique_ptr<safe_browsing::TestSafeBrowsingServiceFactory> sb_factory_;
381 // Owned by the V4Database. 380 // Owned by the V4Database.
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 std::string(kSubresourceFilterOnlySuffix)), 1372 std::string(kSubresourceFilterOnlySuffix)),
1374 ::testing::IsEmpty()); 1373 ::testing::IsEmpty());
1375 1374
1376 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) + 1375 EXPECT_THAT(tester.GetAllSamples(std::string(kNavigationChainSize) +
1377 std::string(kSubresourceFilterOnlySuffix)), 1376 std::string(kSubresourceFilterOnlySuffix)),
1378 ::testing::IsEmpty()); 1377 ::testing::IsEmpty());
1379 } 1378 }
1380 #endif 1379 #endif
1381 1380
1382 } // namespace subresource_filter 1381 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698