Verify that gin_shell and hello_world.js exist.

This issue: https://code.google.com/p/chromium/issues/detail?id=398549,
was difficult to debug because gin/shell/gin_shell_unittest.cc didn't verify
that its input files existed before forging ahead.

The unit test now verifies that the gin_shell and hello_world.js paths
exist before launching the former and loading the latter.


BUG=398549

Review URL: https://codereview.chromium.org/471623002

Cr-Commit-Position: refs/heads/master@{#289599}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289599 0039d316-1c4b-4281-b951-d872f2087c98
parent 480bf75a
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -25,8 +25,13 @@ base::FilePath HelloWorldPath() { ...@@ -25,8 +25,13 @@ base::FilePath HelloWorldPath() {
} }
TEST(GinShellTest, HelloWorld) { TEST(GinShellTest, HelloWorld) {
CommandLine cmd(GinShellPath()); base::FilePath gin_shell_path(GinShellPath());
cmd.AppendArgPath(HelloWorldPath()); base::FilePath hello_world_path(HelloWorldPath());
ASSERT_TRUE(base::PathExists(gin_shell_path));
ASSERT_TRUE(base::PathExists(hello_world_path));
CommandLine cmd(gin_shell_path);
cmd.AppendArgPath(hello_world_path);
std::string output; std::string output;
ASSERT_TRUE(base::GetAppOutput(cmd, &output)); ASSERT_TRUE(base::GetAppOutput(cmd, &output));
base::TrimWhitespaceASCII(output, base::TRIM_ALL, &output); base::TrimWhitespaceASCII(output, base::TRIM_ALL, &output);
......
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