diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-08 20:46:21 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-08 20:46:21 +0000 |
commit | 5d42633876f05084c16c0d0be13460230af3e3ec (patch) | |
tree | 9b76a716492b079348296db355651b9dad64f4d5 /base/test_suite.h | |
parent | e860d4df29efebdb22e76e625b0a08d4b507f3e9 (diff) | |
download | chromium_src-5d42633876f05084c16c0d0be13460230af3e3ec.zip chromium_src-5d42633876f05084c16c0d0be13460230af3e3ec.tar.gz chromium_src-5d42633876f05084c16c0d0be13460230af3e3ec.tar.bz2 |
fix base test harness to work on mac. fix command_line unit tests to match what windows expects. fix base xcode project to separate building and running unit tests into two targets.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/test_suite.h')
-rw-r--r-- | base/test_suite.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/test_suite.h b/base/test_suite.h index a021339..c9b0f12 100644 --- a/base/test_suite.h +++ b/base/test_suite.h @@ -34,14 +34,22 @@ // instantiate this class in your main function and call its Run method to run // any gtest based tests that are linked into your executable. +#include "build/build_config.h" + +#if defined(OS_WIN) #include <windows.h> +#endif #include "base/command_line.h" #include "base/debug_on_start.h" #include "base/icu_util.h" #include "base/logging.h" +#if defined(OS_WIN) +// TODO(pinkerton): re-enable this when MessageLoop can be included by +// non-windows platforms. #include "base/message_loop.h" #include "base/multiprocess_test.h" +#endif #include "testing/gtest/include/gtest/gtest.h" class TestSuite { @@ -51,16 +59,19 @@ class TestSuite { } virtual ~TestSuite() { +#if defined(OS_WIN) // Flush any remaining messages. This ensures that any accumulated Task // objects get destroyed before we exit, which avoids noise in purify // leak-test results. message_loop_.Quit(); message_loop_.Run(); +#endif } int Run() { Initialize(); +#if defined(OS_WIN) // Check to see if we are being run as a client process. std::wstring client_func = parsed_command_line_.GetSwitchValue(kRunClientProcess); @@ -77,6 +88,7 @@ class TestSuite { return func(); return -1; } +#endif return RUN_ALL_TESTS(); } @@ -86,6 +98,7 @@ class TestSuite { FAIL() << str; } +#if defined(OS_WIN) // Disable crash dialogs so that it doesn't gum up the buildbot virtual void SuppressErrorDialogs() { UINT new_flags = SEM_FAILCRITICALERRORS | @@ -96,20 +109,25 @@ class TestSuite { UINT existing_flags = SetErrorMode(new_flags); SetErrorMode(existing_flags | new_flags); } +#endif virtual void Initialize() { +#if defined(OS_WIN) // In some cases, we do not want to see standard error dialogs. if (!IsDebuggerPresent() && !parsed_command_line_.HasSwitch(L"show-error-dialogs")) { SuppressErrorDialogs(); logging::SetLogAssertHandler(UnitTestAssertHandler); } +#endif icu_util::Initialize(); } CommandLine parsed_command_line_; +#if defined(OS_WIN) MessageLoop message_loop_; +#endif }; #endif // BASE_TEST_SUITE_H__ |