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/kill.h" | 10 #include "base/process/kill.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 MULTIPROCESS_TEST_MAIN(ReturnSeven) { | 39 MULTIPROCESS_TEST_MAIN(ReturnSeven) { |
40 return 7; | 40 return 7; |
41 } | 41 } |
42 | 42 |
43 MULTIPROCESS_TEST_MAIN(ReturnNine) { | 43 MULTIPROCESS_TEST_MAIN(ReturnNine) { |
44 return 9; | 44 return 9; |
45 } | 45 } |
46 | 46 |
47 void ScopedProcessInformationTest::DoCreateProcess( | 47 void ScopedProcessInformationTest::DoCreateProcess( |
48 const std::string& main_id, PROCESS_INFORMATION* process_handle) { | 48 const std::string& main_id, PROCESS_INFORMATION* process_handle) { |
49 std::wstring cmd_line = | 49 std::wstring cmd_line = MakeCmdLine(main_id).GetCommandLineString(); |
50 this->MakeCmdLine(main_id, false).GetCommandLineString(); | |
51 STARTUPINFO startup_info = {}; | 50 STARTUPINFO startup_info = {}; |
52 startup_info.cb = sizeof(startup_info); | 51 startup_info.cb = sizeof(startup_info); |
53 | 52 |
54 EXPECT_TRUE(::CreateProcess(NULL, | 53 EXPECT_TRUE(::CreateProcess(NULL, |
55 const_cast<wchar_t*>(cmd_line.c_str()), | 54 const_cast<wchar_t*>(cmd_line.c_str()), |
56 NULL, NULL, false, 0, NULL, NULL, | 55 NULL, NULL, false, 0, NULL, NULL, |
57 &startup_info, process_handle)); | 56 &startup_info, process_handle)); |
58 } | 57 } |
59 | 58 |
60 TEST_F(ScopedProcessInformationTest, InitiallyInvalid) { | 59 TEST_F(ScopedProcessInformationTest, InitiallyInvalid) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 157 |
159 base::win::ScopedProcessInformation process_info; | 158 base::win::ScopedProcessInformation process_info; |
160 process_info.Set(base_struct); | 159 process_info.Set(base_struct); |
161 | 160 |
162 EXPECT_EQ(kProcessId, process_info.process_id()); | 161 EXPECT_EQ(kProcessId, process_info.process_id()); |
163 EXPECT_EQ(kThreadId, process_info.thread_id()); | 162 EXPECT_EQ(kThreadId, process_info.thread_id()); |
164 EXPECT_EQ(kProcessHandle, process_info.process_handle()); | 163 EXPECT_EQ(kProcessHandle, process_info.process_handle()); |
165 EXPECT_EQ(kThreadHandle, process_info.thread_handle()); | 164 EXPECT_EQ(kThreadHandle, process_info.thread_handle()); |
166 base_struct = process_info.Take(); | 165 base_struct = process_info.Take(); |
167 } | 166 } |
OLD | NEW |