OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/test/multiprocess_test.h" | 11 #include "base/test/multiprocess_test.h" |
12 #include "base/win/scoped_process_information.h" | 12 #include "base/win/scoped_process_information.h" |
13 #include "testing/multiprocess_func_list.h" | 13 #include "testing/multiprocess_func_list.h" |
14 | 14 |
15 class ScopedProcessInformationTest : public base::MultiProcessTest { | 15 class ScopedProcessInformationTest : public base::MultiProcessTest { |
16 protected: | 16 protected: |
17 void DoCreateProcess(const std::string& main_id, | 17 void DoCreateProcess(const std::string& main_id, |
18 PROCESS_INFORMATION* process_handle); | 18 PROCESS_INFORMATION* process_handle); |
19 }; | 19 }; |
20 | 20 |
21 MULTIPROCESS_TEST_MAIN(ReturnSeven) { | 21 MULTIPROCESS_TEST_MAIN(ReturnSeven, NULL) { |
22 return 7; | 22 return 7; |
23 } | 23 } |
24 | 24 |
25 MULTIPROCESS_TEST_MAIN(ReturnNine) { | 25 MULTIPROCESS_TEST_MAIN(ReturnNine, NULL) { |
26 return 9; | 26 return 9; |
27 } | 27 } |
28 | 28 |
29 void ScopedProcessInformationTest::DoCreateProcess( | 29 void ScopedProcessInformationTest::DoCreateProcess( |
30 const std::string& main_id, PROCESS_INFORMATION* process_handle) { | 30 const std::string& main_id, PROCESS_INFORMATION* process_handle) { |
31 std::wstring cmd_line = | 31 std::wstring cmd_line = |
32 this->MakeCmdLine(main_id, false).GetCommandLineString(); | 32 this->MakeCmdLine(main_id, false).GetCommandLineString(); |
33 STARTUPINFO startup_info = {}; | 33 STARTUPINFO startup_info = {}; |
34 startup_info.cb = sizeof(startup_info); | 34 startup_info.cb = sizeof(startup_info); |
35 | 35 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 ASSERT_TRUE(base::WaitForExitCode(nine_to_seven_info.TakeProcessHandle(), | 172 ASSERT_TRUE(base::WaitForExitCode(nine_to_seven_info.TakeProcessHandle(), |
173 &exit_code)); | 173 &exit_code)); |
174 ASSERT_EQ(7, exit_code); | 174 ASSERT_EQ(7, exit_code); |
175 | 175 |
176 } | 176 } |
177 | 177 |
178 TEST_F(ScopedProcessInformationTest, InitiallyInvalid) { | 178 TEST_F(ScopedProcessInformationTest, InitiallyInvalid) { |
179 base::win::ScopedProcessInformation process_info; | 179 base::win::ScopedProcessInformation process_info; |
180 ASSERT_FALSE(process_info.IsValid()); | 180 ASSERT_FALSE(process_info.IsValid()); |
181 } | 181 } |
OLD | NEW |