Commit 0c37d946 authored by garykac@chromium.org's avatar garykac@chromium.org

Re-enable basic JS unittests for Chromoting.

This doesn't suffer from the ninja build problems that the first version had.

BUG=none
TEST=ninja chrome; make chrome; make remoting_unittests


Review URL: https://chromiumcodereview.appspot.com/8779002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161401 0039d316-1c4b-4281-b951-d872f2087c98
parent 51575a3a
...@@ -7,15 +7,21 @@ ...@@ -7,15 +7,21 @@
// (required for JS unittests) without updating the DEPS file for each // (required for JS unittests) without updating the DEPS file for each
// subproject. // subproject.
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "net/socket/ssl_server_socket.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv); base::TestSuite test_suite(argc, argv);
#if defined(OS_MACOSX) || defined(OS_LINUX)
// This is required for the JavaScript unittests. // This is required for the JavaScript unittests.
chrome::RegisterPathProvider(); chrome::RegisterPathProvider();
#endif // defined(OS_MACOSX) || defined(OS_LINUX)
// Enable support for SSL server sockets, which must be done while
// single-threaded.
net::EnableSSLServerSockets();
return test_suite.Run(); return test_suite.Run();
} }
...@@ -207,6 +207,10 @@ ...@@ -207,6 +207,10 @@
], ],
}, },
'includes': [
'../chrome/js_unittest_vars.gypi',
],
'target_defaults': { 'target_defaults': {
'defines': [ 'defines': [
], ],
...@@ -1986,6 +1990,7 @@ ...@@ -1986,6 +1990,7 @@
'../testing/gmock/include', '../testing/gmock/include',
], ],
'sources': [ 'sources': [
'../chrome/test/base/run_all_remoting_unittests.cc',
'base/auth_token_util_unittest.cc', 'base/auth_token_util_unittest.cc',
'base/auto_thread_unittest.cc', 'base/auto_thread_unittest.cc',
'base/auto_thread_task_runner_unittest.cc', 'base/auto_thread_task_runner_unittest.cc',
...@@ -2069,7 +2074,6 @@ ...@@ -2069,7 +2074,6 @@
'protocol/ppapi_module_stub.cc', 'protocol/ppapi_module_stub.cc',
'protocol/ssl_hmac_channel_authenticator_unittest.cc', 'protocol/ssl_hmac_channel_authenticator_unittest.cc',
'protocol/v2_authenticator_unittest.cc', 'protocol/v2_authenticator_unittest.cc',
'run_all_unittests.cc',
], ],
'conditions': [ 'conditions': [
[ 'OS=="win"', { [ 'OS=="win"', {
...@@ -2084,6 +2088,34 @@ ...@@ -2084,6 +2088,34 @@
'-lrpcrt4.lib', '-lrpcrt4.lib',
], ],
}, },
}, { # else OS != "win"
# Javascript unittests are disabled on Windows because they add a
# dependency on 'common_constants' which (only on Windows) requires
# additional dependencies:
# '../content/content.gyp:content_common',
# 'installer_util',
# These targets are defined in .gypi files that would need to be
# included here:
# '../chrome/chrome_common.gypi',
# '../chrome/chrome_installer.gypi',
# '../chrome/chrome_installer_util.gypi',
# But we can't do that because ninja will complain about multiple
# target definitions.
# TODO(garykac): Move installer_util into a proper .gyp file so that
# it can be included in multiple .gyp files.
'includes': [
'../chrome/js_unittest_rules.gypi',
],
'dependencies': [
'../chrome/common_constants.gyp:common_constants',
'../v8/tools/gyp/v8.gyp:v8',
],
'sources': [
'../chrome/test/base/v8_unit_test.cc',
'../chrome/test/base/v8_unit_test.h',
'webapp/format_iq.gtestjs',
'webapp/format_iq.js',
],
}], }],
['chromeos != 0', { ['chromeos != 0', {
'dependencies!': [ 'dependencies!': [
...@@ -2110,7 +2142,7 @@ ...@@ -2110,7 +2142,7 @@
}, },
], ],
], ],
}], }], # end of 'toolkit_uses_gtk == 1'
], # end of 'conditions' ], # end of 'conditions'
}, # end of target 'remoting_unittests' }, # end of target 'remoting_unittests'
], # end of targets ], # end of targets
......
// Copyright (c) 2012 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/test/test_suite.h"
#include "net/socket/ssl_server_socket.h"
int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv);
// Enable support for SSL server sockets, which must be done while
// single-threaded.
net::EnableSSLServerSockets();
return test_suite.Run();
}
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** /**
* Test fixture for debug logging routines. * Test fixture for IQ formatting routines.
* @constructor * @constructor
* @extends {testing.Test} * @extends {testing.Test}
*/ */
function DebugLogUnitTest () {} function FormatIqUnitTest () {
remoting.formatIq = new remoting.FormatIq();
remoting.formatIq.setJids("client@jid", "host@jid");
}
DebugLogUnitTest.prototype = { FormatIqUnitTest.prototype = {
__proto__: testing.Test.prototype, __proto__: testing.Test.prototype,
/** @inheritDoc */ /** @inheritDoc */
extraLibraries: [ extraLibraries: [
'debug_log.js', 'format_iq.js',
], ],
}; };
// Dummy test to verify that the JS Unittest framework is working and that // Basic test to verify that the JS Unittest framework is working and that
// debug_log.js loads without console errors. // format_iq.js loads without console errors.
// TODO(garykac): Replace this with real tests. // TODO(garykac): Add real unittests here.
TEST_F('DebugLogUnitTest', 'TestJsLoad', function() { TEST_F('FormatIqUnitTest', 'TestJsLoad', function() {
assertTrue(true); assertTrue(true);
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment