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" | |
29 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
30 #include "webkit/glue/window_open_disposition.h" | 29 #include "webkit/glue/window_open_disposition.h" |
31 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 30 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
32 #include "webkit/tools/test_shell/test_shell.h" | 31 #include "webkit/tools/test_shell/test_shell.h" |
33 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 32 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
34 #include "webkit/tools/test_shell/test_shell_request_context.h" | 33 #include "webkit/tools/test_shell/test_shell_request_context.h" |
35 #include "webkit/tools/test_shell/test_shell_switches.h" | 34 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 35 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
36 | 36 |
37 #include "WebKit.h" | 37 #include "WebKit.h" |
38 | 38 |
39 #include <iostream> | 39 #include <iostream> |
40 using namespace std; | 40 using namespace std; |
41 | 41 |
42 static const size_t kPathBufSize = 2048; | 42 static const size_t kPathBufSize = 2048; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool layout_test_mode = | 81 bool layout_test_mode = |
82 parsed_command_line.HasSwitch(test_shell::kLayoutTests); | 82 parsed_command_line.HasSwitch(test_shell::kLayoutTests); |
83 | 83 |
84 bool enable_gp_fault_error_box = false; | 84 bool enable_gp_fault_error_box = false; |
85 enable_gp_fault_error_box = | 85 enable_gp_fault_error_box = |
86 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); | 86 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); |
87 TestShell::InitLogging(suppress_error_dialogs, | 87 TestShell::InitLogging(suppress_error_dialogs, |
88 layout_test_mode, | 88 layout_test_mode, |
89 enable_gp_fault_error_box); | 89 enable_gp_fault_error_box); |
90 | 90 |
91 webkit_glue::WebKitClientImpl webkit_client_impl; | 91 // Initialize WebKit for this scope. |
92 WebKit::initialize(&webkit_client_impl); | 92 TestShellWebKitInit test_shell_webkit_init(layout_test_mode); |
93 | |
94 // Set this early before we start using WebCore. | |
95 webkit_glue::SetLayoutTestMode(layout_test_mode); | |
96 | 93 |
97 // Suppress abort message in v8 library in debugging mode. | 94 // Suppress abort message in v8 library in debugging mode. |
98 // V8 calls abort() when it hits assertion errors. | 95 // V8 calls abort() when it hits assertion errors. |
99 if (suppress_error_dialogs) { | 96 if (suppress_error_dialogs) |
100 platform.SuppressErrorReporting(); | 97 platform.SuppressErrorReporting(); |
101 } | |
102 | 98 |
103 if (parsed_command_line.HasSwitch(test_shell::kEnableTracing)) | 99 if (parsed_command_line.HasSwitch(test_shell::kEnableTracing)) |
104 base::TraceLog::StartTracing(); | 100 base::TraceLog::StartTracing(); |
105 | 101 |
106 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL; | 102 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL; |
107 bool playback_mode = | 103 bool playback_mode = |
108 parsed_command_line.HasSwitch(test_shell::kPlaybackMode); | 104 parsed_command_line.HasSwitch(test_shell::kPlaybackMode); |
109 bool record_mode = | 105 bool record_mode = |
110 parsed_command_line.HasSwitch(test_shell::kRecordMode); | 106 parsed_command_line.HasSwitch(test_shell::kRecordMode); |
111 | 107 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 289 |
294 TestShell::ShutdownTestShell(); | 290 TestShell::ShutdownTestShell(); |
295 TestShell::CleanupLogging(); | 291 TestShell::CleanupLogging(); |
296 | 292 |
297 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 293 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
298 StatsTable::set_current(NULL); | 294 StatsTable::set_current(NULL); |
299 delete table; | 295 delete table; |
300 | 296 |
301 return 0; | 297 return 0; |
302 } | 298 } |
OLD | NEW |