Fix recording of "Time to error histograms".
[chromium-blink-merge.git] / sandbox / win / BUILD.gn
blobf707b7ef7f8d514f710395ac5f66cc6a3cd80847
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//testing/test.gni")
7 source_set("sandbox") {
8   sources = [
9     "src/acl.cc",
10     "src/acl.h",
11     "src/app_container.cc",
12     "src/app_container.h",
13     "src/broker_services.cc",
14     "src/broker_services.h",
15     "src/crosscall_client.h",
16     "src/crosscall_params.h",
17     "src/crosscall_server.cc",
18     "src/crosscall_server.h",
19     "src/eat_resolver.cc",
20     "src/eat_resolver.h",
21     "src/filesystem_dispatcher.cc",
22     "src/filesystem_dispatcher.h",
23     "src/filesystem_interception.cc",
24     "src/filesystem_interception.h",
25     "src/filesystem_policy.cc",
26     "src/filesystem_policy.h",
27     "src/handle_closer.cc",
28     "src/handle_closer.h",
29     "src/handle_closer_agent.cc",
30     "src/handle_closer_agent.h",
31     "src/handle_dispatcher.cc",
32     "src/handle_dispatcher.h",
33     "src/handle_interception.cc",
34     "src/handle_interception.h",
35     "src/handle_policy.cc",
36     "src/handle_policy.h",
37     "src/interception.cc",
38     "src/interception.h",
39     "src/interception_agent.cc",
40     "src/interception_agent.h",
41     "src/interception_internal.h",
42     "src/interceptors.h",
43     "src/internal_types.h",
44     "src/ipc_tags.h",
45     "src/job.cc",
46     "src/job.h",
47     "src/named_pipe_dispatcher.cc",
48     "src/named_pipe_dispatcher.h",
49     "src/named_pipe_interception.cc",
50     "src/named_pipe_interception.h",
51     "src/named_pipe_policy.cc",
52     "src/named_pipe_policy.h",
53     "src/nt_internals.h",
54     "src/policy_broker.cc",
55     "src/policy_broker.h",
56     "src/policy_engine_opcodes.cc",
57     "src/policy_engine_opcodes.h",
58     "src/policy_engine_params.h",
59     "src/policy_engine_processor.cc",
60     "src/policy_engine_processor.h",
61     "src/policy_low_level.cc",
62     "src/policy_low_level.h",
63     "src/policy_params.h",
64     "src/policy_target.cc",
65     "src/policy_target.h",
66     "src/process_mitigations.cc",
67     "src/process_mitigations.h",
68     "src/process_mitigations_win32k_dispatcher.cc",
69     "src/process_mitigations_win32k_dispatcher.h",
70     "src/process_mitigations_win32k_interception.cc",
71     "src/process_mitigations_win32k_interception.h",
72     "src/process_mitigations_win32k_policy.cc",
73     "src/process_mitigations_win32k_policy.h",
74     "src/process_thread_dispatcher.cc",
75     "src/process_thread_dispatcher.h",
76     "src/process_thread_interception.cc",
77     "src/process_thread_interception.h",
78     "src/process_thread_policy.cc",
79     "src/process_thread_policy.h",
80     "src/registry_dispatcher.cc",
81     "src/registry_dispatcher.h",
82     "src/registry_interception.cc",
83     "src/registry_interception.h",
84     "src/registry_policy.cc",
85     "src/registry_policy.h",
86     "src/resolver.cc",
87     "src/resolver.h",
88     "src/restricted_token.cc",
89     "src/restricted_token.h",
90     "src/restricted_token_utils.cc",
91     "src/restricted_token_utils.h",
92     "src/sandbox.cc",
93     "src/sandbox.h",
94     "src/sandbox_factory.h",
95     "src/sandbox_globals.cc",
96     "src/sandbox_nt_types.h",
97     "src/sandbox_nt_util.cc",
98     "src/sandbox_nt_util.h",
99     "src/sandbox_policy.h",
100     "src/sandbox_policy_base.cc",
101     "src/sandbox_policy_base.h",
102     "src/sandbox_types.h",
103     "src/sandbox_utils.cc",
104     "src/sandbox_utils.h",
105     "src/security_level.h",
106     "src/service_resolver.cc",
107     "src/service_resolver.h",
108     "src/shared_handles.cc",
109     "src/shared_handles.h",
110     "src/sharedmem_ipc_client.cc",
111     "src/sharedmem_ipc_client.h",
112     "src/sharedmem_ipc_server.cc",
113     "src/sharedmem_ipc_server.h",
114     "src/sid.cc",
115     "src/sid.h",
116     "src/sync_dispatcher.cc",
117     "src/sync_dispatcher.h",
118     "src/sync_interception.cc",
119     "src/sync_interception.h",
120     "src/sync_policy.cc",
121     "src/sync_policy.h",
122     "src/target_interceptions.cc",
123     "src/target_interceptions.h",
124     "src/target_process.cc",
125     "src/target_process.h",
126     "src/target_services.cc",
127     "src/target_services.h",
128     "src/win2k_threadpool.cc",
129     "src/win2k_threadpool.h",
130     "src/win_utils.cc",
131     "src/win_utils.h",
132     "src/window.cc",
133     "src/window.h",
134   ]
136   if (current_cpu == "x64") {
137     sources += [
138       "src/Wow64_64.cc",
139       "src/interceptors_64.cc",
140       "src/interceptors_64.h",
141       "src/resolver_64.cc",
142       "src/service_resolver_64.cc",
143     ]
144   } else if (current_cpu == "x86") {
145     sources += [
146       "src/Wow64.cc",
147       "src/Wow64.h",
148       "src/resolver_32.cc",
149       "src/service_resolver_32.cc",
150       "src/sidestep/ia32_modrm_map.cpp",
151       "src/sidestep/ia32_opcode_map.cpp",
152       "src/sidestep/mini_disassembler.cpp",
153       "src/sidestep/mini_disassembler.h",
154       "src/sidestep/mini_disassembler_types.h",
155       "src/sidestep/preamble_patcher.h",
156       "src/sidestep/preamble_patcher_with_stub.cpp",
157       "src/sidestep_resolver.cc",
158       "src/sidestep_resolver.h",
159     ]
160   }
162   deps = [
163     "//base",
164     "//base:base_static",
165   ]
166   if (current_cpu == "x86") {
167     deps += [ ":copy_wow_helper" ]
168   }
171 if (current_cpu == "x86") {
172   # Make a target that copies the wow_helper files to the out dir.
173   #
174   # TODO(brettw) we can probably just build this now that we have proper
175   # toolchain support.
176   copy("copy_wow_helper") {
177     sources = [
178       "wow_helper/wow_helper.exe",
179       "wow_helper/wow_helper.pdb",
180     ]
181     outputs = [
182       "$root_out_dir/{{source_file_part}}",
183     ]
184   }
187 test("sbox_integration_tests") {
188   sources = [
189     "src/address_sanitizer_test.cc",
190     "src/app_container_test.cc",
191     "src/file_policy_test.cc",
192     "src/handle_closer_test.cc",
193     "src/handle_inheritance_test.cc",
194     "src/handle_policy_test.cc",
195     "src/integrity_level_test.cc",
196     "src/ipc_ping_test.cc",
197     "src/named_pipe_policy_test.cc",
198     "src/policy_target_test.cc",
199     "src/process_mitigations_test.cc",
200     "src/process_policy_test.cc",
201     "src/registry_policy_test.cc",
202     "src/sync_policy_test.cc",
203     "src/sync_policy_test.h",
204     "src/unload_dll_test.cc",
205     "tests/common/controller.cc",
206     "tests/common/controller.h",
207     "tests/common/test_utils.cc",
208     "tests/common/test_utils.h",
209     "tests/integration_tests/integration_tests.cc",
210     "tests/integration_tests/integration_tests_test.cc",
211   ]
213   deps = [
214     ":sandbox",
215     "//base/test:test_support",
216     "//testing/gtest",
217   ]
220 test("sbox_validation_tests") {
221   sources = [
222     "tests/common/controller.cc",
223     "tests/common/controller.h",
224     "tests/validation_tests/commands.cc",
225     "tests/validation_tests/commands.h",
226     "tests/validation_tests/suite.cc",
227     "tests/validation_tests/unit_tests.cc",
228   ]
230   deps = [
231     ":sandbox",
232     "//base/test:test_support",
233     "//testing/gtest",
234   ]
237 test("sbox_unittests") {
238   sources = [
239     "src/app_container_unittest.cc",
240     "src/interception_unittest.cc",
241     "src/ipc_unittest.cc",
242     "src/job_unittest.cc",
243     "src/policy_engine_unittest.cc",
244     "src/policy_low_level_unittest.cc",
245     "src/policy_opcodes_unittest.cc",
246     "src/restricted_token_unittest.cc",
247     "src/service_resolver_unittest.cc",
248     "src/sid_unittest.cc",
249     "src/threadpool_unittest.cc",
250     "src/win_utils_unittest.cc",
251     "tests/common/test_utils.cc",
252     "tests/common/test_utils.h",
253     "tests/unit_tests/unit_tests.cc",
254   ]
256   deps = [
257     ":sandbox",
258     "//base/test:test_support",
259     "//testing/gtest",
260   ]
263 test("sandbox_poc") {
264   sources = [
265     "sandbox_poc/main_ui_window.cc",
266     "sandbox_poc/main_ui_window.h",
267     "sandbox_poc/resource.h",
268     "sandbox_poc/sandbox.cc",
269     "sandbox_poc/sandbox.h",
270     "sandbox_poc/sandbox.ico",
271     "sandbox_poc/sandbox.rc",
272   ]
274   configs -= [ "//build/config/win:console" ]
275   configs += [ "//build/config/win:windowed" ]
277   libs = [ "comctl32.lib" ]
279   deps = [
280     ":sandbox",
281     ":pocdll",
282   ]
285 shared_library("pocdll") {
286   sources = [
287     "sandbox_poc/pocdll/exports.h",
288     "sandbox_poc/pocdll/fs.cc",
289     "sandbox_poc/pocdll/handles.cc",
290     "sandbox_poc/pocdll/invasive.cc",
291     "sandbox_poc/pocdll/network.cc",
292     "sandbox_poc/pocdll/pocdll.cc",
293     "sandbox_poc/pocdll/processes_and_threads.cc",
294     "sandbox_poc/pocdll/registry.cc",
295     "sandbox_poc/pocdll/spyware.cc",
296     "sandbox_poc/pocdll/utils.h",
297   ]
299   defines = [ "POCDLL_EXPORTS" ]