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