| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
| 29 #include "webkit/glue/window_open_disposition.h" | 29 #include "webkit/glue/window_open_disposition.h" |
| 30 #include "webkit/extensions/v8/gc_extension.h" | 30 #include "webkit/extensions/v8/gc_extension.h" |
| 31 #include "webkit/extensions/v8/playback_extension.h" | 31 #include "webkit/extensions/v8/playback_extension.h" |
| 32 #include "webkit/extensions/v8/profiler_extension.h" |
| 32 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 33 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 33 #include "webkit/tools/test_shell/test_shell.h" | 34 #include "webkit/tools/test_shell/test_shell.h" |
| 34 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 35 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
| 35 #include "webkit/tools/test_shell/test_shell_request_context.h" | 36 #include "webkit/tools/test_shell/test_shell_request_context.h" |
| 36 #include "webkit/tools/test_shell/test_shell_switches.h" | 37 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 37 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 38 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 38 | 39 |
| 39 #include "WebKit.h" | 40 #include "WebKit.h" |
| 40 | 41 |
| 41 #include <iostream> | 42 #include <iostream> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 uri = loose_values[0]; | 186 uri = loose_values[0]; |
| 186 | 187 |
| 187 std::wstring js_flags = | 188 std::wstring js_flags = |
| 188 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); | 189 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); |
| 189 // Test shell always exposes the GC. | 190 // Test shell always exposes the GC. |
| 190 js_flags += L" --expose-gc"; | 191 js_flags += L" --expose-gc"; |
| 191 webkit_glue::SetJavaScriptFlags(js_flags); | 192 webkit_glue::SetJavaScriptFlags(js_flags); |
| 192 // Expose GCController to JavaScript. | 193 // Expose GCController to JavaScript. |
| 193 WebKit::registerExtension(extensions_v8::GCExtension::Get()); | 194 WebKit::registerExtension(extensions_v8::GCExtension::Get()); |
| 194 | 195 |
| 196 if (parsed_command_line.HasSwitch(test_shell::kProfiler)) { |
| 197 WebKit::registerExtension(extensions_v8::ProfilerExtension::Get()); |
| 198 } |
| 199 |
| 195 // Load and initialize the stats table. Attempt to construct a somewhat | 200 // Load and initialize the stats table. Attempt to construct a somewhat |
| 196 // unique name to isolate separate instances from each other. | 201 // unique name to isolate separate instances from each other. |
| 197 StatsTable *table = new StatsTable( | 202 StatsTable *table = new StatsTable( |
| 198 // truncate the random # to 32 bits for the benefit of Mac OS X, to | 203 // truncate the random # to 32 bits for the benefit of Mac OS X, to |
| 199 // avoid tripping over its maximum shared memory segment name length | 204 // avoid tripping over its maximum shared memory segment name length |
| 200 kStatsFilePrefix + Uint64ToString(base::RandUint64() & 0xFFFFFFFFL), | 205 kStatsFilePrefix + Uint64ToString(base::RandUint64() & 0xFFFFFFFFL), |
| 201 kStatsFileThreads, | 206 kStatsFileThreads, |
| 202 kStatsFileCounters); | 207 kStatsFileCounters); |
| 203 StatsTable::set_current(table); | 208 StatsTable::set_current(table); |
| 204 | 209 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 305 |
| 301 TestShell::ShutdownTestShell(); | 306 TestShell::ShutdownTestShell(); |
| 302 TestShell::CleanupLogging(); | 307 TestShell::CleanupLogging(); |
| 303 | 308 |
| 304 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 309 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
| 305 StatsTable::set_current(NULL); | 310 StatsTable::set_current(NULL); |
| 306 delete table; | 311 delete table; |
| 307 | 312 |
| 308 return 0; | 313 return 0; |
| 309 } | 314 } |
| OLD | NEW |