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

Unified Diff: chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc

Issue 2731283009: Swap ownership of RulesetService and the content delegate (Closed)
Patch Set: Swap ownership of RulesetService and the content delegate Created 3 years, 9 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/component_updater/subresource_filter_component_installer_unittest.cc
diff --git a/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc b/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
index 2599c8c746b51f1b3b22aee4e40718b3080d54c8..5b01b130f4b650d92394f04499d9c5be5f1cf1a8 100644
--- a/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
+++ b/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
@@ -37,15 +37,15 @@ static const char kTestRulesetVersion[] = "1.2.3.4";
class TestRulesetService : public subresource_filter::RulesetService {
public:
- TestRulesetService(PrefService* local_state,
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- const base::FilePath& base_dir)
- : subresource_filter::RulesetService(
- local_state,
- task_runner,
- base::MakeUnique<
- subresource_filter::ContentRulesetServiceDelegate>(),
- base_dir) {}
+ TestRulesetService(
+ PrefService* local_state,
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ subresource_filter::ContentRulesetServiceDelegate* delegate,
+ const base::FilePath& base_dir)
+ : subresource_filter::RulesetService(local_state,
+ task_runner,
+ delegate,
+ base_dir) {}
~TestRulesetService() override {}
@@ -103,18 +103,21 @@ class SubresourceFilterComponentInstallerTest : public PlatformTest {
subresource_filter::IndexedRulesetVersion::RegisterPrefs(
pref_service_.registry());
- std::unique_ptr<subresource_filter::RulesetService> service(
- new TestRulesetService(&pref_service_, task_runner_,
- ruleset_service_dir_.GetPath()));
+ auto delegate =
+ base::MakeUnique<subresource_filter::ContentRulesetServiceDelegate>();
+ delegate->set_ruleset_service(base::MakeUnique<TestRulesetService>(
+ &pref_service_, task_runner_, delegate.get(),
+ ruleset_service_dir_.GetPath()));
- TestingBrowserProcess::GetGlobal()->SetRulesetService(std::move(service));
+ TestingBrowserProcess::GetGlobal()->SetRulesetService(std::move(delegate));
traits_.reset(new SubresourceFilterComponentInstallerTraits());
}
TestRulesetService* service() {
return static_cast<TestRulesetService*>(
TestingBrowserProcess::GetGlobal()
- ->subresource_filter_ruleset_service());
+ ->subresource_filter_ruleset_service_delegate()
+ ->ruleset_service());
}
void WriteStringToFile(const std::string data, const base::FilePath& path) {

Powered by Google App Engine
This is Rietveld 408576698