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 // Creates an instance of the test_shell. | 5 // Creates an instance of the test_shell. |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/event_recorder.h" | 11 #include "base/event_recorder.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/icu_util.h" | 13 #include "base/icu_util.h" |
14 #include "base/memory_debug.h" | 14 #include "base/memory_debug.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/stats_table.h" | 19 #include "base/stats_table.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
22 #include "base/trace_event.h" | 22 #include "base/trace_event.h" |
23 #include "net/base/cookie_monster.h" | 23 #include "net/base/cookie_monster.h" |
24 #include "net/base/net_module.h" | 24 #include "net/base/net_module.h" |
25 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
26 #include "net/base/ssl_test_util.h" | 26 #include "net/base/ssl_test_util.h" |
27 #include "net/url_request/url_request_context.h" | 27 #include "net/url_request/url_request_context.h" |
| 28 #include "webkit/glue/webkit_client_impl.h" |
28 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
29 #include "webkit/glue/window_open_disposition.h" | 30 #include "webkit/glue/window_open_disposition.h" |
30 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 31 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
31 #include "webkit/tools/test_shell/test_shell.h" | 32 #include "webkit/tools/test_shell/test_shell.h" |
32 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 33 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
33 #include "webkit/tools/test_shell/test_shell_request_context.h" | 34 #include "webkit/tools/test_shell/test_shell_request_context.h" |
34 #include "webkit/tools/test_shell/test_shell_switches.h" | 35 #include "webkit/tools/test_shell/test_shell_switches.h" |
35 | 36 |
| 37 #include "WebKit.h" |
| 38 |
36 #include <iostream> | 39 #include <iostream> |
37 using namespace std; | 40 using namespace std; |
38 | 41 |
39 static const size_t kPathBufSize = 2048; | 42 static const size_t kPathBufSize = 2048; |
40 | 43 |
41 namespace { | 44 namespace { |
42 | 45 |
43 // StatsTable initialization parameters. | 46 // StatsTable initialization parameters. |
44 static const char* kStatsFilePrefix = "testshell_"; | 47 static const char* kStatsFilePrefix = "testshell_"; |
45 static int kStatsFileThreads = 20; | 48 static int kStatsFileThreads = 20; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 bool layout_test_mode = | 81 bool layout_test_mode = |
79 parsed_command_line.HasSwitch(test_shell::kLayoutTests); | 82 parsed_command_line.HasSwitch(test_shell::kLayoutTests); |
80 | 83 |
81 bool enable_gp_fault_error_box = false; | 84 bool enable_gp_fault_error_box = false; |
82 enable_gp_fault_error_box = | 85 enable_gp_fault_error_box = |
83 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); | 86 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); |
84 TestShell::InitLogging(suppress_error_dialogs, | 87 TestShell::InitLogging(suppress_error_dialogs, |
85 layout_test_mode, | 88 layout_test_mode, |
86 enable_gp_fault_error_box); | 89 enable_gp_fault_error_box); |
87 | 90 |
| 91 webkit_glue::WebKitClientImpl webkit_client_impl; |
| 92 WebKit::initialize(&webkit_client_impl); |
| 93 |
88 // Set this early before we start using WebCore. | 94 // Set this early before we start using WebCore. |
89 webkit_glue::SetLayoutTestMode(layout_test_mode); | 95 webkit_glue::SetLayoutTestMode(layout_test_mode); |
90 | 96 |
91 // Suppress abort message in v8 library in debugging mode. | 97 // Suppress abort message in v8 library in debugging mode. |
92 // V8 calls abort() when it hits assertion errors. | 98 // V8 calls abort() when it hits assertion errors. |
93 if (suppress_error_dialogs) { | 99 if (suppress_error_dialogs) { |
94 platform.SuppressErrorReporting(); | 100 platform.SuppressErrorReporting(); |
95 } | 101 } |
96 | 102 |
97 if (parsed_command_line.HasSwitch(test_shell::kEnableTracing)) | 103 if (parsed_command_line.HasSwitch(test_shell::kEnableTracing)) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 293 |
288 TestShell::ShutdownTestShell(); | 294 TestShell::ShutdownTestShell(); |
289 TestShell::CleanupLogging(); | 295 TestShell::CleanupLogging(); |
290 | 296 |
291 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 297 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
292 StatsTable::set_current(NULL); | 298 StatsTable::set_current(NULL); |
293 delete table; | 299 delete table; |
294 | 300 |
295 return 0; | 301 return 0; |
296 } | 302 } |
OLD | NEW |