| 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) |
| 19 #include "base/mac_util.h" |
| 20 #include "base/path_service.h" |
| 21 #endif |
| 18 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
| 19 #include "base/process_util.h" | 23 #include "base/process_util.h" |
| 20 #include "base/scoped_nsautorelease_pool.h" | 24 #include "base/scoped_nsautorelease_pool.h" |
| 21 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 22 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 26 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 23 #include "webkit/tools/test_shell/test_shell.h" | 27 #include "webkit/tools/test_shell/test_shell.h" |
| 24 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 28 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
| 25 #include "webkit/tools/test_shell/test_shell_test.h" | 29 #include "webkit/tools/test_shell/test_shell_test.h" |
| 26 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 30 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 28 | 32 |
| 29 const char* TestShellTest::kJavascriptDelayExitScript = | 33 const char* TestShellTest::kJavascriptDelayExitScript = |
| 30 "<script>" | 34 "<script>" |
| 31 "window.layoutTestController.waitUntilDone();" | 35 "window.layoutTestController.waitUntilDone();" |
| 32 "window.addEventListener('load', function() {" | 36 "window.addEventListener('load', function() {" |
| 33 " var x = document.body.clientWidth;" // Force a document layout | 37 " var x = document.body.clientWidth;" // Force a document layout |
| 34 " window.layoutTestController.notifyDone();" | 38 " window.layoutTestController.notifyDone();" |
| 35 "});" | 39 "});" |
| 36 "</script>"; | 40 "</script>"; |
| 37 | 41 |
| 38 int main(int argc, char* argv[]) { | 42 int main(int argc, char* argv[]) { |
| 39 base::ScopedNSAutoreleasePool autorelease_pool; | 43 base::ScopedNSAutoreleasePool autorelease_pool; |
| 40 base::EnableTerminationOnHeapCorruption(); | 44 base::EnableTerminationOnHeapCorruption(); |
| 41 // Some unittests may use base::Singleton<>, thus we need to instanciate | 45 // Some unittests may use base::Singleton<>, thus we need to instanciate |
| 42 // the AtExitManager or else we will leak objects. | 46 // the AtExitManager or else we will leak objects. |
| 43 base::AtExitManager at_exit_manager; | 47 base::AtExitManager at_exit_manager; |
| 44 | 48 |
| 49 #if defined(OS_MACOSX) |
| 50 FilePath path; |
| 51 PathService::Get(base::DIR_EXE, &path); |
| 52 path = path.AppendASCII("TestShell.app"); |
| 53 mac_util::SetOverrideAppBundlePath(path); |
| 54 #endif |
| 55 |
| 45 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); | 56 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); |
| 46 CommandLine::Init(argc, argv); | 57 CommandLine::Init(argc, argv); |
| 47 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 58 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 48 TestShellPlatformDelegate platform(parsed_command_line); | 59 TestShellPlatformDelegate platform(parsed_command_line); |
| 49 | 60 |
| 50 // Suppress error dialogs and do not show GP fault error box on Windows. | 61 // Suppress error dialogs and do not show GP fault error box on Windows. |
| 51 TestShell::InitLogging(true, false, false); | 62 TestShell::InitLogging(true, false, false); |
| 52 | 63 |
| 53 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 54 // Some of the individual tests wind up calling TestShell::WaitTestFinished | 65 // Some of the individual tests wind up calling TestShell::WaitTestFinished |
| (...skipping 23 matching lines...) Expand all Loading... |
| 78 // Run the actual tests | 89 // Run the actual tests |
| 79 testing::InitGoogleTest(&argc, argv); | 90 testing::InitGoogleTest(&argc, argv); |
| 80 int result = RUN_ALL_TESTS(); | 91 int result = RUN_ALL_TESTS(); |
| 81 | 92 |
| 82 TestShell::ShutdownTestShell(); | 93 TestShell::ShutdownTestShell(); |
| 83 TestShell::CleanupLogging(); | 94 TestShell::CleanupLogging(); |
| 84 | 95 |
| 85 return result; | 96 return result; |
| 86 } | 97 } |
| 87 | 98 |
| OLD | NEW |