OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/base/process_utils.h" | 5 #include "chromecast/base/process_utils.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace chromecast { | 8 namespace chromecast { |
9 | 9 |
10 // Verify that a simple process works as expected. | 10 // Verify that a simple process works as expected. |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Verify that false is returned when a command an error code. | 37 // Verify that false is returned when a command an error code. |
38 TEST(ProcessUtilsTest, ProcessReturnsError) { | 38 TEST(ProcessUtilsTest, ProcessReturnsError) { |
39 // Create a simple command. | 39 // Create a simple command. |
40 std::vector<std::string> args; | 40 std::vector<std::string> args; |
41 args.push_back("cd"); | 41 args.push_back("cd"); |
42 args.push_back("path/to/invalid/directory"); | 42 args.push_back("path/to/invalid/directory"); |
43 args.push_back("2>&1"); // Pipe the stderr into stdout. | 43 args.push_back("2>&1"); // Pipe the stderr into stdout. |
44 | 44 |
45 // Execute the command and collect the output. Verify that the output of the | 45 // Execute the command and collect the output. Verify that the output of the |
46 // process is collected, even when the process returns an error code. | 46 // process is collected, even when the process returns an error code. |
47 std::string stderr; | 47 std::string stderr_result; |
48 ASSERT_FALSE(GetAppOutput(args, &stderr)); | 48 ASSERT_FALSE(GetAppOutput(args, &stderr_result)); |
49 ASSERT_FALSE(stderr.empty()); | 49 ASSERT_FALSE(stderr_result.empty()); |
50 } | 50 } |
51 | 51 |
52 } // namespace chromecast | 52 } // namespace chromecast |
OLD | NEW |