OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 TEST(PythonUtils, PythonRunTime) { | 47 TEST(PythonUtils, PythonRunTime) { |
48 CommandLine cmd_line(CommandLine::NO_PROGRAM); | 48 CommandLine cmd_line(CommandLine::NO_PROGRAM); |
49 EXPECT_TRUE(GetPythonCommand(&cmd_line)); | 49 EXPECT_TRUE(GetPythonCommand(&cmd_line)); |
50 | 50 |
51 // Run a python command to print a string and make sure the output is what | 51 // Run a python command to print a string and make sure the output is what |
52 // we want. | 52 // we want. |
53 cmd_line.AppendArg("-c"); | 53 cmd_line.AppendArg("-c"); |
54 std::string input("PythonUtilsTest"); | 54 std::string input("PythonUtilsTest"); |
55 std::string python_cmd = StringPrintf("print '%s';", input.c_str()); | 55 std::string python_cmd = base::StringPrintf("print '%s';", input.c_str()); |
56 cmd_line.AppendArg(python_cmd); | 56 cmd_line.AppendArg(python_cmd); |
57 std::string output; | 57 std::string output; |
58 EXPECT_TRUE(base::GetAppOutput(cmd_line, &output)); | 58 EXPECT_TRUE(base::GetAppOutput(cmd_line, &output)); |
59 TrimWhitespace(output, TRIM_TRAILING, &output); | 59 TrimWhitespace(output, TRIM_TRAILING, &output); |
60 EXPECT_EQ(input, output); | 60 EXPECT_EQ(input, output); |
61 } | 61 } |
OLD | NEW |