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

Unified Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 2484613002: Migrate more tests to ScopedFeatureList. (Closed)
Patch Set: fix weakptrfactory must be last member error Created 4 years, 1 month 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: content/browser/loader/resource_dispatcher_host_unittest.cc
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index 7c1b850c061aecfd450274a2aecb76f99c808223..a1c9792cc5192ee1c6fafa63596f3f4a99512260 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
@@ -21,6 +20,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
+#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/child_process_security_policy_impl.h"
@@ -897,16 +897,12 @@ class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
web_contents_->GetRenderProcessHost()->GetID());
child_ids_.insert(web_contents_->GetRenderProcessHost()->GetID());
- base::FeatureList::ClearInstanceForTesting();
switch (GetParam()) {
case TestConfig::kDefault:
- base::FeatureList::InitializeInstance(std::string(), std::string());
break;
case TestConfig::kOptimizeIPCForSmallResourceEnabled: {
- std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
- feature_list->InitializeFromCommandLine(
- features::kOptimizeLoadingIPCForSmallResources.name, std::string());
- base::FeatureList::SetInstance(std::move(feature_list));
+ scoped_feature_list_.InitAndEnableFeature(
+ features::kOptimizeLoadingIPCForSmallResources);
ASSERT_TRUE(base::FeatureList::IsEnabled(
features::kOptimizeLoadingIPCForSmallResources));
break;
@@ -1132,6 +1128,7 @@ class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
std::unique_ptr<base::RunLoop> wait_for_request_complete_loop_;
RenderViewHostTestEnabler render_view_host_test_enabler_;
bool auto_advance_;
+ base::test::ScopedFeatureList scoped_feature_list_;
};
void ResourceDispatcherHostTest::MakeTestRequest(int render_view_id,

Powered by Google App Engine
This is Rietveld 408576698