launch_unittest_win.cc 703 B

123456789101112131415161718192021222324
  1. // Copyright 2017 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.
  4. #include "base/process/launch.h"
  5. #include "base/command_line.h"
  6. #include "base/files/file_path.h"
  7. #include "testing/gtest/include/gtest/gtest.h"
  8. namespace base {
  9. TEST(LaunchWinTest, GetAppOutputWithExitCodeShouldReturnExitCode) {
  10. CommandLine cl(FilePath(FILE_PATH_LITERAL("cmd")));
  11. cl.AppendArg("/c");
  12. cl.AppendArg("this-is-not-an-application");
  13. std::string output;
  14. int exit_code;
  15. ASSERT_TRUE(GetAppOutputWithExitCode(cl, &output, &exit_code));
  16. ASSERT_TRUE(output.empty());
  17. ASSERT_EQ(1, exit_code);
  18. }
  19. } // namespace