Fix NPE in isHidingTopControlsEnabled where WebContents is null.
[chromium-blink-merge.git] / extensions / BUILD.gn
blobea66ab163f8cd73822fb0d9bd13a498758101bff
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("//extensions/extensions.gni")
6 import("//testing/test.gni")
7 import("//tools/grit/grit_rule.gni")
8 import("//tools/grit/repack.gni")
10 assert(enable_extensions)
12 # GYP version: extensions/extensions_resources.gyp:extensions_resources
13 group("extensions_resources") {
14   deps = [
15     ":extensions_browser_resources",
16     ":extensions_renderer_resources",
17     ":extensions_resources_grd",
18   ]
21 # GYP version: extensions/extensions_resources.gyp:extensions_resources
22 #              (extensions_resources action)
23 grit("extensions_resources_grd") {
24   source = "extensions_resources.grd"
25   outputs = [
26     "grit/extensions_resources.h",
27     "extensions_resources.pak",
28   ]
31 # GYP version: extensions/extensions_resources.gyp:extensions_resources
32 #              (extensions_browser_resources action)
33 grit("extensions_browser_resources") {
34   source = "browser/resources/extensions_browser_resources.grd"
35   outputs = [
36     "grit/extensions_browser_resources.h",
37     "grit/extensions_browser_resources_map.cc",
38     "grit/extensions_browser_resources_map.h",
39     "extensions_browser_resources_100_percent.pak",
40     "extensions_browser_resources_200_percent.pak",
41   ]
42   grit_flags = [
43     "-E",
44     "mojom_root=" + rebase_path(root_gen_dir),
45   ]
48 # GYP version: extensions/extensions_resources.gyp:extensions_resources
49 #              (extensions_renderer_resources action)
50 grit("extensions_renderer_resources") {
51   source = "renderer/resources/extensions_renderer_resources.grd"
52   outputs = [
53     "grit/extensions_renderer_resources.h",
54     "extensions_renderer_resources.pak",
55   ]
56   grit_flags = [
57     "-E",
58     "mojom_root=" + rebase_path(root_gen_dir),
59   ]
61   deps = [
62     "//chrome/browser/media/router:mojo_bindings__generator",
63     "//device/serial:serial_mojo__generator",
64     "//extensions/common:mojo__generator",
65     "//extensions/common/api:mojom__generator",
66   ]
69 source_set("test_support") {
70   testonly = true
71   sources = rebase_path(extensions_gypi_values.extensions_test_support_sources,
72                         ".",
73                         "//extensions")
75   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
76   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
78   deps = [
79     ":extensions_resources",
80     "//base",
81     "//base:prefs_test_support",
82     "//components/guest_view/browser:test_support",
83     "//content/public/common",
84     "//content/test:test_support",
85     "//extensions/browser",
86     "//extensions/common",
87     "//extensions/common/api",
88     "//extensions/common/api:api_registration",
89     "//net:test_support",
90     "//testing/gmock",
91     "//testing/gtest",
92   ]
94   public_deps = [
95     "//content/public/browser",
96     "//extensions/common/api/cast_channel:cast_channel_proto",
97   ]
100 # GYP version: //extensions/extensions.gyp:extensions_shell_and_test_pak
101 repack("shell_and_test_pak") {
102   sources = [
103     "$root_gen_dir/blink/devtools_resources.pak",
104     "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
105     "$root_gen_dir/blink/public/resources/blink_resources.pak",
106     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
107     "$root_gen_dir/content/content_resources.pak",
108     "$root_gen_dir/content/shell/shell_resources.pak",
109     "$root_gen_dir/extensions/extensions_browser_resources_100_percent.pak",
110     "$root_gen_dir/extensions/extensions_renderer_resources.pak",
111     "$root_gen_dir/extensions/extensions_resources.pak",
112     "$root_gen_dir/extensions/shell/app_shell_resources.pak",
113     "$root_gen_dir/extensions/strings/extensions_strings_en-US.pak",
114     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
115     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
116     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
117   ]
119   output = "$root_out_dir/extensions_shell_and_test.pak"
121   deps = [
122     ":extensions_resources",
123     "//content:resources",
124     "//content/app/strings",
125     "//content/browser/devtools:devtools_resources",
126     "//content/shell:resources",
127     "//extensions/shell:resources",
128     "//extensions/strings",
129     "//third_party/WebKit/public:image_resources",
130     "//third_party/WebKit/public:resources",
131     "//ui/resources",
132     "//ui/strings",
133   ]
136 test("extensions_unittests") {
137   sources =
138       rebase_path(extensions_tests_gypi_values.extensions_unittests_sources,
139                   ".",
140                   "//extensions")
142   sources += [
143     # TODO(rockot): DisplayInfoProvider::Create() is only implemented in Chrome
144     # and app_shell. This is wrong.
145     "shell/browser/shell_display_info_provider.cc",
146   ]
148   deps = [
149     ":extensions_resources",
150     ":shell_and_test_pak",
151     ":test_support",
152     "//base",
153     "//base:prefs_test_support",
154     "//base/test:test_support",
155     "//components/keyed_service/content",
156     "//components/user_prefs",
157     "//content/test:test_support",
158     "//device/bluetooth:mocks",
159     "//device/serial",
160     "//device/serial:test_support",
161     "//extensions/common",
162     "//extensions/common/api/cast_channel:cast_channel_proto",
163     "//extensions/renderer",
164     "//extensions/strings",
165     "//extensions/utility",
166     "//mojo/application/public/interfaces",
167     "//mojo/environment:chromium",
168     "//testing/gmock",
169     "//testing/gtest",
170     "//third_party/leveldatabase",
171     "//third_party/mojo/src/mojo/edk/js",
172     "//third_party/mojo/src/mojo/edk/system",
173     "//third_party/mojo/src/mojo/public/cpp/bindings",
174   ]
176   if (is_win) {
177     deps += [ "//base/allocator" ]
178   }
180   if (is_chromeos) {
181     sources += [
182       # TODO(rockot): There are two implementations of VpnServiceFactory, a
183       # stub in app_shell and a real one in Chrome. This is wrong.
184       "shell/browser/api/vpn_provider/vpn_service_factory.cc",
185     ]
187     deps += [ "//chromeos:test_support" ]
188   }
191 test("extensions_browsertests") {
192   sources =
193       rebase_path(extensions_tests_gypi_values.extensions_browsertests_sources,
194                   ".",
195                   "//extensions")
197   defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
199   deps = [
200     ":test_support",
201     "shell:app_shell_lib",
203     # TODO(yoz): find the right deps
204     "//base",
205     "//base:prefs_test_support",
206     "//base/test:test_support",
207     "//components/storage_monitor:test_support",
208     "//content/test:test_support",
209     "//device/bluetooth:mocks",
210     "//device/usb:mocks",
211     "//mojo/environment:chromium",
212     "//testing/gmock",
213     "//testing/gtest",
214     "//third_party/mojo/src/mojo/edk/js",
215     "//third_party/mojo/src/mojo/edk/system",
216     "//third_party/mojo/src/mojo/public/cpp/bindings",
217   ]
219   if (is_win) {
220     deps += [ "//base/allocator" ]
221   }
223   if (is_mac) {
224     deps += [ "shell:app_shell" ]  # Needed for App Shell.app's Helper.
225   }