Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: test/win/child_launcher.h

Issue 1352323002: win: Make reading NT_IMAGE_HEADERS work cross-bitness (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@cleanup-crashpad-info
Patch Set: fixes2 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/test.gyp ('k') | test/win/child_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_TEST_WIN_CHILD_LAUNCHER_H_
16 #define CRASHPAD_TEST_WIN_CHILD_LAUNCHER_H_
17
18 #include <windows.h>
19
20 #include <string>
21
22 #include "util/win/scoped_handle.h"
23
24 namespace crashpad {
25 namespace test {
26
27 //! \brief Creates a child process for testing. Uses gtest `ASSERT_*` to
28 //! indicate failure. The child's output is passed through a pipe and is
29 //! available via stdout_read_handle().
30 class ChildLauncher {
31 public:
32 //! \brief Creates the object. \a executable will be escaped and prepended to
33 //! \a command_line to build the command line of the child.
34 ChildLauncher(const std::wstring& executable,
35 const std::wstring& command_line);
36
37 ~ChildLauncher();
38
39 //! \brief Starts the child process, after which the handle functions below
40 //! will be valid.
41 void Start();
42
43 //! \brief The child process's `HANDLE`.
44 HANDLE process_handle() const { return process_handle_.get(); }
45
46 //! \brief The child process's main thread's `HANDLE`.
47 HANDLE main_thread_handle() const { return main_thread_handle_.get(); }
48
49 //! \brief The read end of a pipe attached to the child's stdout.
50 HANDLE stdout_read_handle() const { return stdout_read_handle_.get(); }
51
52 private:
53 std::wstring executable_;
54 std::wstring command_line_;
55 ScopedKernelHANDLE process_handle_;
56 ScopedKernelHANDLE main_thread_handle_;
57 ScopedFileHANDLE stdout_read_handle_;
58 };
59
60 //! \brief Utility function for building escaped command lines.
61 //!
62 //! \param[in] argument Appended to \a command_line surrounded by properly
63 //! escaped quotation marks, if necessary.
64 //! \param[inout] command_line The command line being constructed.
65 void AppendCommandLineArgument(const std::wstring& argument,
66 std::wstring* command_line);
67
68 } // namespace test
69 } // namespace crashpad
70
71 #endif // CRASHPAD_TEST_WIN_CHILD_LAUNCHER_H_
OLDNEW
« no previous file with comments | « test/test.gyp ('k') | test/win/child_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698