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

Unified Diff: chrome/browser/subresource_filter/subresource_filter_unittest.cc

Issue 2838193002: Split the ScopedSubresourceFilterFeatureToggle into two helper classes. (Closed)
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/subresource_filter/subresource_filter_unittest.cc
diff --git a/chrome/browser/subresource_filter/subresource_filter_unittest.cc b/chrome/browser/subresource_filter/subresource_filter_unittest.cc
index c16b3d4e31a30e19fcb231dd5b77200eeb084f04..5134c59a643a9f7dd1f8ce0020279927e4d2b468 100644
--- a/chrome/browser/subresource_filter/subresource_filter_unittest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_unittest.cc
@@ -9,7 +9,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/metrics/field_trial.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -36,11 +35,15 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+namespace {
+using subresource_filter::testing::ScopedSubresourceFilterConfigurator;
+} // namespace
+
// End to end unit test harness of (most of) the browser process portions of the
// subresource filtering code.
class SubresourceFilterTest : public ChromeRenderViewHostTestHarness {
public:
- SubresourceFilterTest() : field_trial_list_(nullptr) {}
+ SubresourceFilterTest() {}
~SubresourceFilterTest() override {}
// ChromeRenderViewHostTestHarness:
@@ -50,12 +53,11 @@ class SubresourceFilterTest : public ChromeRenderViewHostTestHarness {
// Ensure correct features.
scoped_feature_list_.InitFromCommandLine("SafeBrowsingV4OnlyEnabled", "");
- scoped_feature_toggle_.reset(
- new subresource_filter::testing::ScopedSubresourceFilterFeatureToggle(
- base::FeatureList::OVERRIDE_ENABLE_FEATURE,
- subresource_filter::kActivationLevelEnabled,
- subresource_filter::kActivationScopeActivationList,
- subresource_filter::kActivationListSubresourceFilter));
+ scoped_configuration_.ResetConfiguration(subresource_filter::Configuration(
+ subresource_filter::ActivationLevel::ENABLED,
+ subresource_filter::ActivationScope::ACTIVATION_LIST,
+ subresource_filter::ActivationList::SUBRESOURCE_FILTER));
+
NavigateAndCommit(GURL("https://example.first"));
// Set up safe browsing service with the fake database manager.
@@ -155,12 +157,9 @@ class SubresourceFilterTest : public ChromeRenderViewHostTestHarness {
private:
base::ScopedTempDir ruleset_service_dir_;
- base::FieldTrialList field_trial_list_;
- base::test::ScopedFeatureList scoped_feature_list_;
- std::unique_ptr<
- subresource_filter::testing::ScopedSubresourceFilterFeatureToggle>
- scoped_feature_toggle_;
TestingPrefServiceSimple pref_service_;
+ base::test::ScopedFeatureList scoped_feature_list_;
+ ScopedSubresourceFilterConfigurator scoped_configuration_;
scoped_refptr<FakeSafeBrowsingDatabaseManager> fake_safe_browsing_database_;
« no previous file with comments | « chrome/browser/subresource_filter/subresource_filter_browsertest.cc ('k') | components/safe_browsing_db/v4_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698