summaryrefslogtreecommitdiffstats
path: root/extensions/BUILD.gn
blob: f84121f82ecfed131fd1a7af9fbde48bb0170aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# TODO(rockot) bug 505926: Don't include chrome files from here.
# See chrome_browser_tests_extensions_sources below
import("//chrome/chrome_tests.gni")
import("//extensions/extensions.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")

assert(enable_extensions)

# GYP version: extensions/extensions_resources.gyp:extensions_resources
group("extensions_resources") {
  public_deps = [
    ":extensions_browser_resources",
    ":extensions_renderer_resources",
    ":extensions_resources_grd",
  ]
}

# GYP version: extensions/extensions_resources.gyp:extensions_resources
#              (extensions_resources action)
grit("extensions_resources_grd") {
  source = "extensions_resources.grd"
  outputs = [
    "grit/extensions_resources.h",
    "extensions_resources.pak",
  ]
}

# GYP version: extensions/extensions_resources.gyp:extensions_resources
#              (extensions_browser_resources action)
grit("extensions_browser_resources") {
  source = "browser/resources/extensions_browser_resources.grd"
  outputs = [
    "grit/extensions_browser_resources.h",
    "grit/extensions_browser_resources_map.cc",
    "grit/extensions_browser_resources_map.h",
    "extensions_browser_resources_100_percent.pak",
    "extensions_browser_resources_200_percent.pak",
  ]
  grit_flags = [
    "-E",
    "mojom_root=" + rebase_path(root_gen_dir),
  ]
}

# GYP version: extensions/extensions_resources.gyp:extensions_resources
#              (extensions_renderer_resources action)
grit("extensions_renderer_resources") {
  source = "renderer/resources/extensions_renderer_resources.grd"
  outputs = [
    "grit/extensions_renderer_resources.h",
    "extensions_renderer_resources.pak",
  ]
  grit_flags = [
    "-E",
    "mojom_root=" + rebase_path(root_gen_dir),
  ]

  deps = [
    "//chrome/browser/media/router:mojo_bindings__generator",
    "//device/serial:serial_mojo__generator",
    "//extensions/common:mojo__generator",
    "//extensions/common/api:mojom__generator",
  ]
}

source_set("test_support") {
  testonly = true
  sources = rebase_path(extensions_gypi_values.extensions_test_support_sources,
                        ".",
                        "//extensions")

  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

  deps = [
    ":extensions_resources",
    "//base",
    "//base:prefs_test_support",
    "//components/guest_view/browser:test_support",
    "//components/pref_registry:test_support",
    "//content/public/common",
    "//content/test:test_support",
    "//extensions/browser",
    "//extensions/common",
    "//extensions/common/api",
    "//extensions/common/api:api_registration",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]

  public_deps = [
    "//content/public/browser",
    "//extensions/common/api/cast_channel:cast_channel_proto",
  ]

  if (cld_version == 2) {
    deps += [ "//third_party/cld_2:cld2_static" ]
  }
}

# GYP version: //extensions/extensions.gyp:extensions_shell_and_test_pak
repack("shell_and_test_pak") {
  sources = [
    "$root_gen_dir/blink/devtools_resources.pak",
    "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
    "$root_gen_dir/blink/public/resources/blink_resources.pak",
    "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
    "$root_gen_dir/content/content_resources.pak",
    "$root_gen_dir/content/shell/shell_resources.pak",
    "$root_gen_dir/extensions/extensions_browser_resources_100_percent.pak",
    "$root_gen_dir/extensions/extensions_renderer_resources.pak",
    "$root_gen_dir/extensions/extensions_resources.pak",
    "$root_gen_dir/extensions/shell/app_shell_resources.pak",
    "$root_gen_dir/extensions/strings/extensions_strings_en-US.pak",
    "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
    "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
    "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
  ]

  output = "$root_out_dir/extensions_shell_and_test.pak"

  deps = [
    ":extensions_resources",
    "//content:resources",
    "//content/app/strings",
    "//content/browser/devtools:devtools_resources",
    "//content/shell:resources",
    "//extensions/shell:resources",
    "//extensions/strings",
    "//third_party/WebKit/public:image_resources",
    "//third_party/WebKit/public:resources",
    "//ui/resources",
    "//ui/strings",
  ]
}

# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("extensions_unittests_run") {
  testonly = true
  deps = [
    ":extensions_unittests",
  ]
}

test("extensions_unittests") {
  sources =
      rebase_path(extensions_tests_gypi_values.extensions_unittests_sources,
                  ".",
                  "//extensions")

  sources += [
    # TODO(rockot): DisplayInfoProvider::Create() is only implemented in Chrome
    # and app_shell. This is wrong.
    "shell/browser/shell_display_info_provider.cc",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  data = [
    "test/data/",
    "//chrome/test/data/extensions/",
    "$root_out_dir/extensions_shell_and_test.pak",
  ]

  deps = [
    ":extensions_resources",
    ":shell_and_test_pak",
    ":test_support",
    "//base",
    "//base:prefs_test_support",
    "//base/test:test_support",
    "//components/keyed_service/content",
    "//components/pref_registry:test_support",
    "//components/user_prefs",
    "//content/test:test_support",
    "//device/bluetooth:mocks",
    "//device/core",
    "//device/hid",
    "//device/serial",
    "//device/serial:test_support",
    "//extensions/common",
    "//extensions/common/api/cast_channel:cast_channel_proto",
    "//extensions/renderer",
    "//extensions/strings",
    "//extensions/utility",
    "//mojo/application/public/interfaces",
    "//mojo/environment:chromium",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/leveldatabase",
    "//third_party/mojo/src/mojo/edk/js",
    "//third_party/mojo/src/mojo/edk/system",
    "//third_party/mojo/src/mojo/public/cpp/bindings",
  ]

  data_deps = [
    "//third_party/mesa:osmesa",
  ]

  if (is_win) {
    deps += [ "//base/allocator" ]
  }

  if (is_chromeos) {
    sources += [
      "browser/api/webcam_private/visca_webcam_unittest.cc",

      # TODO(rockot): There are two implementations of VpnServiceFactory, a
      # stub in app_shell and a real one in Chrome. This is wrong.
      "shell/browser/api/vpn_provider/vpn_service_factory.cc",
    ]

    deps += [ "//chromeos:test_support" ]
  }
}

# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("extensions_browsertests_run") {
  testonly = true
  deps = [
    ":extensions_browsertests",
  ]
}

