Provide core API permissions to extensions_unittests
[chromium-blink-merge.git] / sandbox / mac / BUILD.gn
blob3833b8a608af68e799c234be639367af555b57cb
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("//build/config/mac/mac_sdk.gni")
7 component("sandbox") {
8   sources = [
9     "bootstrap_sandbox.cc",
10     "bootstrap_sandbox.h",
11     "dispatch_source_mach.cc",
12     "dispatch_source_mach.h",
13     "launchd_interception_server.cc",
14     "launchd_interception_server.h",
15     "mach_message_server.cc",
16     "mach_message_server.h",
17     "message_server.h",
18     "os_compatibility.cc",
19     "os_compatibility.h",
20     "policy.cc",
21     "policy.h",
22     "xpc.cc",
23     "xpc.h",
24     "xpc_message_server.cc",
25     "xpc_message_server.h",
26   ]
28   defines = [ "SANDBOX_IMPLEMENTATION" ]
29   libs = [ "bsm" ]
31   deps = [
32     "//base",
33   ]
35   # When the build SDK is 10.6, generate a dynamic stub loader. When the
36   # SDK is higher, then libxpc.dylib will be loaded automatically as part
37   # of libSystem, and only forward declarations of private symbols are
38   # necessary.
39   if (mac_sdk_version == "10.6") {
40     deps += [ ":generate_stubs" ]
41   }
44 generate_stubs_script = "//tools/generate_stubs/generate_stubs.py"
45 generate_stubs_header = "xpc_stubs_header.fragment"
46 generate_stubs_sig_public = "xpc_stubs.sig"
47 generate_stubs_sig_private = "xpc_private_stubs.sig"
48 generate_stubs_project = "sandbox/mac"
49 generate_stubs_output_stem = "xpc_stubs"
51 action("generate_stubs") {
52   script = generate_stubs_script
53   sources = [ generate_stubs_sig_public, generate_stubs_sig_private ]
54   inputs = [ generate_stubs_header ]
55   outputs = [
56     "$target_gen_dir/$generate_stubs_output_stem.cc",
57     "$target_gen_dir/$generate_stubs_output_stem.h",
58   ]
59   args = [
60     "-i", rebase_path(target_gen_dir, root_build_dir),
61     "-o", rebase_path(target_gen_dir, root_build_dir),
62     "-t", "posix_stubs",
63     "-e", rebase_path(generate_stubs_header, root_build_dir),
64     "-s", generate_stubs_output_stem,
65     "-p", generate_stubs_project,
66     "-x", "SANDBOX_EXPORT",
67   ]
68   args += rebase_path(sources, root_build_dir)
71 test("sandbox_mac_unittests") {
72   sources = [
73     "bootstrap_sandbox_unittest.mm",
74     "dispatch_source_mach_unittest.cc",
75     "policy_unittest.cc",
76     "xpc_message_server_unittest.cc",
77   ]
79   libs = [
80     "CoreFoundation.framework",
81     "Foundation.framework",
82   ]
84   deps = [
85     ":sandbox",
86     "//base",
87     "//base/test:run_all_unittests",
88     "//testing/gtest",
89   ]