Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/bindings/bindings_tests.py

Issue 2458913003: Add first sketch of the webmodules code generator. (Closed)
Patch Set: Ready to land. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/WebTestInterface3.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 1. Redistributions of source code must retain the above copyright 6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright 8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the 9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution. 10 # documentation and/or other materials provided with the distribution.
(...skipping 26 matching lines...) Expand all
37 module_path = os.path.dirname(__file__) 37 module_path = os.path.dirname(__file__)
38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, 38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir,
39 os.pardir, os.pardir, 'Source')) 39 os.pardir, os.pardir, 'Source'))
40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts') 40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts')
41 sys.path.append(bindings_script_path) # for Source/bindings imports 41 sys.path.append(bindings_script_path) # for Source/bindings imports
42 42
43 from code_generator_v8 import CodeGeneratorDictionaryImpl 43 from code_generator_v8 import CodeGeneratorDictionaryImpl
44 from code_generator_v8 import CodeGeneratorV8 44 from code_generator_v8 import CodeGeneratorV8
45 from code_generator_v8 import CodeGeneratorUnionType 45 from code_generator_v8 import CodeGeneratorUnionType
46 from code_generator_v8 import CodeGeneratorCallbackFunction 46 from code_generator_v8 import CodeGeneratorCallbackFunction
47 from code_generator_web_module import CodeGeneratorWebModule
47 from compute_interfaces_info_individual import InterfaceInfoCollector 48 from compute_interfaces_info_individual import InterfaceInfoCollector
48 from compute_interfaces_info_overall import (compute_interfaces_info_overall, 49 from compute_interfaces_info_overall import (compute_interfaces_info_overall,
49 interfaces_info) 50 interfaces_info)
50 from idl_compiler import (generate_bindings, 51 from idl_compiler import (generate_bindings,
51 generate_union_type_containers, 52 generate_union_type_containers,
52 generate_dictionary_impl, 53 generate_dictionary_impl,
53 generate_callback_function_impl) 54 generate_callback_function_impl)
54 from utilities import ComponentInfoProviderCore 55 from utilities import ComponentInfoProviderCore
55 from utilities import ComponentInfoProviderModules 56 from utilities import ComponentInfoProviderModules
56 from utilities import write_file 57 from utilities import write_file
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 idl_basename = os.path.basename(idl_path) 323 idl_basename = os.path.basename(idl_path)
323 definition_name, _ = os.path.splitext(idl_basename) 324 definition_name, _ = os.path.splitext(idl_basename)
324 if definition_name in interfaces_info: 325 if definition_name in interfaces_info:
325 interface_info = interfaces_info[definition_name] 326 interface_info = interfaces_info[definition_name]
326 if interface_info['is_dictionary']: 327 if interface_info['is_dictionary']:
327 dictionary_impl_filenames.append(idl_path) 328 dictionary_impl_filenames.append(idl_path)
328 if component == 'core' and interface_info[ 329 if component == 'core' and interface_info[
329 'dependencies_other_component_full_paths']: 330 'dependencies_other_component_full_paths']:
330 partial_interface_filenames.append(idl_path) 331 partial_interface_filenames.append(idl_path)
331 332
333 info_provider = component_info_providers[component]
334 partial_interface_info_provider = component_info_providers['modules' ]
335
332 generate_union_type_containers(CodeGeneratorUnionType, 336 generate_union_type_containers(CodeGeneratorUnionType,
333 component_info_providers[component], 337 info_provider, options)
334 options)
335 generate_callback_function_impl(CodeGeneratorCallbackFunction, 338 generate_callback_function_impl(CodeGeneratorCallbackFunction,
336 component_info_providers[component], 339 info_provider, options)
337 options)
338 generate_bindings( 340 generate_bindings(
339 CodeGeneratorV8, 341 CodeGeneratorV8,
340 component_info_providers[component], 342 info_provider,
343 options,
344 idl_filenames)
345 generate_bindings(
346 CodeGeneratorWebModule,
347 info_provider,
341 options, 348 options,
342 idl_filenames) 349 idl_filenames)
343 generate_bindings( 350 generate_bindings(
344 CodeGeneratorV8, 351 CodeGeneratorV8,
345 component_info_providers['modules'], 352 partial_interface_info_provider,
346 partial_interface_options, 353 partial_interface_options,
347 partial_interface_filenames) 354 partial_interface_filenames)
348 generate_dictionary_impl( 355 generate_dictionary_impl(
349 CodeGeneratorDictionaryImpl, 356 CodeGeneratorDictionaryImpl,
350 component_info_providers[component], 357 info_provider,
351 options, 358 options,
352 dictionary_impl_filenames) 359 dictionary_impl_filenames)
353 360
354 finally: 361 finally:
355 delete_cache_files() 362 delete_cache_files()
356 363
357 # Detect all changes 364 # Detect all changes
358 output_files = list_files(output_directory) 365 output_files = list_files(output_directory)
359 passed = identical_output_files(output_files) 366 passed = identical_output_files(output_files)
360 passed &= no_excess_files(output_files) 367 passed &= no_excess_files(output_files)
361 368
362 if passed: 369 if passed:
363 if verbose: 370 if verbose:
364 print 371 print
365 print PASS_MESSAGE 372 print PASS_MESSAGE
366 return 0 373 return 0
367 print 374 print
368 print FAIL_MESSAGE 375 print FAIL_MESSAGE
369 return 1 376 return 1
370 377
371 378
372 def run_bindings_tests(reset_results, verbose): 379 def run_bindings_tests(reset_results, verbose):
373 # Generate output into the reference directory if resetting results, or 380 # Generate output into the reference directory if resetting results, or
374 # a temp directory if not. 381 # a temp directory if not.
375 if reset_results: 382 if reset_results:
376 print 'Resetting results' 383 print 'Resetting results'
377 return bindings_tests(reference_directory, verbose) 384 return bindings_tests(reference_directory, verbose)
378 with TemporaryDirectory() as temp_dir: 385 with TemporaryDirectory() as temp_dir:
379 return bindings_tests(temp_dir, verbose) 386 return bindings_tests(temp_dir, verbose)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/WebTestInterface3.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698