summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 06:26:01 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 06:26:01 +0000
commit10156ef03d6985f8c0a9def13b02ad6fc3cee7f9 (patch)
tree29464d4bd2014397b5130f05c2acc52fc1d3397d /webkit
parent32cba2b85543286544bf1a613fa7819e295a36a4 (diff)
downloadchromium_src-10156ef03d6985f8c0a9def13b02ad6fc3cee7f9.zip
chromium_src-10156ef03d6985f8c0a9def13b02ad6fc3cee7f9.tar.gz
chromium_src-10156ef03d6985f8c0a9def13b02ad6fc3cee7f9.tar.bz2
GTTF: Make test_shell_tests use base/test_suite.h
This allows us to share more code, and also makes FLAKY_ and FAILS_ prefixes work in test_shell_tests. BUG=none TEST=test_shell_tests Review URL: http://codereview.chromium.org/3843002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/test_shell/run_all_tests.cc112
-rw-r--r--webkit/tools/test_shell/test_shell.gypi1
2 files changed, 60 insertions, 53 deletions
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc
index a8857ff..11649ebe 100644
--- a/webkit/tools/test_shell/run_all_tests.cc
+++ b/webkit/tools/test_shell/run_all_tests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -12,12 +12,11 @@
#include <commctrl.h>
#endif
-#include "base/at_exit.h"
#include "base/command_line.h"
-#include "base/i18n/icu_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop.h"
#include "base/process_util.h"
+#include "base/test/test_suite.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_shell.h"
@@ -41,67 +40,74 @@ const char* const TestShellTest::kJavascriptDelayExitScript =
"});"
"</script>";
-int main(int argc, char* argv[]) {
- base::mac::ScopedNSAutoreleasePool autorelease_pool;
- base::EnableInProcessStackDumping();
- base::EnableTerminationOnHeapCorruption();
- // Some unittests may use base::Singleton<>, thus we need to instanciate
- // the AtExitManager or else we will leak objects.
- base::AtExitManager at_exit_manager;
+class TestShellTestSuite : public base::TestSuite {
+ public:
+ TestShellTestSuite(int argc, char** argv)
+ : base::TestSuite(argc, argv),
+ test_shell_webkit_init_(true),
+ platform_delegate_(*CommandLine::ForCurrentProcess()) {
+ }
+ virtual void Initialize() {
+ // Override DIR_EXE early in case anything in base::TestSuite uses it.
#if defined(OS_MACOSX)
- FilePath path;
- PathService::Get(base::DIR_EXE, &path);
- path = path.AppendASCII("TestShell.app");
- mac_util::SetOverrideAppBundlePath(path);
+ FilePath path;
+ PathService::Get(base::DIR_EXE, &path);
+ path = path.AppendASCII("TestShell.app");
+ mac_util::SetOverrideAppBundlePath(path);
#endif
- TestShellPlatformDelegate::PreflightArgs(&argc, &argv);
- CommandLine::Init(argc, argv);
- const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
- TestShellPlatformDelegate platform(parsed_command_line);
-
- // Allow tests to analyze GC information from V8 log, and expose GC
- // triggering function.
- std::string js_flags =
- parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags);
- js_flags += " --logfile=* --log_gc --expose_gc";
- webkit_glue::SetJavaScriptFlags(js_flags);
-
- // Suppress error dialogs and do not show GP fault error box on Windows.
- TestShell::InitLogging(true, false, false);
-
- // Some of the individual tests wind up calling TestShell::WaitTestFinished
- // which has a timeout in it. For these tests, we don't care about a timeout
- // so just set it to be really large. This is necessary because
- // we hit those timeouts under Purify and Valgrind.
- TestShell::SetFileTestTimeout(10 * 60 * 60 * 1000); // Ten hours.
-
- // Initialize test shell in layout test mode, which will let us load one
- // request than automatically quit.
- TestShell::InitializeTestShell(true, false);
+ base::TestSuite::Initialize();
+
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+
+ // Allow tests to analyze GC information from V8 log, and expose GC
+ // triggering function.
+ std::string js_flags =
+ parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags);
+ js_flags += " --logfile=* --log_gc --expose_gc";
+ webkit_glue::SetJavaScriptFlags(js_flags);
+
+ // Suppress error dialogs and do not show GP fault error box on Windows.
+ TestShell::InitLogging(true, false, false);
+
+ // Some of the individual tests wind up calling TestShell::WaitTestFinished
+ // which has a timeout in it. For these tests, we don't care about
+ // a timeout so just set it to be really large. This is necessary because
+ // we hit those timeouts under Purify and Valgrind.
+ TestShell::SetFileTestTimeout(10 * 60 * 60 * 1000); // Ten hours.
+
+ // Initialize test shell in layout test mode, which will let us load one
+ // request than automatically quit.
+ TestShell::InitializeTestShell(true, false);
+ platform_delegate_.InitializeGUI();
+ platform_delegate_.SelectUnifiedTheme();
+ }
+
+ virtual void Shutdown() {
+ TestShell::ShutdownTestShell();
+ TestShell::CleanupLogging();
+
+ base::TestSuite::Shutdown();
+ }
+
+ private:
// Allocate a message loop for this thread. Although it is not used
// directly, its constructor sets up some necessary state.
- MessageLoopForUI main_message_loop;
+ MessageLoopForUI main_message_loop_;
// Initialize WebKit for this scope.
- TestShellWebKitInit test_shell_webkit_init(true);
+ TestShellWebKitInit test_shell_webkit_init_;
- // Load ICU data tables
- icu_util::Initialize();
+ TestShellPlatformDelegate platform_delegate_;
- platform.InitializeGUI();
- platform.SelectUnifiedTheme();
+ DISALLOW_COPY_AND_ASSIGN(TestShellTestSuite);
+};
- // Run the actual tests
- testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
+int main(int argc, char** argv) {
+ base::mac::ScopedNSAutoreleasePool scoped_pool;
- TestShell::ShutdownTestShell();
- TestShell::CleanupLogging();
-
- CommandLine::Reset();
-
- return result;
+ TestShellPlatformDelegate::PreflightArgs(&argc, &argv);
+ return TestShellTestSuite(argc, argv).Run();
}
diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi
index bdcb274..5beafa0 100644
--- a/webkit/tools/test_shell/test_shell.gypi
+++ b/webkit/tools/test_shell/test_shell.gypi
@@ -345,6 +345,7 @@
'msvs_guid': 'E6766F81-1FCD-4CD7-BC16-E36964A14867',
'dependencies': [
'test_shell_common',
+ '<(DEPTH)/base/base.gyp:test_support_base',
'<(DEPTH)/net/net.gyp:net_test_support',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/testing/gmock.gyp:gmock',