Remove INJECT_EVENTS permissions from test APKs.
[chromium-blink-merge.git] / ash / BUILD.gn
blobb710cf5673dd2808ef3ec336c988f71b528a0b33
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/features.gni")
6 import("//build/config/ui.gni")
7 import("//testing/test.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("ash.gyp") ],
11                           "scope",
12                           [ "ash.gyp" ])
14 component("ash") {
15   sources = gypi_values.ash_sources
17   defines = [ "ASH_IMPLEMENTATION" ]
19   public_deps = [
20     "//ash/resources",
21     "//ash/strings",
22   ]
23   deps = [
24     "//base",
25     "//base:i18n",
26     "//base/third_party/dynamic_annotations",
27     "//cc",
28     "//components/device_event_log",
29     "//components/user_manager",
30     "//components/wallpaper",
31     "//content/public/browser",
32     "//media",
33     "//net",
34     "//skia",
35     "//third_party/icu",
36     "//ui/accessibility",
37     "//ui/app_list",
38     "//ui/aura",
39     "//ui/base",
40     "//ui/base/ime",
41     "//ui/compositor",
42     "//ui/events",
43     "//ui/events:events_base",
44     "//ui/events:gesture_detection",
45     "//ui/events/devices",
46     "//ui/gfx",
47     "//ui/gfx/geometry",
48     "//ui/keyboard",
49     "//ui/message_center",
50     "//ui/resources",
51     "//ui/strings",
52     "//ui/views",
53     "//ui/views/controls/webview",
54     "//ui/web_dialogs",
55     "//ui/wm",
56     "//url",
57   ]
59   if (is_win) {
60     sources -= [
61       "sticky_keys/sticky_keys_controller.cc",
62       "sticky_keys/sticky_keys_controller.h",
63     ]
65     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
66     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
67   }
69   if (use_x11) {
70     configs += [
71       "//build/config/linux:x11",
72       "//build/config/linux:xfixes",
73     ]
74     deps += [
75       "//ui/events/platform",
76       "//ui/gfx/x",
77     ]
78   } else {
79     sources -= [
80       "host/ash_window_tree_host_x11.cc",
81       "host/ash_window_tree_host_x11.h",
82       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
83       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
84     ]
85   }
87   if (use_ozone) {
88     deps += [
89       "//ui/events/ozone:events_ozone",
90       "//ui/ozone",
91     ]
92   }
94   if (is_chromeos) {
95     deps += [
96       "//device/bluetooth",
97       "//ui/display",
98       "//ui/display/util",
99       "//chromeos",
100       "//chromeos:power_manager_proto",
101       "//third_party/qcms",
102       "//ui/chromeos/resources",
103       "//ui/chromeos/strings",
104       "//ui/chromeos:ui_chromeos",
105     ]
106   } else {
107     sources -= [
108       "accelerators/key_hold_detector.cc",
109       "accelerators/key_hold_detector.h",
110       "accelerators/magnifier_key_scroller.cc",
111       "accelerators/magnifier_key_scroller.h",
112       "accelerators/spoken_feedback_toggler.cc",
113       "accelerators/spoken_feedback_toggler.h",
114       "display/display_configurator_animation.cc",
115       "display/display_configurator_animation.h",
116       "display/resolution_notification_controller.cc",
117       "display/resolution_notification_controller.h",
118       "system/tray/media_security/media_capture_observer.h",
119       "system/tray/media_security/multi_profile_media_tray_item.cc",
120       "system/tray/media_security/multi_profile_media_tray_item.h",
121       "touch/touch_transformer_controller.cc",
122       "touch/touch_transformer_controller.h",
123       "touch/touchscreen_util.cc",
124       "touch/touchscreen_util.h",
125       "virtual_keyboard_controller.cc",
126       "virtual_keyboard_controller.h",
127     ]
128   }
130   if (!use_ozone) {
131     sources -= [
132       "host/ash_window_tree_host_ozone.cc",
133       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
134       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
135     ]
136   }
139 component("ash_with_content") {
140   sources = [
141     "content_support/ash_with_content_export.h",
142     "content_support/gpu_support_impl.cc",
143     "content_support/gpu_support_impl.h",
144     "keyboard_overlay/keyboard_overlay_delegate.cc",
145     "keyboard_overlay/keyboard_overlay_delegate.h",
146     "keyboard_overlay/keyboard_overlay_view.cc",
147     "keyboard_overlay/keyboard_overlay_view.h",
148   ]
150   defines = [ "ASH_WITH_CONTENT_IMPLEMENTATION" ]
152   public_deps = [
153     ":ash",
154   ]
155   deps = [
156     "//base",
157     "//base/third_party/dynamic_annotations",
158     "//content/public/browser",
159     "//ipc",
160     "//skia",
161     "//ui/aura",
162     "//ui/base",
163     "//ui/compositor",
164     "//ui/events",
165     "//ui/gfx",
166     "//ui/gfx/geometry",
167     "//ui/resources",
168     "//ui/strings",
169     "//ui/views",
170     "//ui/views/controls/webview",
171     "//ui/web_dialogs",
172     "//url",
173   ]
176 static_library("test_support") {
177   testonly = true
178   sources = gypi_values.ash_test_support_sources
180   public_deps = [
181     ":ash",
182   ]
183   deps = [
184     "//ash/resources",
185     "//content/test:test_support",
186     "//skia",
187     "//testing/gtest",
188     "//ui/accessibility",
189     "//ui/app_list",
190     "//ui/app_list:test_support",
191     "//ui/events:events_base",
192     "//ui/events/devices",
193     "//ui/gl",
194     "//ui/views",
195     "//ui/views:test_support",
196   ]
198   if (is_win) {
199     sources += [
200       "test/test_metro_viewer_process_host.cc",
201       "test/test_metro_viewer_process_host.h",
202     ]
203     deps += [
204       "//ipc",
205       "//ui/metro_viewer",
206       "//ui/platform_window/win",
207       "//win8:metro_viewer",
208       "//win8:test_support_win8",
209       "//win8:test_registrar",
210     ]
211   }
214 static_library("ash_shell_lib") {
215   testonly = true
216   sources = gypi_values.ash_shell_lib_sources
218   deps = [
219     ":ash",
220     ":ash_with_content",
221     ":test_support",
222     "//ash/resources",
223     "//ash/strings",
224     "//base",
225     "//base:i18n",
227     #"//chrome:packed_resources",  TODO(GYP)
228     "//content",
229     "//content/shell:content_shell_lib",
230     "//net",
231     "//skia",
232     "//third_party/icu",
233     "//ui/app_list",
234     "//ui/aura",
235     "//ui/base",
236     "//ui/base/ime",
237     "//ui/compositor",
238     "//ui/events",
239     "//ui/events:events_base",
240     "//ui/gfx",
241     "//ui/gfx/geometry",
242     "//ui/keyboard",
243     "//ui/message_center",
244     "//ui/resources",
245     "//ui/views",
246     "//ui/views:test_support",
247     "//ui/views/examples:views_examples_lib",
248     "//ui/views/examples:views_examples_with_content_lib",
249   ]
252 test("ash_unittests") {
253   sources = gypi_values.ash_unittests_sources
255   deps = [
256     ":ash",
257     ":ash_with_content",
258     ":test_support",
259     "//ash/resources",
260     "//ash/strings",
261     "//base",
262     "//base/allocator",
263     "//base/test:test_support",
264     "//components/user_manager",
265     "//content/public/browser",
266     "//content/test:test_support",
267     "//skia",
268     "//testing/gtest",
269     "//third_party/icu",
270     "//ui/accessibility",
271     "//ui/aura",
272     "//ui/aura:test_support",
273     "//ui/base",
274     "//ui/base/ime",
275     "//ui/base:test_support",
276     "//ui/compositor",
277     "//ui/compositor:test_support",
278     "//ui/events",
279     "//ui/events/devices",
280     "//ui/events:test_support",
281     "//ui/events:gesture_detection",
282     "//ui/gfx",
283     "//ui/gfx/geometry",
284     "//ui/keyboard",
285     "//ui/message_center",
286     "//ui/message_center:test_support",
287     "//ui/resources",
288     "//ui/views",
289     "//ui/views:test_support",
290     "//ui/views/controls/webview:test_support",
291     "//ui/web_dialogs:test_support",
292     "//ui/wm",
293     "//url",
294   ]
296   if (!is_chromeos) {
297     sources -= [
298       # TODO(zork): fix this test to build on Windows. See: crosbug.com/26906
299       "focus_cycler_unittest.cc",
301       # All tests for multiple displays: not supported on Windows Ash.
302       "wm/drag_window_resizer_unittest.cc",
304       # Accelerometer is only available on Chrome OS.
305       "wm/maximize_mode/maximize_mode_controller_unittest.cc",
307       # Can't resize on Windows Ash. http://crbug.com/165962
308       "autoclick/autoclick_unittest.cc",
309       "magnifier/magnification_controller_unittest.cc",
310       "sticky_keys/sticky_keys_overlay_unittest.cc",
311       "system/tray/media_security/multi_profile_media_tray_item_unittest.cc",
312       "virtual_keyboard_controller_unittest.cc",
313       "wm/workspace/workspace_window_resizer_unittest.cc",
314     ]
315     sources += [
316       #'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',  TODO(GYP)
317     ]
318   }
320   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
322   if (!use_x11) {
323     sources -= [ "host/ash_window_tree_host_x11_unittest.cc" ]
324   }
325   if (is_chromeos) {
326     sources += [ "first_run/first_run_helper_unittest.cc" ]
327     deps += [
328       "//device/bluetooth",
329       "//ui/display",
330       "//ui/display:test_util",
331       "//ui/display/types",
332       "//chromeos:power_manager_proto",
333       "//chromeos:test_support_without_gmock",
334     ]
335   } else {
336     sources -= [
337       "accelerators/magnifier_key_scroller_unittest.cc",
338       "accelerators/spoken_feedback_toggler_unittest.cc",
339       "display/resolution_notification_controller_unittest.cc",
340       "touch/touchscreen_util_unittest.cc",
341     ]
342   }
344   if (!use_x11 || !is_chromeos) {
345     sources -= [ "touch/touch_transformer_controller_unittest.cc" ]
346   }
348   # TODO(GYP) is this necessary?
349   #['OS=="linux" and component=="shared_library" and use_allocator!="none"', {
350   # ldflags = "-rdynamic"
352   if (!is_chromeos || use_ozone) {
353     sources -= [ "sticky_keys/sticky_keys_unittest.cc" ]  # crbug.com/354035
354   }
357 executable("ash_shell") {
358   testonly = true
359   sources = [
360     "shell/shell_main.cc",
361   ]
363   deps = [
364     ":ash_shell_lib",
365     "//components/user_manager",
366   ]
368   if (is_win) {
369     configs -= [ "//build/config/win:console" ]
370     configs += [ "//build/config/win:windowed" ]
371     deps += [ "//sandbox" ]
372   }
374   if (is_chromeos) {
375     deps += [ "//device/bluetooth" ]
376   }
379 test("ash_shell_unittests") {
380   sources = [
381     "shell/window_watcher_unittest.cc",
382     "test/ash_unittests.cc",
383   ]
385   deps = [
386     ":ash_shell_lib",
387     ":test_support",
388     "//base/test:test_support",
389     "//components/user_manager",
390     "//content/test:test_support",
391     "//skia",
392     "//testing/gtest",
393     "//ui/accessibility",
394   ]
396   if (is_chromeos) {
397     deps += [ "//ui/display" ]
398   }
400 # When adding support for isolates, please have a look at run-time dependencies
401 # in the ash_unittests_run target in ash.gyp.