xref: /aosp_15_r20/external/cronet/base/process/launch_unittest_win.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/process/launch.h"
6 
7 #include "base/command_line.h"
8 #include "base/files/file_path.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace base {
12 
TEST(LaunchWinTest,GetAppOutputWithExitCodeShouldReturnExitCode)13 TEST(LaunchWinTest, GetAppOutputWithExitCodeShouldReturnExitCode) {
14   CommandLine cl(FilePath(FILE_PATH_LITERAL("cmd")));
15   cl.AppendArg("/c");
16   cl.AppendArg("this-is-not-an-application");
17   std::string output;
18   int exit_code;
19   ASSERT_TRUE(GetAppOutputWithExitCode(cl, &output, &exit_code));
20   ASSERT_TRUE(output.empty());
21   ASSERT_EQ(1, exit_code);
22 }
23 
24 }  // namespace
25