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.
4
5{
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      'defines': [
34        'HAS_OUT_OF_PROC_TEST_RUNNER',
35      ],
36      'include_dirs': [
37        '<(DEPTH)',
38        '<(SHARED_INTERMEDIATE_DIR)',
39      ],
40      'rules': [
41        {
42          # A JavaScript test that runs in an environment similar to a webui
43          # browser test.  This is meant for unit tests that test individual
44          # components without depending on the ChromeVox extension.
45          'rule_name': 'js2webui',
46          'extension': 'unitjs',
47          'msvs_external_rule': 1,
48          'inputs': [
49            '<(gypv8sh)',
50            '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
51            '<(mock_js)',
52            '<(test_api_js)',
53            '<(js2gtest)',
54            '<(chromevox_test_deps_js_file)',
55            'testing/assert_additions.js',
56            'testing/chromevox_unittest_base.js',
57          ],
58          'outputs': [
59            '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc',
60            '<(PRODUCT_DIR)/test_data/chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
61          ],
62          'process_outputs_as_sources': 1,
63          'action': [
64            'python',
65            '<(gypv8sh)',
66            '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
67            '--deps_js', '<(chromevox_test_deps_js_file)',
68            '<(mock_js)',
69            '<(test_api_js)',
70            '<(js2gtest)',
71            'webui',
72            '<(RULE_INPUT_PATH)',
73            'chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).unitjs',
74            '<@(_outputs)',
75          ],
76        },
77        {
78          # A JavaScript test that runs in the ChromeVox background page's
79          # isolate.
80          'rule_name': 'js2extension',
81          'extension': 'extjs',
82          'msvs_external_rule': 1,
83          'inputs': [
84            '<(gypv8sh)',
85            '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
86            '<(mock_js)',
87            '<(test_api_js)',
88            '<(js2gtest)',
89            'testing/chromevox_e2e_test_base.js',
90            'testing/assert_additions.js',
91          ],
92          'outputs': [
93            '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc',
94            '<(PRODUCT_DIR)/test_data/chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).extjs',
95          ],
96          'process_outputs_as_sources': 1,
97          'action': [
98            'python',
99            '<(gypv8sh)',
100            '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)',
101            '<(mock_js)',
102            '<(test_api_js)',
103            '<(js2gtest)',
104            'extension',
105            '<(RULE_INPUT_PATH)',
106            'chrome/browser/resources/chromeos/chromevox/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).extjs',
107            '<@(_outputs)',
108          ],
109        },
110      ],
111      'sources': [
112        '<(DEPTH)/chrome/browser/ui/webui/web_ui_test_handler.cc',
113        '<(DEPTH)/chrome/browser/ui/webui/web_ui_test_handler.h',
114        '<(DEPTH)/chrome/test/base/browser_tests_main.cc',
115        '<(DEPTH)/chrome/test/base/extension_load_waiter_one_shot.cc',
116        '<(DEPTH)/chrome/test/base/extension_load_waiter_one_shot.h',
117        '<(DEPTH)/chrome/test/base/extension_js_browser_test.cc',
118        '<(DEPTH)/chrome/test/base/extension_js_browser_test.h',
119        '<(DEPTH)/chrome/test/base/javascript_browser_test.cc',
120        '<(DEPTH)/chrome/test/base/javascript_browser_test.h',
121        '<(DEPTH)/chrome/test/base/test_chrome_web_ui_controller_factory.cc',
122        '<(DEPTH)/chrome/test/base/test_chrome_web_ui_controller_factory.h',
123        '<(DEPTH)/chrome/test/base/web_ui_browser_test.cc',
124        '<(DEPTH)/chrome/test/base/web_ui_browser_test.h',
125        '<(DEPTH)/chrome/browser/extensions/browsertest_util.cc',
126        '<(DEPTH)/chrome/browser/extensions/browsertest_util.h',
127
128        'common/aria_util_test.unitjs',
129        'common/braille_text_handler_test.unitjs',
130        'common/braille_util_test.unitjs',
131        'common/command_store_test.unitjs',
132        'common/content_editable_extractor_test.unitjs',
133        'common/cursor_selection_test.unitjs',
134        'common/dom_util_test.unitjs',
135        'common/editable_text_area_shadow_test.unitjs',
136        'common/editable_text_test.unitjs',
137        'common/find_util_test.unitjs',
138        'common/key_sequence_test.unitjs',
139        'common/math_semantic_tree_test.unitjs',
140        'common/page_selection_test.unitjs',
141        'common/selection_util_test.unitjs',
142        'common/spannable_test.unitjs',
143        'chromevox/injected/event_watcher_test.unitjs',
144        'chromevox/injected/live_regions_test.unitjs',
145        'cvox2/background/background.extjs',
146        'host/chrome/braille_display_manager_test.unitjs',
147        'host/chrome/braille_input_handler_test.unitjs',
148        'host/chrome/braille_integration_test.unitjs',
149        'host/chrome/braille_table_test.extjs',
150        'host/chrome/expanding_braille_translator_test.unitjs',
151        'host/chrome/tts_background_test.extjs',
152        'liblouis_nacl/liblouis_test.extjs',
153        'walkers/character_walker_test.unitjs',
154        'walkers/group_walker_test.unitjs',
155        'walkers/object_walker_test.unitjs',
156        'walkers/layout_line_walker_test.unitjs',
157        'walkers/math_shifter_test.unitjs',
158        'walkers/sentence_walker_test.unitjs',
159        'walkers/structural_line_walker_test.unitjs',
160        'walkers/table_walker_test.unitjs',
161        'walkers/word_walker_test.unitjs',
162      ],
163    },  # target chromevox_tests
164    {
165      'target_name': 'chromevox_test_messages_js',
166      'type': 'none',
167      'actions': [
168        {
169          'action_name': 'test_messages_js',
170          'message': 'Generate <(_target_name)',
171          'variables': {
172            'english_messages_file': '<(chromevox_dest_dir)/_locales/en/messages.json',
173          },
174          'inputs': [
175            'tools/generate_test_messages.py',
176            '<(english_messages_file)',
177          ],
178          'outputs': [
179            '<(chromevox_test_messages_js_file)',
180          ],
181          'action': [
182            'python',
183            'tools/generate_test_messages.py',
184            '-o', '<(chromevox_test_messages_js_file)',
185            '<(english_messages_file)',
186          ],
187        },
188      ],
189    },  # target chromevox_test_messages_js
190    {
191      'target_name': 'chromevox_test_deps_js',
192      'type': 'none',
193      'actions': [
194        {
195          'action_name': 'deps_js',
196          'message': 'Generate <(_target_name)',
197          'variables': {
198            # Closure library directory relative to source tree root.
199            'closure_dir': 'chrome/third_party/chromevox/third_party/closure-library/closure/goog',
200            'depswriter_path': 'tools/generate_deps.py',
201            'js_files': [
202              '<!@(python tools/find_js_files.py . <(DEPTH)/<(closure_dir))',
203              '<(chromevox_test_messages_js_file)',
204            ],
205          },
206          'inputs': [
207            '<@(js_files)',
208            '<(depswriter_path)',
209          ],
210          'outputs': [
211            '<(chromevox_test_deps_js_file)',
212          ],
213          'action': [
214            'python',
215            '<(depswriter_path)',
216            '-w', '<(DEPTH)/<(closure_dir):<(closure_dir)',
217            '-w', '<(PRODUCT_DIR)/test_data:',
218            '-w', ':chrome/browser/resources/chromeos/chromevox',
219            '-o', '<(chromevox_test_deps_js_file)',
220            '<@(js_files)',
221          ],
222        },
223      ],
224      'dependencies': [
225        'chromevox_test_messages_js',
226      ],
227    },  # target chromevox_test_deps_js
228  ],
229}
230