| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/test/test_suite.h" | 18 #include "base/test/test_suite.h" |
| 19 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
| 20 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 20 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 21 #include "webkit/tools/test_shell/test_shell.h" | 21 #include "webkit/tools/test_shell/test_shell.h" |
| 22 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 22 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
| 23 #include "webkit/tools/test_shell/test_shell_switches.h" | 23 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 24 #include "webkit/tools/test_shell/test_shell_test.h" | 24 #include "webkit/tools/test_shell/test_shell_test.h" |
| 25 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 25 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
| 29 #include "base/mac/bundle_locations.h" |
| 29 #include "base/mac/mac_util.h" | 30 #include "base/mac/mac_util.h" |
| 30 #include "base/mac/scoped_nsautorelease_pool.h" | 31 #include "base/mac/scoped_nsautorelease_pool.h" |
| 31 #include "base/path_service.h" | 32 #include "base/path_service.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 const char* const TestShellTest::kJavascriptDelayExitScript = | 35 const char* const TestShellTest::kJavascriptDelayExitScript = |
| 35 "<script>" | 36 "<script>" |
| 36 "window.layoutTestController.waitUntilDone();" | 37 "window.layoutTestController.waitUntilDone();" |
| 37 "window.addEventListener('load', function() {" | 38 "window.addEventListener('load', function() {" |
| 38 " var x = document.body.clientWidth;" // Force a document layout | 39 " var x = document.body.clientWidth;" // Force a document layout |
| 39 " window.layoutTestController.notifyDone();" | 40 " window.layoutTestController.notifyDone();" |
| 40 "});" | 41 "});" |
| 41 "</script>"; | 42 "</script>"; |
| 42 | 43 |
| 43 class TestShellTestSuite : public base::TestSuite { | 44 class TestShellTestSuite : public base::TestSuite { |
| 44 public: | 45 public: |
| 45 TestShellTestSuite(int argc, char** argv) | 46 TestShellTestSuite(int argc, char** argv) |
| 46 : base::TestSuite(argc, argv), | 47 : base::TestSuite(argc, argv), |
| 47 platform_delegate_(*CommandLine::ForCurrentProcess()), | 48 platform_delegate_(*CommandLine::ForCurrentProcess()), |
| 48 test_shell_webkit_init_(true) { | 49 test_shell_webkit_init_(true) { |
| 49 } | 50 } |
| 50 | 51 |
| 51 virtual void Initialize() { | 52 virtual void Initialize() { |
| 52 // Override DIR_EXE early in case anything in base::TestSuite uses it. | 53 // Override DIR_EXE early in case anything in base::TestSuite uses it. |
| 53 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 54 FilePath path; | 55 FilePath path; |
| 55 PathService::Get(base::DIR_EXE, &path); | 56 PathService::Get(base::DIR_EXE, &path); |
| 56 path = path.AppendASCII("TestShell.app"); | 57 path = path.AppendASCII("TestShell.app"); |
| 57 base::mac::SetOverrideAppBundlePath(path); | 58 base::mac::SetOverrideFrameworkBundlePath(path); |
| 58 #endif | 59 #endif |
| 59 | 60 |
| 60 base::TestSuite::Initialize(); | 61 base::TestSuite::Initialize(); |
| 61 | 62 |
| 62 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 63 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 63 | 64 |
| 64 // Allow tests to analyze GC information from V8 log, and expose GC | 65 // Allow tests to analyze GC information from V8 log, and expose GC |
| 65 // triggering function. | 66 // triggering function. |
| 66 std::string js_flags = | 67 std::string js_flags = |
| 67 parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); | 68 parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 int main(int argc, char** argv) { | 109 int main(int argc, char** argv) { |
| 109 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 110 base::mac::ScopedNSAutoreleasePool scoped_pool; | 111 base::mac::ScopedNSAutoreleasePool scoped_pool; |
| 111 #endif | 112 #endif |
| 112 | 113 |
| 113 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); | 114 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); |
| 114 return TestShellTestSuite(argc, argv).Run(); | 115 return TestShellTestSuite(argc, argv).Run(); |
| 115 } | 116 } |
| OLD | NEW |