summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 18:37:39 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 18:37:39 +0000
commitfa8506d543d349ac13436ecd465c9eac6fefb972 (patch)
tree632f3e9449f28be947b0e399b896d69a687b7f31
parentbe96d077f38a96d420c0ed982e9b78ddc224791a (diff)
downloadchromium_src-fa8506d543d349ac13436ecd465c9eac6fefb972.zip
chromium_src-fa8506d543d349ac13436ecd465c9eac6fefb972.tar.gz
chromium_src-fa8506d543d349ac13436ecd465c9eac6fefb972.tar.bz2
When running layout tests, have logging only go to a file. This prevents info and warning messgaes from impacting the layout test output and causing failures. Switch to abort() on mac when timing out, terminate: sometimes can still hang the app. Hide the window instead of trying to move it offscreen, which Cocoa doesn't want to let us do.
Review URL: http://codereview.chromium.org/7405 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3403 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/test_shell/mac/main.mm5
-rw-r--r--webkit/tools/test_shell/test_shell.cc12
-rw-r--r--webkit/tools/test_shell/test_shell.h3
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm25
-rw-r--r--webkit/tools/test_shell/test_shell_main.cc8
5 files changed, 36 insertions, 17 deletions
diff --git a/webkit/tools/test_shell/mac/main.mm b/webkit/tools/test_shell/mac/main.mm
index b1f095b..44e3b58 100644
--- a/webkit/tools/test_shell/mac/main.mm
+++ b/webkit/tools/test_shell/mac/main.mm
@@ -81,11 +81,11 @@ int main(const int argc, const char *argv[]) {
bool suppress_error_dialogs = (getenv("CHROME_HEADLESS") != NULL) ||
parsed_command_line.HasSwitch(test_shell::kNoErrorDialogs) ||
parsed_command_line.HasSwitch(test_shell::kLayoutTests);
- TestShell::InitLogging(suppress_error_dialogs);
-
bool layout_test_mode =
parsed_command_line.HasSwitch(test_shell::kLayoutTests);
bool interactive = !layout_test_mode;
+
+ TestShell::InitLogging(suppress_error_dialogs, layout_test_mode);
TestShell::InitializeTestShell(interactive);
bool no_tree = parsed_command_line.HasSwitch(test_shell::kNoTree);
@@ -250,7 +250,6 @@ int main(const int argc, const char *argv[]) {
continue;
SetCurrentTestName(filenameBuffer);
-
if (!TestShell::RunFileTest(filenameBuffer, params))
break;
}
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index c8164e1..bbdc21e 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -172,7 +172,8 @@ static void UnitTestAssertHandler(const std::string& str) {
}
// static
-void TestShell::InitLogging(bool suppress_error_dialogs) {
+void TestShell::InitLogging(bool suppress_error_dialogs,
+ bool running_layout_tests) {
if (!IsDebuggerPresent() && suppress_error_dialogs) {
UINT new_flags = SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
@@ -184,12 +185,19 @@ void TestShell::InitLogging(bool suppress_error_dialogs) {
logging::SetLogAssertHandler(UnitTestAssertHandler);
}
+ // Only log to a file if we're running layout tests. This prevents debugging
+ // output from disrupting whether or not we pass.
+ logging::LoggingDestination destination =
+ logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG;
+ if (running_layout_tests)
+ destination = logging::LOG_ONLY_TO_FILE;
+
// We might have multiple test_shell processes going at once
std::wstring log_filename;
PathService::Get(base::DIR_EXE, &log_filename);
file_util::AppendToPath(&log_filename, L"test_shell.log");
logging::InitLogging(log_filename.c_str(),
- logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG,
+ destination,
logging::LOCK_LOG_FILE,
logging::DELETE_OLD_LOG_FILE);
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index 664c57d..abab9db 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -70,7 +70,8 @@ public:
virtual ~TestShell();
// Initialization and clean up of logging.
- static void InitLogging(bool suppress_error_dialogs);
+ static void InitLogging(bool suppress_error_dialogs,
+ bool running_layout_tests);
static void CleanupLogging();
// Initialization and clean up of a static member variable.
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index 55e4f90..37a34de 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -126,16 +126,24 @@ static void UnitTestAssertHandler(const std::string& str) {
}
// static
-void TestShell::InitLogging(bool suppress_error_dialogs) {
+void TestShell::InitLogging(bool suppress_error_dialogs,
+ bool running_layout_tests) {
if (suppress_error_dialogs) {
logging::SetLogAssertHandler(UnitTestAssertHandler);
}
+
+ // Only log to a file if we're running layout tests. This prevents debugging
+ // output from disrupting whether or not we pass.
+ logging::LoggingDestination destination =
+ logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG;
+ if (running_layout_tests)
+ destination = logging::LOG_ONLY_TO_FILE;
// We might have multiple test_shell processes going at once
char log_filename_template[] = "/tmp/test_shell_XXXXXX";
char* log_filename = mktemp(log_filename_template);
logging::InitLogging(log_filename,
- logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG,
+ destination,
logging::LOCK_LOG_FILE,
logging::DELETE_OLD_LOG_FILE);
@@ -342,7 +350,7 @@ void TestShell::TestFinished() {
puts("#TEST_TIMED_OUT\n");
puts("#EOF\n");
fflush(stdout);
- [[NSApplication sharedApplication] terminate:self];
+ abort();
}
[pool release];
@@ -361,8 +369,9 @@ void TestShell::WaitTestFinished() {
// message loop. If the watchdog is what catches a
// timeout, it can't do anything except terminate the test
// shell, which is unfortunate.
- // Why multiply the timeout by 2.5? Who knows. That's what windows does.
- NSTimeInterval timeout_seconds = GetFileTestTimeout() * 2.5 / 1000;
+ // Windows multiplies by 2.5, but that causes us to run for far, far too
+ // long. We can adjust it down later if we need to.
+ NSTimeInterval timeout_seconds = GetFileTestTimeout() / 1000;
WatchDogTarget* watchdog = [[[WatchDogTarget alloc]
initWithTimeout:timeout_seconds] autorelease];
NSThread* thread = [[NSThread alloc] initWithTarget:watchdog
@@ -559,8 +568,10 @@ void TestShell::ResizeSubViews() {
ResetWebPreferences();
shell->webView()->SetPreferences(*web_prefs_);
- [shell->m_mainWnd setFrameTopLeftPoint:NSMakePoint(kTestWindowXLocation,
- kTestWindowYLocation)];
+ // Hide the window. We can't actually use NSWindow's |-setFrameTopLeftPoint:|
+ // because it leaves a chunk of the window visible instead of moving it
+ // offscreen.
+ [shell->m_mainWnd orderOut:nil];
shell->ResizeSubViews();
if (strstr(filename, "loading/"))
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc
index e2980ae..6738984 100644
--- a/webkit/tools/test_shell/test_shell_main.cc
+++ b/webkit/tools/test_shell/test_shell_main.cc
@@ -135,7 +135,10 @@ int main(int argc, char* argv[]) {
(GetEnvironmentVariable(L"CHROME_HEADLESS", NULL, 0) ||
parsed_command_line.HasSwitch(test_shell::kNoErrorDialogs) ||
parsed_command_line.HasSwitch(test_shell::kLayoutTests));
- TestShell::InitLogging(suppress_error_dialogs);
+ bool layout_test_mode =
+ parsed_command_line.HasSwitch(test_shell::kLayoutTests);
+
+ TestShell::InitLogging(suppress_error_dialogs, layout_test_mode);
// Suppress abort message in v8 library in debugging mode.
// V8 calls abort() when it hits assertion errors.
@@ -154,9 +157,6 @@ int main(int argc, char* argv[]) {
net::HttpNetworkLayer::UseWinHttp(false);
#endif
- bool layout_test_mode =
- parsed_command_line.HasSwitch(test_shell::kLayoutTests);
-
net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL;
bool playback_mode =
parsed_command_line.HasSwitch(test_shell::kPlaybackMode);