diff options
-rw-r--r-- | chrome/chrome_common.gypi | 64 | ||||
-rw-r--r-- | chrome/chrome_installer.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_installer_util.gypi | 8 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 57 | ||||
-rw-r--r-- | chrome/js_unittest_rules.gypi | 77 | ||||
-rw-r--r-- | chrome/js_unittest_vars.gypi | 12 | ||||
-rw-r--r-- | chrome/test/base/run_all_remoting_unittests.cc | 21 | ||||
-rw-r--r-- | remoting/remoting.gyp | 46 | ||||
-rw-r--r-- | remoting/run_all_unittests.cc | 13 | ||||
-rw-r--r-- | remoting/webapp/me2mom/debug_log.gtestjs | 26 |
10 files changed, 223 insertions, 103 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index ed15ce2..15a2ed54 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -25,31 +25,31 @@ # TODO(gregoryd): chrome_resources and chrome_strings could be # shared with the 64-bit target, but it does not work due to a gyp # issue. - 'app/policy/cloud_policy_codegen.gyp:policy', - 'chrome_resources.gyp:chrome_resources', - 'chrome_resources.gyp:chrome_strings', - 'chrome_resources.gyp:theme_resources', 'common_constants', 'common_net', 'common_version', - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../base/base.gyp:base_static', - '../build/temp_gyp/googleurl.gyp:googleurl', - '../content/content.gyp:content_common', - '../ipc/ipc.gyp:ipc', - '../net/net.gyp:net', - '../printing/printing.gyp:printing', - '../skia/skia.gyp:skia', - '../third_party/bzip2/bzip2.gyp:bzip2', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', - '../third_party/libxml/libxml.gyp:libxml', - '../third_party/sqlite/sqlite.gyp:sqlite', - '../third_party/zlib/zlib.gyp:zlib', - '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', - '../webkit/support/webkit_support.gyp:glue', + '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/base/base.gyp:base_i18n', + '<(DEPTH)/base/base.gyp:base_static', + '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', + '<(DEPTH)/chrome/app/policy/cloud_policy_codegen.gyp:policy', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', + '<(DEPTH)/chrome/chrome_resources.gyp:theme_resources', + '<(DEPTH)/content/content.gyp:content_common', + '<(DEPTH)/ipc/ipc.gyp:ipc', + '<(DEPTH)/net/net.gyp:net', + '<(DEPTH)/printing/printing.gyp:printing', + '<(DEPTH)/skia/skia.gyp:skia', + '<(DEPTH)/third_party/bzip2/bzip2.gyp:bzip2', + '<(DEPTH)/third_party/icu/icu.gyp:icui18n', + '<(DEPTH)/third_party/icu/icu.gyp:icuuc', + '<(DEPTH)/third_party/libxml/libxml.gyp:libxml', + '<(DEPTH)/third_party/sqlite/sqlite.gyp:sqlite', + '<(DEPTH)/third_party/zlib/zlib.gyp:zlib', + '<(DEPTH)/ui/ui.gyp:ui_resources', + '<(DEPTH)/ui/ui.gyp:ui_resources_standard', + '<(DEPTH)/webkit/support/webkit_support.gyp:glue', ], 'sources': [ 'common/about_handler.cc', @@ -251,7 +251,7 @@ }], ['OS=="win" and use_aura==0', { 'dependencies': [ - 'default_plugin/default_plugin.gyp:default_plugin', + '<(DEPTH)/chrome/default_plugin/default_plugin.gyp:default_plugin', ] }], ['toolkit_uses_gtk == 1', { @@ -384,15 +384,15 @@ 'common/net/x509_certificate_model.h', ], 'dependencies': [ - 'chrome_resources.gyp:chrome_resources', - 'chrome_resources.gyp:chrome_strings', - '../base/base.gyp:base', - '../crypto/crypto.gyp:crypto', - '../gpu/gpu.gyp:gpu_ipc', - '../net/net.gyp:net_resources', - '../net/net.gyp:net', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', + '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', + '<(DEPTH)/crypto/crypto.gyp:crypto', + '<(DEPTH)/gpu/gpu.gyp:gpu_ipc', + '<(DEPTH)/net/net.gyp:net_resources', + '<(DEPTH)/net/net.gyp:net', + '<(DEPTH)/third_party/icu/icu.gyp:icui18n', + '<(DEPTH)/third_party/icu/icu.gyp:icuuc', ], 'conditions': [ ['os_posix == 1 and OS != "mac"', { diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi index 51dcf0f..e08ab25 100644 --- a/chrome/chrome_installer.gypi +++ b/chrome/chrome_installer.gypi @@ -71,11 +71,11 @@ 'dependencies': [ 'installer_util', 'installer_util_strings', - '../content/content.gyp:content_common', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/base/base.gyp:test_support_base', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', + '<(DEPTH)/content/content.gyp:content_common', '<(DEPTH)/testing/gmock.gyp:gmock', '<(DEPTH)/testing/gtest.gyp:gtest', ], diff --git a/chrome/chrome_installer_util.gypi b/chrome/chrome_installer_util.gypi index 95bb537..450ff7b 100644 --- a/chrome/chrome_installer_util.gypi +++ b/chrome/chrome_installer_util.gypi @@ -98,11 +98,11 @@ 'dependencies': [ 'installer_util_strings', 'common_constants', - 'chrome_resources.gyp:chrome_resources', - 'chrome_resources.gyp:chrome_strings', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', '<(DEPTH)/content/content.gyp:content_common', '<(DEPTH)/courgette/courgette.gyp:courgette_lib', '<(DEPTH)/third_party/bspatch/bspatch.gyp:bspatch', @@ -182,8 +182,8 @@ 'type': 'static_library', 'dependencies': [ 'common_constants', - 'chrome_resources.gyp:chrome_resources', - 'chrome_resources.gyp:chrome_strings', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', + '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', ], 'sources': [ 'installer/util/master_preferences.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 6705dac..b061f10 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -3,12 +3,6 @@ # found in the LICENSE file. { 'variables' : { - # Variables for js2gtest rules - 'gypv8sh': '../tools/gypv8sh.py', - 'js2gtest': 'test/base/js2gtest.js', - 'mock_js': 'third_party/mock4js/mock4js.js', - 'test_api_js': 'test/data/webui/test_api.js', - 'pyautolib_sources': [ 'app/chrome_command_ids.h', 'app/chrome_dll_resource.h', @@ -32,6 +26,9 @@ }], ], }, + 'includes': [ + 'js_unittest_vars.gypi', + ], 'targets': [ { # This target contains mocks and test utilities that don't belong in @@ -1180,6 +1177,10 @@ 'include_dirs': [ '..', ], + # TODO(scr): Use this in browser_tests too. + 'includes': [ + 'js_unittest_rules.gypi', + ], 'defines': [ 'CLD_WINDOWS', ], @@ -2023,50 +2024,6 @@ '../webkit/quota/mock_storage_client.cc', '../webkit/quota/mock_storage_client.h', ], - 'rules': [ - { - 'rule_name': 'copyjs', - 'extension': 'js', - 'msvs_external_rule': 1, - 'inputs': [ - '../build/cp.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', - ], - 'action': [ - 'python', - '<@(_inputs)', - '<(RULE_INPUT_PATH)', - '<@(_outputs)', - ], - }, - { - 'rule_name': 'js2unit', - 'extension': 'gtestjs', - 'msvs_external_rule': 1, - 'inputs': [ - '<(gypv8sh)', - '<(PRODUCT_DIR)/v8_shell<(EXECUTABLE_SUFFIX)', - '<(mock_js)', - '<(test_api_js)', - '<(js2gtest)', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc', - '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', - ], - 'process_outputs_as_sources': 1, - 'action': [ - 'python', - '<@(_inputs)', - 'unit', - '<(RULE_INPUT_PATH)', - 'chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', - '<@(_outputs)', - ], - }, - ], 'conditions': [ ['target_arch!="arm"', { 'dependencies': [ diff --git a/chrome/js_unittest_rules.gypi b/chrome/js_unittest_rules.gypi new file mode 100644 index 0000000..d650f627db --- /dev/null +++ b/chrome/js_unittest_rules.gypi @@ -0,0 +1,77 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This file defines rules that allow you to include JavaScript tests in +# your unittests target. + +# To add JS unittests to an existing unittest target, first include +# 'js_unittest_vars.gypi' at the top of your GYP file to define the required +# variables: +# +# 'includes': [ +# '<(DEPTH)/chrome/js_unittest_vars.gypi', +# ], +# +# Then include this rule file in each of your unittest targets: +# +# { +# 'target_name': 'my_unittests', +# ... +# 'includes': [ +# '<(DEPTH)/chrome/js_unittest_rules.gypi', +# ], +# } +# +# Note that when you run your TestSuite, you'll need to call +# chrome::RegisterPathProvider(). These path providers are required by +# src/chrome/test/base/v8_unit_test.cc to setup and run the tests. +# +# See src/chrome/test/base/run_all_remoting_unittests.cc for an example. + +{ + 'rules': [ + { + 'rule_name': 'copyjs', + 'extension': 'js', + 'msvs_external_rule': 1, + 'inputs': [ + '<(DEPTH)/build/cp.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', + ], + 'action': [ + 'python', + '<@(_inputs)', + '<(RULE_INPUT_PATH)', + '<@(_outputs)', + ], + }, + { + 'rule_name': 'js2unit', + 'extension': 'gtestjs', + 'msvs_external_rule': 1, + 'inputs': [ + '<(gypv8sh)', + '<(PRODUCT_DIR)/v8_shell<(EXECUTABLE_SUFFIX)', + '<(mock_js)', + '<(test_api_js)', + '<(js2gtest)', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)-gen.cc', + '<(PRODUCT_DIR)/test_data/chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', + '<@(_inputs)', + 'unit', + '<(RULE_INPUT_PATH)', + 'chrome/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).<(_extension)', + '<@(_outputs)', + ], + }, + ], +} diff --git a/chrome/js_unittest_vars.gypi b/chrome/js_unittest_vars.gypi new file mode 100644 index 0000000..7c4bebd --- /dev/null +++ b/chrome/js_unittest_vars.gypi @@ -0,0 +1,12 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables' : { + 'gypv8sh': '<(DEPTH)/tools/gypv8sh.py', + 'js2gtest': '<(DEPTH)/chrome/test/base/js2gtest.js', + 'mock_js': '<(DEPTH)/chrome/third_party/mock4js/mock4js.js', + 'test_api_js': '<(DEPTH)/chrome/test/data/webui/test_api.js', + }, +} diff --git a/chrome/test/base/run_all_remoting_unittests.cc b/chrome/test/base/run_all_remoting_unittests.cc new file mode 100644 index 0000000..efeb178 --- /dev/null +++ b/chrome/test/base/run_all_remoting_unittests.cc @@ -0,0 +1,21 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// A basic testrunner that supports JavaScript unittests. +// This lives in src/chrome/test/base so that it can include chrome_paths.h +// (required for JS unittests) without updating the DEPS file for each +// subproject. + + +#include "base/test/test_suite.h" +#include "chrome/common/chrome_paths.h" + +int main(int argc, char** argv) { + base::TestSuite test_suite(argc, argv); + + // This is required for the JavaScript unittests. + chrome::RegisterPathProvider(); + + return test_suite.Run(); +} diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index e81aa68..ac31f8b 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -11,6 +11,17 @@ # is brand-dependent and is defined further down. 'host_plugin_mime_type': 'application/vnd.chromium.remoting-host', 'host_plugin_description': 'Allow another user to access your computer securely over the Internet.', + + # Variables for common_constants (used by JS unittests). + 'variables': { + 'version_py_path': '../chrome/tools/build/version.py', + 'version_path': '../chrome/VERSION', + }, + 'version_py_path': '<(version_py_path)', + 'version_path': '<(version_path)', + 'version_full': + '<!(python <(version_py_path) -f <(version_path) -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")', + 'conditions': [ ['OS=="mac"', { 'conditions': [ @@ -138,6 +149,12 @@ ], }, + 'includes': [ + # The common_constants target is needed for the JS unittests. + '../chrome/common_constants.gypi', + '../chrome/js_unittest_vars.gypi', + ], + 'target_defaults': { 'defines': [ ], @@ -147,6 +164,14 @@ }, 'conditions': [ + ['OS == "win"', { + 'includes': [ + # Required for JS unittests. + '../chrome/chrome_common.gypi', + '../chrome/chrome_installer.gypi', + '../chrome/chrome_installer_util.gypi', + ], + }], # 'OS == "win"' ['os_posix == 1', { 'targets': [ # Simple webserver for testing remoting client plugin. @@ -158,7 +183,7 @@ ], } ], # end of target 'remoting_client_test_webserver' - }], + }], # 'os_posix == 1' ['OS=="linux"', { 'targets': [ # Linux breakpad processing @@ -865,6 +890,7 @@ 'target_name': 'remoting_unittests', 'type': 'executable', 'dependencies': [ + 'common_constants', # from common_constants.gypi 'remoting_base', 'remoting_client', 'remoting_host', @@ -874,14 +900,21 @@ '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', '../media/media.gyp:media', - '../ui/ui.gyp:ui', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', + '../ui/ui.gyp:ui', + '../v8/tools/gyp/v8.gyp:v8', ], 'include_dirs': [ '../testing/gmock/include', ], + 'includes': [ + '../chrome/js_unittest_rules.gypi', + ], 'sources': [ + '../chrome/test/base/v8_unit_test.cc', + '../chrome/test/base/v8_unit_test.h', + '../chrome/test/base/run_all_remoting_unittests.cc', 'base/auth_token_util_unittest.cc', 'base/codec_test.cc', 'base/codec_test.h', @@ -931,7 +964,8 @@ 'protocol/rtp_video_reader_unittest.cc', 'protocol/rtp_video_writer_unittest.cc', 'protocol/v1_authenticator_unittest.cc', - 'run_all_unittests.cc', + 'webapp/me2mom/debug_log.gtestjs', + 'webapp/me2mom/debug_log.js', ], 'conditions': [ ['toolkit_uses_gtk == 1', { @@ -952,6 +986,12 @@ ], ], }], + ['OS == "win"', { + 'dependencies': [ + # Required for JS unittests. + 'installer_util', + ], + }], # 'OS == "win"' ], # end of 'conditions' }, # end of target 'remoting_unittests' ], # end of targets diff --git a/remoting/run_all_unittests.cc b/remoting/run_all_unittests.cc deleted file mode 100644 index 187fb89..0000000 --- a/remoting/run_all_unittests.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/test/test_suite.h" - -int main(int argc, char** argv) { - base::TestSuite test_suite(argc, argv); - return test_suite.Run(); -} diff --git a/remoting/webapp/me2mom/debug_log.gtestjs b/remoting/webapp/me2mom/debug_log.gtestjs new file mode 100644 index 0000000..002f0fe --- /dev/null +++ b/remoting/webapp/me2mom/debug_log.gtestjs @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * Test fixture for debug logging routines. + * @constructor + * @extends {testing.Test} + */ +function DebugLogUnitTest () {} + +DebugLogUnitTest.prototype = { + __proto__: testing.Test.prototype, + + /** @inheritDoc */ + extraLibraries: [ + 'debug_log.js', + ], +}; + +// Dummy test to verify that the JS Unittest framework is working and that +// debug_log.js loads without console errors. +// TODO(garykac): Replace this with real tests. +TEST_F('DebugLogUnitTest', 'TestJsLoad', function() { + assertTrue(true); +}); |