test("extensions_browsertests") {
  sources =
      rebase_path(extensions_tests_gypi_values.extensions_browsertests_sources,
                  ".",
                  "//extensions")

  data = [
    "test/data/",
    "//net/data/",
    "//net/tools/testserver/",
    "//third_party/pyftpdlib/",
    "//third_party/pywebsocket/",
    "//third_party/tlslite/",
    "$root_out_dir/extensions_shell_and_test.pak",
  ]

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  deps = [
    ":test_support",
    "shell:app_shell_lib",

    # TODO(yoz): find the right deps
    "//base",
    "//base:prefs_test_support",
    "//base/test:test_support",
    "//components/storage_monitor:test_support",
    "//content/test:test_support",
    "//device/bluetooth:mocks",
    "//device/usb:mocks",
    "//mojo/environment:chromium",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/mojo/src/mojo/edk/js",
    "//third_party/mojo/src/mojo/edk/system",
    "//third_party/mojo/src/mojo/public/cpp/bindings",
  ]

  data_deps = [
    "//third_party/mesa:osmesa",
  ]

  if (is_win) {
    deps += [ "//base/allocator" ]

    if (target_cpu == "x86") {
      data_deps += [
        # "$root_out_dir/wow_helper.exe"  # TODO(GYP)
      ]
    }
  }

  if (is_mac) {
    deps += [ "shell:app_shell" ]  # Needed for App Shell.app's Helper.
  }
}

# TODO(rockot) bug 505926: These should be moved to extensions_browsertests but have
# old dependencies on chrome files. The chrome dependencies should be removed
# and these moved to the extensions_browsertests target. Currently, we solve
# the problem by making this a source set and linking it into
# //chrome/test:browser_tests.
source_set("chrome_extensions_browsertests") {
  testonly = true
  sources = rebase_path(
          chrome_tests_gypi_values.chrome_browser_tests_extensions_sources,
          ".",
          "//chrome")

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  # These are the deps from browser_tests minus some internal Chrome ones that
  # aren't allowed to be included here and that aren't needed.
  deps = [
    "//base",
    "//base:i18n",
    "//base/allocator",
    "//base/test:test_support",
    "//chrome/browser",
    "//chrome/browser/resources:extension_resource_demo",
    "//chrome/common/extensions/api",
    "//chrome/renderer",
    "//components/autofill/content/browser:risk_proto",
    "//components/autofill/content/browser/wallet:test_support",
    "//components/autofill/content/renderer:test_support",
    "//components/captive_portal:test_support",
    "//components/dom_distiller/content:content_browser",
    "//components/dom_distiller/core:test_support",
    "//components/guest_view/browser:test_support",
    "//components/resources",
    "//components/strings",
    "//components/translate/core/common",
    "//components/user_manager:test_support",
    "//crypto:platform",
    "//crypto:test_support",
    "//device/bluetooth:mocks",
    "//device/serial:test_support",
    "//extensions/common/api",
    "//google_apis:test_support",
    "//media",
    "//media/base:test_support",
    "//media/cast:test_support",
    "//net",
    "//net:test_support",
    "//sdch",
    "//skia",
    "//sync",
    "//sync:test_support_sync_api",
    "//testing/gmock",
    "//testing/gtest",
    "//testing/perf",
    "//third_party/cacheinvalidation",
    "//third_party/icu",
    "//third_party/leveldatabase",
    "//third_party/libaddressinput",
    "//third_party/libjingle",
    "//third_party/safe_browsing:test_support",
    "//third_party/WebKit/public:blink",
    "//third_party/webrtc/modules/desktop_capture",
    "//third_party/widevine/cdm:version_h",
    "//ui/accessibility:test_support",
    "//ui/base:test_support",
    "//ui/compositor:test_support",
    "//ui/resources",
    "//ui/web_dialogs:test_support",
    "//v8",
  ]
}

# TODO(rockot) bug 505926: This should be deleted for the same reason as
# chrome_extensions_browsertests.
source_set("chrome_extensions_interactive_uitests") {
  testonly = true
  sources = rebase_path(
          chrome_tests_gypi_values.chrome_interactive_ui_test_extensions_sources,
          ".",
          "//chrome")

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  # These are the deps from interactive_uitests minus some internal Chrome
  # ones that aren't allowed to be included here and that aren't needed.
  deps = [
    "//base/allocator",
    "//chrome/browser",
    "//chrome/browser/devtools",
    "//chrome/renderer",
    "//chrome/test:test_support",
    "//content/app/resources",
    "//crypto:platform",
    "//crypto:test_support",
    "//google_apis:test_support",
    "//net",
    "//net:net_resources",
    "//net:test_support",
    "//skia",
    "//sync",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/hunspell",
    "//third_party/icu",
    "//third_party/libpng",
    "//third_party/zlib",
    "//ui/base:test_support",
    "//ui/resources:ui_test_pak",
    "//ui/web_dialogs:test_support",
  ]
}