Add --log-file=PATH switch to more executables

The --log-file switch lets users specify the logging location. It was
added as a generic flag and implemented in app_shell in
crrev.com/c/647314.

This CL expands the switch to other logging configurers, notably
including chrome and content_shell.

In Chrome, --log-file=<PATH> will override the $CHROME_LOG_FILE
environmental variable if both are present.

Bug: 760431
Change-Id: I72448b1a8cdea5b5818badd340594a2f9d6d8cd2
Reviewed-on: https://chromium-review.googlesource.com/685997
Reviewed-by: Jochen Eisinger <[email protected]>
Commit-Queue: Michael Giuffrida <[email protected]>
Cr-Commit-Position: refs/heads/master@{#505287}
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc
index 5b35a99..b0acc96 100644
--- a/chrome/browser/chrome_content_browser_client_unittest.cc
+++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -346,9 +346,20 @@
 class ChromeContentBrowserClientGetLoggingFileTest : public testing::Test {};
 
 TEST_F(ChromeContentBrowserClientGetLoggingFileTest, GetLoggingFile) {
+  base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM);
   ChromeContentBrowserClient client;
   base::FilePath log_file_name;
-  EXPECT_FALSE(client.GetLoggingFileName().empty());
+  EXPECT_FALSE(client.GetLoggingFileName(cmd_line).empty());
+}
+
+TEST_F(ChromeContentBrowserClientGetLoggingFileTest,
+       GetLoggingFileFromCommandLine) {
+  base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM);
+  cmd_line.AppendSwitchASCII(switches::kLogFile, "test_log.txt");
+  ChromeContentBrowserClient client;
+  base::FilePath log_file_name;
+  EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("test_log.txt")).value(),
+            client.GetLoggingFileName(cmd_line).value());
 }
 
 class TestChromeContentBrowserClient : public ChromeContentBrowserClient {