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 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/env_var.h" | 8 #include "base/env_var.h" |
9 #include "base/event_recorder.h" | 9 #include "base/event_recorder.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/i18n/icu_util.h" | 12 #include "base/i18n/icu_util.h" |
13 #include "base/memory_debug.h" | 13 #include "base/memory_debug.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
18 #include "base/stats_table.h" | 18 #include "base/stats_table.h" |
| 19 #include "base/string_number_conversions.h" |
19 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
20 #include "base/trace_event.h" | 21 #include "base/trace_event.h" |
21 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
22 #include "net/base/cookie_monster.h" | 23 #include "net/base/cookie_monster.h" |
23 #include "net/base/net_module.h" | 24 #include "net/base/net_module.h" |
24 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
25 #include "net/http/http_cache.h" | 26 #include "net/http/http_cache.h" |
26 #include "net/test/test_server.h" | 27 #include "net/test/test_server.h" |
27 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
28 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 if (parsed_command_line.HasSwitch(test_shell::kHeapProfiler)) { | 255 if (parsed_command_line.HasSwitch(test_shell::kHeapProfiler)) { |
255 WebScriptController::registerExtension( | 256 WebScriptController::registerExtension( |
256 extensions_v8::HeapProfilerExtension::Get()); | 257 extensions_v8::HeapProfilerExtension::Get()); |
257 } | 258 } |
258 | 259 |
259 // Load and initialize the stats table. Attempt to construct a somewhat | 260 // Load and initialize the stats table. Attempt to construct a somewhat |
260 // unique name to isolate separate instances from each other. | 261 // unique name to isolate separate instances from each other. |
261 | 262 |
262 // truncate the random # to 32 bits for the benefit of Mac OS X, to | 263 // truncate the random # to 32 bits for the benefit of Mac OS X, to |
263 // avoid tripping over its maximum shared memory segment name length | 264 // avoid tripping over its maximum shared memory segment name length |
264 std::string stats_filename = | 265 std::string stats_filename = kStatsFilePrefix + |
265 kStatsFilePrefix + Uint64ToString(base::RandUint64() & 0xFFFFFFFFL); | 266 base::Uint64ToString(base::RandUint64() & 0xFFFFFFFFL); |
266 RemoveSharedMemoryFile(stats_filename); | 267 RemoveSharedMemoryFile(stats_filename); |
267 StatsTable *table = new StatsTable(stats_filename, | 268 StatsTable *table = new StatsTable(stats_filename, |
268 kStatsFileThreads, | 269 kStatsFileThreads, |
269 kStatsFileCounters); | 270 kStatsFileCounters); |
270 StatsTable::set_current(table); | 271 StatsTable::set_current(table); |
271 | 272 |
272 TestShell* shell; | 273 TestShell* shell; |
273 if (TestShell::CreateNewWindow(starting_url, &shell)) { | 274 if (TestShell::CreateNewWindow(starting_url, &shell)) { |
274 if (record_mode || playback_mode) { | 275 if (record_mode || playback_mode) { |
275 platform.SetWindowPositionForRecording(shell); | 276 platform.SetWindowPositionForRecording(shell); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 TestShell::ShutdownTestShell(); | 389 TestShell::ShutdownTestShell(); |
389 TestShell::CleanupLogging(); | 390 TestShell::CleanupLogging(); |
390 | 391 |
391 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 392 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
392 StatsTable::set_current(NULL); | 393 StatsTable::set_current(NULL); |
393 delete table; | 394 delete table; |
394 RemoveSharedMemoryFile(stats_filename); | 395 RemoveSharedMemoryFile(stats_filename); |
395 | 396 |
396 return 0; | 397 return 0; |
397 } | 398 } |
OLD | NEW |