1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/files/file_path.h"
7 #include "base/path_service.h"
8 #include "base/process/launch.h"
9 #include "base/strings/string_util.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 base::FilePath
GinShellPath() {
14 PathService::Get(base::DIR_EXE
, &dir
);
15 return dir
.AppendASCII("gin_shell");
18 base::FilePath
HelloWorldPath() {
20 PathService::Get(base::DIR_SOURCE_ROOT
, &path
);
24 .AppendASCII("hello_world.js");
27 TEST(GinShellTest
, HelloWorld
) {
28 CommandLine
cmd(GinShellPath());
29 cmd
.AppendArgPath(HelloWorldPath());
31 ASSERT_TRUE(base::GetAppOutput(cmd
, &output
));
32 base::TrimWhitespaceASCII(output
, base::TRIM_ALL
, &output
);
33 ASSERT_EQ("Hello World", output
);