Commit c5e504d9 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot
Browse files

base::TestSuite: Obey --{en,dis}able-features=.. command line arguments.

base::TestSuite currently calls base::FeatureList::InitFromCommandLine()
with empty strings. There's a TODO to use the actual command line.

To fix, move switches::k{En,Dis}ableFeatures from content_switches.h
to base_switches.h and pass the args to InitFromCommandLine().

TBR=boliu@chromium.org, halliwell@chromium.org, bengr@chromium.org

Bug: 778492
Change-Id: I988e5aad6dc926c7f9d783766c4a35275154fbee
Reviewed-on: https://chromium-review.googlesource.com/738013


Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512005}
parent 75ad6852
......@@ -16,7 +16,6 @@
#include "components/prefs/pref_service_factory.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/pref_names.h"
#include "content/public/common/content_switches.h"
namespace android_webview {
namespace {
......
......@@ -6,12 +6,12 @@
#include <vector>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "content/public/common/content_switches.h"
using std::string;
using std::vector;
......
......@@ -4,10 +4,10 @@
#include "android_webview/browser/command_line_helper.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "content/public/common/content_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
using testing::Test;
......
......@@ -10,11 +10,17 @@ namespace switches {
// Disables the crash reporting.
const char kDisableBreakpad[] = "disable-breakpad";
// Comma-separated list of feature names to disable. See also kEnableFeatures.
const char kDisableFeatures[] = "disable-features";
// Indicates that crash reporting should be enabled. On platforms where helper
// processes cannot access to files needed to make this decision, this flag is
// generated internally.
const char kEnableCrashReporter[] = "enable-crash-reporter";
// Comma-separated list of feature names to enable. See also kDisableFeatures.
const char kEnableFeatures[] = "enable-features";
// Makes memory allocators keep track of their allocations and context, so a
// detailed breakdown of memory usage can be presented in chrome://tracing when
// the memory-infra category is enabled.
......
......@@ -12,8 +12,10 @@
namespace switches {
extern const char kDisableBreakpad[];
extern const char kDisableFeatures[];
extern const char kDisableLowEndDeviceMode[];
extern const char kEnableCrashReporter[];
extern const char kEnableFeatures[];
extern const char kEnableHeapProfiling[];
extern const char kEnableHeapProfilingModePseudo[];
extern const char kEnableHeapProfilingModeNative[];
......
......@@ -336,15 +336,17 @@ void TestSuite::SuppressErrorDialogs() {
}
void TestSuite::Initialize() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
#if !defined(OS_IOS)
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWaitForDebugger)) {
if (command_line->HasSwitch(switches::kWaitForDebugger)) {
debug::WaitForDebugger(60, true);
}
#endif
// Set up a FeatureList instance, so that code using that API will not hit a
// an error that it's not set. It will be cleared automatically.
// TODO(chaopeng) Should load the actually features in command line here.
scoped_feature_list_.InitFromCommandLine(std::string(), std::string());
scoped_feature_list_.InitFromCommandLine(
command_line->GetSwitchValueASCII(switches::kEnableFeatures),
command_line->GetSwitchValueASCII(switches::kDisableFeatures));
#if defined(OS_IOS)
InitIOSTestMessageLoop();
......@@ -364,7 +366,7 @@ void TestSuite::Initialize() {
// In some cases, we do not want to see standard error dialogs.
if (!debug::BeingDebugged() &&
!CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) {
!command_line->HasSwitch("show-error-dialogs")) {
SuppressErrorDialogs();
debug::SetSuppressDebugUI(true);
assert_handler_ = std::make_unique<logging::ScopedLogAssertHandler>(
......
......@@ -9,6 +9,7 @@
#include <set>
#include <utility>
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
......
......@@ -8,6 +8,7 @@
#include <utility>
#include <vector>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
......@@ -58,7 +59,6 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/referrer.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/download_test_observer.h"
......
......@@ -22,7 +22,7 @@
#include "content/public/test/mock_download_item.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.cc"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/blocked_content/safe_browsing_triggered_popup_blocker.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "chrome/browser/ui/blocked_content/safe_browsing_triggered_popup_blocker.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
......@@ -29,7 +30,6 @@
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/url_pattern_index/proto/rules.pb.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
......
......@@ -9,6 +9,7 @@
#include <string>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
......
......@@ -5,7 +5,6 @@
#ifndef COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SWITCHES_H_
#define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SWITCHES_H_
#include "base/base_switches.h"
#include "base/command_line.h"
namespace switches {
......
......@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "components/ukm/content/source_url_recorder.h"
#include "components/ukm/test_ukm_recorder.h"
#include "components/ukm/ukm_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/navigation_handle_observer.h"
......
......@@ -121,9 +121,6 @@ const char kDisableWebGL[] = "disable-webgl";
// Disable WebGL2.
const char kDisableWebGL2[] = "disable-webgl2";
// Comma-separated list of feature names to disable. See also kEnableFeatures.
const char kDisableFeatures[] = "disable-features";
// Disable FileSystem API.
const char kDisableFileSystem[] = "disable-file-system";
......@@ -374,9 +371,6 @@ const char kEnableExperimentalWebPlatformFeatures[] =
const char kDisableOriginTrialControlledBlinkFeatures[] =
"disable-origin-trial-controlled-blink-features";
// Comma-separated list of feature names to enable. See also kDisableFeatures.
const char kEnableFeatures[] = "enable-features";
// Makes the GL worker context run asynchronously by using a separate stream.
const char kEnableGpuAsyncWorkerContext[] = "enable-gpu-async-worker-context";
......
......@@ -48,7 +48,6 @@ CONTENT_EXPORT extern const char kDisableDisplayList2dCanvas[];
extern const char kDisableDomainBlockingFor3DAPIs[];
CONTENT_EXPORT extern const char kDisableWebGL[];
CONTENT_EXPORT extern const char kDisableWebGL2[];
CONTENT_EXPORT extern const char kDisableFeatures[];
CONTENT_EXPORT extern const char kDisableFileSystem[];
CONTENT_EXPORT extern const char kDisableFlash3d[];
CONTENT_EXPORT extern const char kDisableFlashStage3d[];
......@@ -118,7 +117,6 @@ CONTENT_EXPORT extern const char kEnableDisplayList2dCanvas[];
CONTENT_EXPORT extern const char kEnableDistanceFieldText[];
CONTENT_EXPORT extern const char kEnableExperimentalCanvasFeatures[];
CONTENT_EXPORT extern const char kEnableExperimentalWebPlatformFeatures[];
CONTENT_EXPORT extern const char kEnableFeatures[];
CONTENT_EXPORT extern const char kEnableGpuAsyncWorkerContext[];
CONTENT_EXPORT extern const char kEnableGpuMemoryBufferCompositorResources[];
CONTENT_EXPORT extern const char kEnableGpuMemoryBufferVideoFrames[];
......
......@@ -6,6 +6,7 @@
#include <stddef.h>
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
......
......@@ -6,6 +6,7 @@
#include <utility>
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment