diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 06:28:06 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 06:28:06 +0000 |
commit | b083ff9b8e003f5ba9045a2d076e5c805ff04e71 (patch) | |
tree | 0e99c32f86bcd3ad7a580ef0bdf840e89bb18f91 | |
parent | 51e5f41ba29879b161dc6789619beaf464c6d46c (diff) | |
download | chromium_src-b083ff9b8e003f5ba9045a2d076e5c805ff04e71.zip chromium_src-b083ff9b8e003f5ba9045a2d076e5c805ff04e71.tar.gz chromium_src-b083ff9b8e003f5ba9045a2d076e5c805ff04e71.tar.bz2 |
Parse blink platform log channel command line args in webkit unit tests.
This should make debugging webkit unit tests a bit easier.
R=jochen@chromium.org,japhet@chromium.org
BUG=None
Review URL: https://codereview.chromium.org/139783014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248877 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/public/common/content_switches.h | 2 | ||||
-rw-r--r-- | content/test/webkit_support.cc | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 9137507..fd30ee2 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -23,7 +23,7 @@ extern const char kAuditAllHandles[]; extern const char kAuditHandles[]; CONTENT_EXPORT extern const char kBlacklistAcceleratedCompositing[]; CONTENT_EXPORT extern const char kBlacklistWebGL[]; -extern const char kBlinkPlatformLogChannels[]; +CONTENT_EXPORT extern const char kBlinkPlatformLogChannels[]; CONTENT_EXPORT extern const char kBlockCrossSiteDocuments[]; CONTENT_EXPORT extern const char kBrowserAssertTest[]; CONTENT_EXPORT extern const char kBrowserCrashTest[]; diff --git a/content/test/webkit_support.cc b/content/test/webkit_support.cc index 73bfe00..50342eb 100644 --- a/content/test/webkit_support.cc +++ b/content/test/webkit_support.cc @@ -4,9 +4,14 @@ #include "content/test/webkit_support.h" +#include <string> + +#include "base/command_line.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/run_loop.h" +#include "base/strings/string_tokenizer.h" +#include "content/public/common/content_switches.h" #include "content/test/test_webkit_platform_support.h" #include "third_party/WebKit/public/web/WebCache.h" #include "third_party/WebKit/public/web/WebKit.h" @@ -29,6 +34,20 @@ namespace content { namespace { +void EnableBlinkPlatformLogChannels(const std::string& channels) { + if (channels.empty()) + return; + base::StringTokenizer t(channels, ", "); + while (t.GetNext()) + blink::enableLogChannel(t.token().c_str()); +} + +void ParseBlinkCommandLineArgumentsForUnitTests() { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + EnableBlinkPlatformLogChannels( + command_line.GetSwitchValueASCII(switches::kBlinkPlatformLogChannels)); +} + class TestEnvironment { public: #if defined(OS_ANDROID) @@ -72,6 +91,8 @@ TestEnvironment* test_environment; } // namespace void SetUpTestEnvironmentForUnitTests() { + ParseBlinkCommandLineArgumentsForUnitTests(); + blink::WebRuntimeFeatures::enableStableFeatures(true); blink::WebRuntimeFeatures::enableExperimentalFeatures(true); blink::WebRuntimeFeatures::enableTestOnlyFeatures(true); |