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 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/process_util.h" | 19 #include "base/process_util.h" |
20 #include "base/scoped_nsautorelease_pool.h" | 20 #include "base/scoped_nsautorelease_pool.h" |
21 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
22 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 22 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
23 #include "webkit/tools/test_shell/test_shell.h" | 23 #include "webkit/tools/test_shell/test_shell.h" |
24 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 24 #include "webkit/tools/test_shell/test_shell_platform_delegate.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 "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 | 28 |
28 const char* TestShellTest::kJavascriptDelayExitScript = | 29 const char* TestShellTest::kJavascriptDelayExitScript = |
29 "<script>" | 30 "<script>" |
30 "window.layoutTestController.waitUntilDone();" | 31 "window.layoutTestController.waitUntilDone();" |
31 "window.addEventListener('load', function() {" | 32 "window.addEventListener('load', function() {" |
32 " var x = document.body.clientWidth;" // Force a document layout | 33 " var x = document.body.clientWidth;" // Force a document layout |
33 " window.layoutTestController.notifyDone();" | 34 " window.layoutTestController.notifyDone();" |
34 "});" | 35 "});" |
35 "</script>"; | 36 "</script>"; |
(...skipping 18 matching lines...) Expand all Loading... |
54 // which has a timeout in it. For these tests, we don't care about a timeout | 55 // which has a timeout in it. For these tests, we don't care about a timeout |
55 // so just set it to be a really large number. This is necessary because | 56 // so just set it to be a really large number. This is necessary because |
56 // when running under Purify, we were hitting those timeouts. | 57 // when running under Purify, we were hitting those timeouts. |
57 TestShell::SetFileTestTimeout(USER_TIMER_MAXIMUM); | 58 TestShell::SetFileTestTimeout(USER_TIMER_MAXIMUM); |
58 #endif | 59 #endif |
59 | 60 |
60 // Initialize test shell in layout test mode, which will let us load one | 61 // Initialize test shell in layout test mode, which will let us load one |
61 // request than automatically quit. | 62 // request than automatically quit. |
62 TestShell::InitializeTestShell(true); | 63 TestShell::InitializeTestShell(true); |
63 | 64 |
64 webkit_glue::InitializeForTesting(); | 65 // Initialize WebKit for this scope. |
| 66 TestShellWebKitInit test_shell_webkit_init(true); |
65 | 67 |
66 // Allocate a message loop for this thread. Although it is not used | 68 // Allocate a message loop for this thread. Although it is not used |
67 // directly, its constructor sets up some necessary state. | 69 // directly, its constructor sets up some necessary state. |
68 MessageLoop main_message_loop; | 70 MessageLoop main_message_loop; |
69 | 71 |
70 // Load ICU data tables | 72 // Load ICU data tables |
71 icu_util::Initialize(); | 73 icu_util::Initialize(); |
72 | 74 |
73 platform.InitializeGUI(); | 75 platform.InitializeGUI(); |
74 platform.SelectUnifiedTheme(); | 76 platform.SelectUnifiedTheme(); |
75 | 77 |
76 // Run the actual tests | 78 // Run the actual tests |
77 testing::InitGoogleTest(&argc, argv); | 79 testing::InitGoogleTest(&argc, argv); |
78 int result = RUN_ALL_TESTS(); | 80 int result = RUN_ALL_TESTS(); |
79 | 81 |
80 TestShell::ShutdownTestShell(); | 82 TestShell::ShutdownTestShell(); |
81 TestShell::CleanupLogging(); | 83 TestShell::CleanupLogging(); |
82 | 84 |
83 return result; | 85 return result; |
84 } | 86 } |
85 | 87 |
OLD | NEW |