OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "test/multiprocess_exec.h" | 15 #include "test/multiprocess_exec.h" |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "gtest/gtest.h" | 19 #include "gtest/gtest.h" |
20 #include "test/win/child_launcher.h" | 20 #include "util/win/command_line.h" |
21 | 21 |
22 namespace crashpad { | 22 namespace crashpad { |
23 namespace test { | 23 namespace test { |
24 | 24 |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 struct MultiprocessInfo { | 27 struct MultiprocessInfo { |
28 MultiprocessInfo() {} | 28 MultiprocessInfo() {} |
29 ScopedFileHANDLE pipe_c2p_read; | 29 ScopedFileHANDLE pipe_c2p_read; |
30 ScopedFileHANDLE pipe_c2p_write; | 30 ScopedFileHANDLE pipe_c2p_write; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 MultiprocessExec::~MultiprocessExec() { | 113 MultiprocessExec::~MultiprocessExec() { |
114 } | 114 } |
115 | 115 |
116 void MultiprocessExec::PreFork() { | 116 void MultiprocessExec::PreFork() { |
117 ASSERT_FALSE(command_.empty()); | 117 ASSERT_FALSE(command_.empty()); |
118 | 118 |
119 command_line_.clear(); | 119 command_line_.clear(); |
120 AppendCommandLineArgument(base::UTF8ToUTF16(command_), &command_line_); | 120 AppendCommandLineArgument(base::UTF8ToUTF16(command_), &command_line_); |
121 for (size_t i = 0; i < arguments_.size(); ++i) { | 121 for (size_t i = 0; i < arguments_.size(); ++i) { |
122 command_line_ += L" "; | |
123 AppendCommandLineArgument(base::UTF8ToUTF16(arguments_[i]), &command_line_); | 122 AppendCommandLineArgument(base::UTF8ToUTF16(arguments_[i]), &command_line_); |
124 } | 123 } |
125 | 124 |
126 // Make pipes for child-to-parent and parent-to-child communication. Mark them | 125 // Make pipes for child-to-parent and parent-to-child communication. Mark them |
127 // as inheritable via the SECURITY_ATTRIBUTES, but use SetHandleInformation to | 126 // as inheritable via the SECURITY_ATTRIBUTES, but use SetHandleInformation to |
128 // ensure that the parent sides are not inherited. | 127 // ensure that the parent sides are not inherited. |
129 ASSERT_EQ(nullptr, info()); | 128 ASSERT_EQ(nullptr, info()); |
130 set_info(new internal::MultiprocessInfo()); | 129 set_info(new internal::MultiprocessInfo()); |
131 | 130 |
132 SECURITY_ATTRIBUTES security_attributes = {0}; | 131 SECURITY_ATTRIBUTES security_attributes = {0}; |
(...skipping 27 matching lines...) Expand all Loading... |
160 TRUE, | 159 TRUE, |
161 0, | 160 0, |
162 nullptr, | 161 nullptr, |
163 nullptr, | 162 nullptr, |
164 &startup_info, | 163 &startup_info, |
165 &info()->process_info)); | 164 &info()->process_info)); |
166 } | 165 } |
167 | 166 |
168 } // namespace test | 167 } // namespace test |
169 } // namespace crashpad | 168 } // namespace crashpad |
OLD | NEW |