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

Side by Side Diff: sandbox/win/tests/common/controller.h

Issue 2513163002: Add unittest that sandbox::PolicyBase outlives child process. (Closed)
Patch Set: Created 4 years, 1 month 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 | « sandbox/win/src/policy_target_test.cc ('k') | sandbox/win/tests/common/controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_ 5 #ifndef SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_
6 #define SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_ 6 #define SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Any test that needs to spawn a child process needs to set this to false. 109 // Any test that needs to spawn a child process needs to set this to false.
110 void SetDisableCsrss(bool disable_csrss) { disable_csrss_ = disable_csrss; } 110 void SetDisableCsrss(bool disable_csrss) { disable_csrss_ = disable_csrss; }
111 111
112 // Sets the desired state for the test to run. 112 // Sets the desired state for the test to run.
113 void SetTestState(SboxTestsState desired_state); 113 void SetTestState(SboxTestsState desired_state);
114 114
115 // Sets a flag whether the process should be killed when the TestRunner is 115 // Sets a flag whether the process should be killed when the TestRunner is
116 // destroyed. 116 // destroyed.
117 void SetKillOnDestruction(bool value) { kill_on_destruction_ = value; } 117 void SetKillOnDestruction(bool value) { kill_on_destruction_ = value; }
118 118
119 // Sets whether the TargetPolicy should be released after the child process
120 // is launched while the test is running.
121 void SetReleasePolicyInRun(bool value) { release_policy_in_run_ = value; }
122
119 // Returns the pointers to the policy object. It can be used to modify 123 // Returns the pointers to the policy object. It can be used to modify
120 // the policy manually. 124 // the policy manually.
121 TargetPolicy* GetPolicy(); 125 TargetPolicy* GetPolicy();
122 126
123 BrokerServices* broker() { return broker_; } 127 BrokerServices* broker() { return broker_; }
124 128
125 // Returns the process handle for an asynchronous test. 129 // Returns the process handle for an asynchronous test.
126 HANDLE process() { return target_process_.Get(); } 130 HANDLE process() { return target_process_.Get(); }
127 131
128 // Returns the process ID for an asynchronous test. 132 // Returns the process ID for an asynchronous test.
(...skipping 11 matching lines...) Expand all
140 144
141 BrokerServices* broker_; 145 BrokerServices* broker_;
142 TargetPolicy* policy_; 146 TargetPolicy* policy_;
143 DWORD timeout_; 147 DWORD timeout_;
144 SboxTestsState state_; 148 SboxTestsState state_;
145 bool is_init_; 149 bool is_init_;
146 bool is_async_; 150 bool is_async_;
147 bool no_sandbox_; 151 bool no_sandbox_;
148 bool disable_csrss_; 152 bool disable_csrss_;
149 bool kill_on_destruction_; 153 bool kill_on_destruction_;
154 bool release_policy_in_run_ = false;
150 base::win::ScopedHandle target_process_; 155 base::win::ScopedHandle target_process_;
151 DWORD target_process_id_; 156 DWORD target_process_id_;
152 }; 157 };
153 158
154 // Returns the broker services. 159 // Returns the broker services.
155 BrokerServices* GetBroker(); 160 BrokerServices* GetBroker();
156 161
157 // Constructs a full path to a file inside the system32 folder. 162 // Constructs a full path to a file inside the system32 folder.
158 base::string16 MakePathToSys32(const wchar_t* name, bool is_obj_man_path); 163 base::string16 MakePathToSys32(const wchar_t* name, bool is_obj_man_path);
159 164
160 // Constructs a full path to a file inside the syswow64 folder. 165 // Constructs a full path to a file inside the syswow64 folder.
161 base::string16 MakePathToSysWow64(const wchar_t* name, bool is_obj_man_path); 166 base::string16 MakePathToSysWow64(const wchar_t* name, bool is_obj_man_path);
162 167
163 // Constructs a full path to a file inside the system32 (or syswow64) folder 168 // Constructs a full path to a file inside the system32 (or syswow64) folder
164 // depending on whether process is running in wow64 or not. 169 // depending on whether process is running in wow64 or not.
165 base::string16 MakePathToSys(const wchar_t* name, bool is_obj_man_path); 170 base::string16 MakePathToSys(const wchar_t* name, bool is_obj_man_path);
166 171
167 // Runs the given test on the target process. 172 // Runs the given test on the target process.
168 int DispatchCall(int argc, wchar_t **argv); 173 int DispatchCall(int argc, wchar_t **argv);
169 174
170 } // namespace sandbox 175 } // namespace sandbox
171 176
172 #endif // SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_ 177 #endif // SANDBOX_WIN_TESTS_COMMON_CONTROLLER_H_
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_target_test.cc ('k') | sandbox/win/tests/common/controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698