Chromium Code Reviews| Index: blimp/engine/app/blimp_engine_config.cc |
| diff --git a/blimp/engine/app/blimp_engine_config.cc b/blimp/engine/app/blimp_engine_config.cc |
| index ccbdc4e52ffbd9a6d007b50382dc0945f2a10f53..8eda1f3ffa694b4e13950f8e464dd84ec7fbd0df 100644 |
| --- a/blimp/engine/app/blimp_engine_config.cc |
| +++ b/blimp/engine/app/blimp_engine_config.cc |
| @@ -7,30 +7,52 @@ |
| #include <memory> |
| #include <string> |
| +#include "base/base_switches.h" |
| #include "base/command_line.h" |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/strings/string_util.h" |
| #include "blimp/engine/app/switches.h" |
| +#include "cc/base/switches.h" |
| +#include "content/public/common/content_switches.h" |
| +#include "ui/native_theme/native_theme_switches.h" |
| namespace blimp { |
| namespace engine { |
| namespace { |
| -// Gets the client token from the file provided by the command line. If a read |
| +// Gets the client token from the command line. Either from the token provided, |
| +// or from the file provided by the command line. If a file read |
| // does not succeed, or the switch is malformed, an empty string is returned. |
| std::string GetClientToken(const base::CommandLine& cmd_line) { |
| - std::string file_contents; |
| - const base::FilePath path = cmd_line.GetSwitchValuePath(kClientTokenPath); |
| - if (!base::ReadFileToString(path, &file_contents)) { |
| - LOG(ERROR) << "Could not read client token file at " |
| - << (path.empty() ? "(not provided)" : path.AsUTF8Unsafe()); |
| + std::string token; |
| + if (cmd_line.HasSwitch(kClientToken)) { |
|
Kevin M
2016/05/02 21:32:39
As this is just a test hook, I don't think it's ap
haibinlu
2016/05/03 19:32:43
reverted. per offline discussion, added a data fil
|
| + token = cmd_line.GetSwitchValueASCII(kClientToken); |
| + } else { |
| + DCHECK(cmd_line.HasSwitch(kClientTokenPath)); |
| + const base::FilePath path = cmd_line.GetSwitchValuePath(kClientTokenPath); |
| + if (!base::ReadFileToString(path, &token)) { |
| + LOG(ERROR) << "Could not read client token file at " |
| + << (path.empty() ? "(not provided)" : path.AsUTF8Unsafe()); |
| + } |
| } |
| - return base::CollapseWhitespaceASCII(file_contents, true); |
| + return base::CollapseWhitespaceASCII(token, true); |
| } |
| } // namespace |
| +void SetUpCommandLine(base::CommandLine* command_line) { |
| + command_line->AppendSwitch(::switches::kEnableOverlayScrollbar); |
| + command_line->AppendSwitch(cc::switches::kDisableCachedPictureRaster); |
| + command_line->AppendSwitch(::switches::kDisableGpu); |
| + command_line->AppendSwitch( |
| + "disable-remote-fonts"); // switches::kDisableRemoteFonts is not visible. |
| + command_line->AppendSwitch(::switches::kUseRemoteCompositing); |
| + command_line->AppendSwitchASCII( |
| + ::switches::kUseGL, |
| + "osmesa"); // Avoid invoking gpu::CollectDriverVersionNVidia. |
| +} |
| + |
| BlimpEngineConfig::~BlimpEngineConfig() {} |
| // static |