| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Run all of our test shell tests. This is just an entry point | 5 // Run all of our test shell tests. This is just an entry point |
| 6 // to kick off gTest's RUN_ALL_TESTS(). | 6 // to kick off gTest's RUN_ALL_TESTS(). |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 #include <commctrl.h> | 12 #include <commctrl.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/icu_util.h" | 17 #include "base/icu_util.h" |
| 18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 19 #include "base/mac_util.h" | 19 #include "base/mac_util.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #endif | 21 #endif |
| 22 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
| 23 #include "base/process_util.h" | 23 #include "base/process_util.h" |
| 24 #include "base/scoped_nsautorelease_pool.h" | 24 #include "base/scoped_nsautorelease_pool.h" |
| 25 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 26 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 26 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 27 #include "webkit/tools/test_shell/test_shell.h" | 27 #include "webkit/tools/test_shell/test_shell.h" |
| 28 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 28 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
| 29 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 29 #include "webkit/tools/test_shell/test_shell_test.h" | 30 #include "webkit/tools/test_shell/test_shell_test.h" |
| 30 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 31 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 33 |
| 33 const char* TestShellTest::kJavascriptDelayExitScript = | 34 const char* TestShellTest::kJavascriptDelayExitScript = |
| 34 "<script>" | 35 "<script>" |
| 35 "window.layoutTestController.waitUntilDone();" | 36 "window.layoutTestController.waitUntilDone();" |
| 36 "window.addEventListener('load', function() {" | 37 "window.addEventListener('load', function() {" |
| 37 " var x = document.body.clientWidth;" // Force a document layout | 38 " var x = document.body.clientWidth;" // Force a document layout |
| 38 " window.layoutTestController.notifyDone();" | 39 " window.layoutTestController.notifyDone();" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 PathService::Get(base::DIR_EXE, &path); | 52 PathService::Get(base::DIR_EXE, &path); |
| 52 path = path.AppendASCII("TestShell.app"); | 53 path = path.AppendASCII("TestShell.app"); |
| 53 mac_util::SetOverrideAppBundlePath(path); | 54 mac_util::SetOverrideAppBundlePath(path); |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); | 57 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); |
| 57 CommandLine::Init(argc, argv); | 58 CommandLine::Init(argc, argv); |
| 58 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 59 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 59 TestShellPlatformDelegate platform(parsed_command_line); | 60 TestShellPlatformDelegate platform(parsed_command_line); |
| 60 | 61 |
| 62 // Allow tests to analyze GC information from V8 log, and expose GC |
| 63 // triggering function. |
| 64 std::wstring js_flags = |
| 65 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); |
| 66 js_flags += L" --logfile=* --log_gc --expose_gc"; |
| 67 webkit_glue::SetJavaScriptFlags(js_flags); |
| 68 |
| 61 // Suppress error dialogs and do not show GP fault error box on Windows. | 69 // Suppress error dialogs and do not show GP fault error box on Windows. |
| 62 TestShell::InitLogging(true, false, false); | 70 TestShell::InitLogging(true, false, false); |
| 63 | 71 |
| 64 // Some of the individual tests wind up calling TestShell::WaitTestFinished | 72 // Some of the individual tests wind up calling TestShell::WaitTestFinished |
| 65 // which has a timeout in it. For these tests, we don't care about a timeout | 73 // which has a timeout in it. For these tests, we don't care about a timeout |
| 66 // so just set it to be really large. This is necessary because | 74 // so just set it to be really large. This is necessary because |
| 67 // we hit those timeouts under Purify and Valgrind. | 75 // we hit those timeouts under Purify and Valgrind. |
| 68 TestShell::SetFileTestTimeout(10 * 60 * 60 * 1000); // Ten hours. | 76 TestShell::SetFileTestTimeout(10 * 60 * 60 * 1000); // Ten hours. |
| 69 | 77 |
| 70 // Initialize test shell in layout test mode, which will let us load one | 78 // Initialize test shell in layout test mode, which will let us load one |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 testing::InitGoogleTest(&argc, argv); | 96 testing::InitGoogleTest(&argc, argv); |
| 89 int result = RUN_ALL_TESTS(); | 97 int result = RUN_ALL_TESTS(); |
| 90 | 98 |
| 91 TestShell::ShutdownTestShell(); | 99 TestShell::ShutdownTestShell(); |
| 92 TestShell::CleanupLogging(); | 100 TestShell::CleanupLogging(); |
| 93 | 101 |
| 94 CommandLine::Terminate(); | 102 CommandLine::Terminate(); |
| 95 | 103 |
| 96 return result; | 104 return result; |
| 97 } | 105 } |
| OLD | NEW |