Initial support for ChromeVox output rules.
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / chromevox / chromevox_tests.gypi
blob53346861d392d81e9d52905d2054ea5edaefd05a
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.
6   'includes': [
7     '../../../../js_unittest_vars.gypi',
8   ],
9   'variables': {
10     'chromevox_test_deps_js_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/chromeos/chromevox/test_deps.js',
11     'chromevox_test_messages_js_file': '<(PRODUCT_DIR)/test_data/chrome/browser/resources/chromeos/chromevox/host/testing/test_messages.js',
12   },
13   'targets': [
14     {
15       'target_name': 'chromevox_tests',
16       'type': 'executable',
17       'dependencies': [
18         '<(DEPTH)/base/base.gyp:base',
19         '<(DEPTH)/base/base.gyp:base_i18n',
20         '<(DEPTH)/base/base.gyp:test_support_base',
21         '<(DEPTH)/chrome/chrome.gyp:browser',
22         '<(DEPTH)/chrome/chrome.gyp:renderer',
23         '<(DEPTH)/chrome/chrome.gyp:test_support_common',
24         '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources',
25         '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings',
26         '<(DEPTH)/chrome/chrome_resources.gyp:packed_extra_resources',
27         '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
28         '<(DEPTH)/testing/gmock.gyp:gmock',
29         '<(DEPTH)/testing/gtest.gyp:gtest',
30         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
31         'chromevox_test_deps_js',
32       ],
33       'conditions': [
34         [ 'cld_version==0 or cld_version==2', {
35           'dependencies': [
36             # Interactive tests should use whatever CLD2 data access mode that
37             # the application embedder is using.
38             '<(DEPTH)/third_party/cld_2/cld_2.gyp:cld2_platform_impl', ],
39         }],
40       ],
41       'defines': [
42         'HAS_OUT_OF_PROC_TEST_RUNNER',
43       ],
44       'include_dirs': [
45         '<(DEPTH)',
46         '<(SHARED_INTERMEDIATE_DIR)',
47       ],
48       'rules': [
49         {
50           # A JavaScript test that runs in an environment similar to a webui
51           # browser test.  This is meant for unit tests that test individual
52           # components without depending on the ChromeVox extension.
53           'rule_name': 'js2webui',
54           'extension': 'unitjs',
55           'msvs_external_rule': 1,
56           'variables': {
57             'conditions': [
58               ['v8_use_external_startup_data==1', {
59                 'external_v8': 'y',
60               }, {
61                 'external_v8': 'n',
62               }],
63             ],
64           },
65           'inputs': [
66             '<(gypv8sh)',
67             '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
68             '<(mock_js)',
69             '<(test_api_js)',
70             '<(js2gtest)',
71             '<(chromevox_test_deps_js_file)',
72             'testing/assert_additions.js',
73             'testing/chromevox_unittest_base.js',
74           ],
75           'outputs': [
76             '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc',
77             '<(PRODUCT_DIR)/test_data/chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
78           ],
79           'process_outputs_as_sources': 1,
80           'action': [
81             'python',
82             '<(gypv8sh)',
83             '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
84             '--deps_js', '<(chromevox_test_deps_js_file)',
85             '--external', '<(external_v8)',
86             '<(mock_js)',
87             '<(test_api_js)',
88             '<(js2gtest)',
89             'webui',
90             '<(RULE_INPUT_PATH)',
91             'chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).unitjs',
92             '<@(_outputs)',
93           ],
94         },
95         {
96           # A JavaScript test that runs in the ChromeVox background page's
97           # isolate.
98           'rule_name': 'js2extension',
99           'extension': 'extjs',
100           'msvs_external_rule': 1,
101           'variables': {
102             'conditions': [
103               ['v8_use_external_startup_data==1', {
104                 'external_v8': 'y',
105               }, {
106                 'external_v8': 'n',
107               }],
108             ],
109           },
110           'inputs': [
111             '<(gypv8sh)',
112             '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
113             '<(mock_js)',
114             '<(test_api_js)',
115             '<(js2gtest)',
116             'testing/chromevox_e2e_test_base.js',
117             'testing/assert_additions.js',
118           ],
119           'outputs': [
120             '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc',
121             '<(PRODUCT_DIR)/test_data/chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).extjs',
122           ],
123           'process_outputs_as_sources': 1,
124           'action': [
125             'python',
126             '<(gypv8sh)',
127             '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
128             '--external', '<(external_v8)',
129             '<(mock_js)',
130             '<(test_api_js)',
131             '<(js2gtest)',
132             'extension',
133             '<(RULE_INPUT_PATH)',
134             'chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).extjs',
135             '<@(_outputs)',
136           ],
137         },
138       ],
139       'sources': [
140         '<(DEPTH)/chrome/browser/ui/webui/web_ui_test_handler.cc',
141         '<(DEPTH)/chrome/browser/ui/webui/web_ui_test_handler.h',
142         '<(DEPTH)/chrome/test/base/browser_tests_main.cc',
143         '<(DEPTH)/chrome/test/base/extension_load_waiter_one_shot.cc',
144         '<(DEPTH)/chrome/test/base/extension_load_waiter_one_shot.h',
145         '<(DEPTH)/chrome/test/base/extension_js_browser_test.cc',
146         '<(DEPTH)/chrome/test/base/extension_js_browser_test.h',
147         '<(DEPTH)/chrome/test/base/javascript_browser_test.cc',
148         '<(DEPTH)/chrome/test/base/javascript_browser_test.h',
149         '<(DEPTH)/chrome/test/base/test_chrome_web_ui_controller_factory.cc',
150         '<(DEPTH)/chrome/test/base/test_chrome_web_ui_controller_factory.h',
151         '<(DEPTH)/chrome/test/base/web_ui_browser_test.cc',
152         '<(DEPTH)/chrome/test/base/web_ui_browser_test.h',
153         '<(DEPTH)/chrome/browser/extensions/browsertest_util.cc',
154         '<(DEPTH)/chrome/browser/extensions/browsertest_util.h',
156         'common/aria_util_test.unitjs',
157         'common/braille_text_handler_test.unitjs',
158         'common/braille_util_test.unitjs',
159         'common/command_store_test.unitjs',
160         'common/content_editable_extractor_test.unitjs',
161         'common/cursor_selection_test.unitjs',
162         'common/dom_util_test.unitjs',
163         'common/editable_text_area_shadow_test.unitjs',
164         'common/editable_text_test.unitjs',
165         'common/find_util_test.unitjs',
166         'common/key_sequence_test.unitjs',
167         'common/math_semantic_tree_test.unitjs',
168         'common/page_selection_test.unitjs',
169         'common/selection_util_test.unitjs',
170         'common/spannable_test.unitjs',
171         'chromevox/injected/event_watcher_test.unitjs',
172         'chromevox/injected/live_regions_test.unitjs',
173         'chromevox/injected/user_commands_test.unitjs',
174         'chromevox/injected/navigation_manager_test.unitjs',
175         'cvox2/background/automation_util_test.extjs',
176         'cvox2/background/background_test.extjs',
177         'cvox2/background/cursors_test.extjs',
178         'cvox2/background/output_test.extjs',
179         'host/chrome/braille_display_manager_test.unitjs',
180         'host/chrome/braille_input_handler_test.unitjs',
181         'host/chrome/braille_integration_test.unitjs',
182         'host/chrome/braille_table_test.extjs',
183         'host/chrome/expanding_braille_translator_test.unitjs',
184         'host/chrome/tts_background_test.extjs',
185         'liblouis_nacl/liblouis_test.extjs',
186         'walkers/character_walker_test.unitjs',
187         'walkers/group_walker_test.unitjs',
188         'walkers/object_walker_test.unitjs',
189         'walkers/layout_line_walker_test.unitjs',
190         'walkers/math_shifter_test.unitjs',
191         'walkers/sentence_walker_test.unitjs',
192         'walkers/structural_line_walker_test.unitjs',
193         'walkers/table_walker_test.unitjs',
194         'walkers/word_walker_test.unitjs',
195       ],
196     },  # target chromevox_tests
197     {
198       'target_name': 'chromevox_test_messages_js',
199       'type': 'none',
200       'actions': [
201         {
202           'action_name': 'test_messages_js',
203           'message': 'Generate <(_target_name)',
204           'variables': {
205             'english_messages_file': '<(chromevox_dest_dir)/_locales/en/messages.json',
206           },
207           'inputs': [
208             'tools/generate_test_messages.py',
209             '<(english_messages_file)',
210           ],
211           'outputs': [
212             '<(chromevox_test_messages_js_file)',
213           ],
214           'action': [
215             'python',
216             'tools/generate_test_messages.py',
217             '-o', '<(chromevox_test_messages_js_file)',
218             '<(english_messages_file)',
219           ],
220         },
221       ],
222     },  # target chromevox_test_messages_js
223     {
224       'target_name': 'chromevox_test_deps_js',
225       'type': 'none',
226       'actions': [
227         {
228           'action_name': 'deps_js',
229           'message': 'Generate <(_target_name)',
230           'variables': {
231             # Closure library directory relative to source tree root.
232             'closure_dir': 'chrome/third_party/chromevox/third_party/closure-library/closure/goog',
233             'depswriter_path': 'tools/generate_deps.py',
234             'js_files': [
235               '<!@(python tools/find_js_files.py . <(DEPTH)/<(closure_dir))',
236               '<(chromevox_test_messages_js_file)',
237             ],
238           },
239           'inputs': [
240             '<@(js_files)',
241             '<(depswriter_path)',
242           ],
243           'outputs': [
244             '<(chromevox_test_deps_js_file)',
245           ],
246           'action': [
247             'python',
248             '<(depswriter_path)',
249             '-w', '<(DEPTH)/<(closure_dir):<(closure_dir)',
250             '-w', '<(PRODUCT_DIR)/test_data:',
251             '-w', ':chrome/browser/resources/chromeos/chromevox',
252             '-o', '<(chromevox_test_deps_js_file)',
253             '<@(js_files)',
254           ],
255         },
256       ],
257       'dependencies': [
258         'chromevox_test_messages_js',
259       ],
260     },  # target chromevox_test_deps_js
261   ],