1# Copyright (c) 2011 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# This file defines rules that allow you to include JavaScript tests in 6# your unittests target. 7 8# To add JS unittests to an existing unittest target, first include 9# 'js_unittest_vars.gypi' at the top of your GYP file to define the required 10# variables: 11# 12# 'includes': [ 13# '<(DEPTH)/chrome/js_unittest_vars.gypi', 14# ], 15# 16# Then include this rule file in each of your unittest targets: 17# 18# { 19# 'target_name': 'my_unittests', 20# ... 21# 'includes': [ 22# '<(DEPTH)/chrome/js_unittest_rules.gypi', 23# ], 24# } 25# 26# Note that when you run your TestSuite, you'll need to call 27# chrome::RegisterPathProvider(). These path providers are required by 28# src/chrome/test/base/v8_unit_test.cc to setup and run the tests. 29 30{ 31 'dependencies': [ 32 # Used by rule js2unit below. 33 '../v8/src/d8.gyp:d8#host', 34 ], 35 'rules': [ 36 { 37 'rule_name': 'copyjs', 38 'extension': 'js', 39 'msvs_external_rule': 1, 40 'inputs': [ 41 '<(DEPTH)/build/cp.py', 42 ], 43 'outputs': [ 44 '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', 45 ], 46 'action': [ 47 'python', 48 '<@(_inputs)', 49 '<(RULE_INPUT_PATH)', 50 '<@(_outputs)', 51 ], 52 }, 53 { 54 'rule_name': 'js2unit', 55 'extension': 'gtestjs', 56 'msvs_external_rule': 1, 57 'inputs': [ 58 '<(gypv8sh)', 59 '<(PRODUCT_DIR)/d8<(EXECUTABLE_SUFFIX)', 60 '<(mock_js)', 61 '<(test_api_js)', 62 '<(js2gtest)', 63 ], 64 'outputs': [ 65 '<(INTERMEDIATE_DIR)/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc', 66 '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', 67 ], 68 'process_outputs_as_sources': 1, 69 'action': [ 70 'python', 71 '<@(_inputs)', 72 'unit', 73 '<(RULE_INPUT_PATH)', 74 'chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', 75 '<@(_outputs)', 76 ], 77 }, 78 ], 79} 80