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 5import("//build/config/features.gni") 6import("//build/config/linux/pkg_config.gni") 7import("//build/config/ui.gni") 8import("//mojo/public/tools/bindings/mojom.gni") 9import("//testing/libfuzzer/fuzzer_test.gni") 10import("//testing/test.gni") 11import("//tools/json_schema_compiler/json_schema_api.gni") 12import("//ui/base/ui_features.gni") 13 14if (is_android) { 15 import("//build/config/android/rules.gni") 16} 17 18if (is_win) { 19 import("//build/toolchain/win/midl.gni") 20} 21 22mojom("ax_constants_mojo") { 23 sources = [ "ax_constants.mojom" ] 24} 25 26mojom_component("ax_enums_mojo") { 27 sources = [ "ax_enums.mojom" ] 28 29 macro_prefix = "UI_ACCESSIBILITY_AX_MOJOM" 30 output_prefix = "ui_accessibility_ax_mojom" 31} 32 33# A tiny subset of accessibility code that's allowed to be 34# included by Blink. The rule of thumb (for now) is that it's 35# anything platform-neutral (no platform/ directory) that 36# relates to a single accessibility node (no trees, etc.). 37component("ax_base") { 38 defines = [ "AX_BASE_IMPLEMENTATION" ] 39 40 sources = [ 41 "accessibility_features.cc", 42 "accessibility_features.h", 43 "accessibility_switches.cc", 44 "accessibility_switches.h", 45 "ax_base_export.h", 46 "ax_enum_util.cc", 47 "ax_enum_util.h", 48 "ax_event.cc", 49 "ax_event.h", 50 "ax_event_intent.cc", 51 "ax_event_intent.h", 52 "ax_mode.cc", 53 "ax_mode.h", 54 "ax_node_data.cc", 55 "ax_node_data.h", 56 "ax_node_text_styles.cc", 57 "ax_node_text_styles.h", 58 "ax_relative_bounds.cc", 59 "ax_relative_bounds.h", 60 "ax_role_properties.cc", 61 "ax_role_properties.h", 62 "ax_tree_id.cc", 63 "ax_tree_id.h", 64 ] 65 66 public_deps = [ 67 ":ax_constants_mojo", 68 ":ax_enums_mojo", 69 "//base", 70 "//base:i18n", 71 "//base/util/values:values_util", 72 "//ui/base", 73 "//ui/gfx", 74 "//ui/gfx/geometry", 75 "//ui/strings", 76 ] 77} 78 79#if (is_win) { 80# midl("ichromeaccessible") { 81# sources = [ 82# "platform/ichromeaccessible.idl", 83# ] 84# } 85#} 86 87component("accessibility") { 88 defines = [ "AX_IMPLEMENTATION" ] 89 90 sources = [ 91 "ax_action_data.cc", 92 "ax_action_data.h", 93 "ax_action_handler.cc", 94 "ax_action_handler.h", 95 "ax_action_handler_base.cc", 96 "ax_action_handler_base.h", 97 "ax_action_target.h", 98 "ax_active_popup.cc", 99 "ax_active_popup.h", 100 "ax_clipping_behavior.h", 101 "ax_coordinate_system.h", 102 "ax_event_bundle_sink.h", 103 "ax_event_generator.cc", 104 "ax_event_generator.h", 105 "ax_export.h", 106 "ax_language_detection.cc", 107 "ax_language_detection.h", 108 "ax_mode_observer.h", 109 "ax_node.cc", 110 "ax_node.h", 111 "ax_node_position.cc", 112 "ax_node_position.h", 113 "ax_offscreen_result.h", 114 "ax_position.h", 115 "ax_range.h", 116 "ax_serializable_tree.cc", 117 "ax_serializable_tree.h", 118 "ax_table_info.cc", 119 "ax_table_info.h", 120 "ax_text_utils.cc", 121 "ax_text_utils.h", 122 "ax_tree.cc", 123 "ax_tree.h", 124 "ax_tree_combiner.cc", 125 "ax_tree_combiner.h", 126 "ax_tree_data.cc", 127 "ax_tree_data.h", 128 "ax_tree_id_registry.cc", 129 "ax_tree_id_registry.h", 130 "ax_tree_manager.h", 131 "ax_tree_manager_map.cc", 132 "ax_tree_manager_map.h", 133 "ax_tree_observer.cc", 134 "ax_tree_observer.h", 135 "ax_tree_serializer.cc", 136 "ax_tree_serializer.h", 137 "ax_tree_source.h", 138 "ax_tree_source_checker.h", 139 "ax_tree_update.h", 140 "ax_tree_update_forward.h", 141 "null_ax_action_target.cc", 142 "null_ax_action_target.h", 143 ] 144 145 deps = [ 146 "//base/util/values:values_util", 147 "//third_party/cld_3/src/src:cld_3", 148 ] 149 150 public_deps = [ 151 ":ax_base", 152 "//ui/accessibility/platform", 153 ] 154 155 # Allows the files from //ui/accessibility/platform includes headers 156 # from this directory. 157 allow_circular_includes_from = [ "//ui/accessibility/platform" ] 158 159 if (!is_ios) { 160 sources += [ 161 "ax_param_traits.cc", 162 "ax_param_traits.h", 163 "ax_param_traits_macros.h", 164 ] 165 166 public_deps += [ 167 "//ipc", 168 "//ui/gfx/ipc/skia", 169 ] 170 } 171 172 if (use_aura) { 173 sources += [ 174 "aura/aura_window_properties.cc", 175 "aura/aura_window_properties.h", 176 ] 177 178 public_deps += [ "//ui/aura" ] 179 } 180} 181 182source_set("ax_assistant") { 183 sources = [ 184 "ax_assistant_structure.cc", 185 "ax_assistant_structure.h", 186 ] 187 188 deps = [ ":accessibility" ] 189} 190 191static_library("test_support") { 192 testonly = true 193 sources = [ 194 "test_ax_node_helper.cc", 195 "test_ax_node_helper.h", 196 "test_ax_tree_manager.cc", 197 "test_ax_tree_manager.h", 198 "tree_generator.cc", 199 "tree_generator.h", 200 ] 201 202 if (has_native_accessibility) { 203 sources += [ 204 "platform/test_ax_node_wrapper.cc", 205 "platform/test_ax_node_wrapper.h", 206 ] 207 } 208 209 deps = [ ":accessibility" ] 210} 211 212test("accessibility_unittests") { 213 testonly = true 214 sources = [ 215 "ax_enum_util_unittest.cc", 216 "ax_event_generator_unittest.cc", 217 "ax_generated_tree_unittest.cc", 218 "ax_language_detection_unittest.cc", 219 "ax_node_data_unittest.cc", 220 "ax_node_position_unittest.cc", 221 "ax_range_unittest.cc", 222 "ax_role_properties_unittest.cc", 223 "ax_table_info_unittest.cc", 224 "ax_text_utils_unittest.cc", 225 "ax_tree_combiner_unittest.cc", 226 "ax_tree_serializer_unittest.cc", 227 "ax_tree_source_checker_unittest.cc", 228 "ax_tree_unittest.cc", 229 "mojom/ax_action_data_mojom_traits_unittest.cc", 230 "mojom/ax_event_intent_mojom_traits_unittest.cc", 231 "mojom/ax_event_mojom_traits_unittest.cc", 232 "mojom/ax_node_data_mojom_traits_unittest.cc", 233 "mojom/ax_relative_bounds_mojom_traits_unittest.cc", 234 "mojom/ax_tree_data_mojom_traits_unittest.cc", 235 "mojom/ax_tree_id_mojom_traits_unittest.cc", 236 "mojom/ax_tree_update_mojom_traits_unittest.cc", 237 "null_ax_action_target_unittest.cc", 238 "platform/ax_platform_node_unittest.cc", 239 "platform/ax_platform_node_unittest.h", 240 "platform/ax_unique_id_unittest.cc", 241 "platform/inspect/property_node_unittest.cc", 242 "run_all_unittests.cc", 243 ] 244 245 deps = [ 246 ":accessibility", 247 ":test_support", 248 "//base/test:test_support", 249 "//ipc", 250 "//mojo/core/embedder", 251 "//mojo/core/test:test_support", 252 "//mojo/public/cpp/test_support:test_utils", 253 "//skia", 254 "//testing/gmock", 255 "//testing/gtest", 256 "//ui/accessibility/mojom", 257 "//ui/gfx:test_support", 258 ] 259 260 if (has_native_accessibility) { 261 # This test depends heavily on NativeViewAccessible, which is only 262 # implemented on these platforms. 263 sources += [ "platform/ax_platform_node_base_unittest.cc" ] 264 265 if (is_win) { 266 sources += [ 267 "platform/ax_fragment_root_win_unittest.cc", 268 "platform/ax_platform_node_textchildprovider_win_unittest.cc", 269 "platform/ax_platform_node_textprovider_win_unittest.cc", 270 "platform/ax_platform_node_textrangeprovider_win_unittest.cc", 271 "platform/ax_platform_node_win_unittest.cc", 272 "platform/ax_platform_node_win_unittest.h", 273 ] 274 275 deps += [ 276 "//third_party/iaccessible2", 277 "//ui/accessibility/platform:ichromeaccessible", 278 ] 279 280 libs = [ 281 "oleacc.lib", 282 "uiautomationcore.lib", 283 ] 284 } 285 286 if (use_atk) { 287 sources += [ 288 "platform/atk_util_auralinux_unittest.cc", 289 "platform/ax_platform_node_auralinux_unittest.cc", 290 ] 291 292 configs += [ "//build/config/linux/atk" ] 293 } 294 } 295} 296 297fuzzer_test("ax_tree_fuzzer") { 298 sources = [ "ax_tree_fuzzer.cc" ] 299 300 deps = [ ":accessibility" ] 301} 302 303fuzzer_test("ax_table_fuzzer") { 304 sources = [ "ax_table_fuzzer.cc" ] 305 306 deps = [ ":accessibility" ] 307 308 seed_corpus = "fuzz_corpus" 309} 310 311test("accessibility_perftests") { 312 testonly = true 313 sources = [ "ax_node_position_perftest.cc" ] 314 315 deps = [ 316 ":test_support", 317 "//base", 318 "//base/test:test_support", 319 "//mojo/core/test:run_all_unittests", 320 "//skia", 321 "//testing/gmock", 322 "//testing/gtest", 323 "//testing/perf", 324 "//ui/accessibility/mojom", 325 ] 326} 327