OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/event_recorder.h" | 10 #include "base/event_recorder.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
14 #include "base/memory/memory_debug.h" | |
15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
16 #include "base/metrics/stats_table.h" | 15 #include "base/metrics/stats_table.h" |
17 #include "base/path_service.h" | 16 #include "base/path_service.h" |
18 #include "base/process_util.h" | 17 #include "base/process_util.h" |
19 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
20 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
21 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
23 #include "net/base/cookie_monster.h" | 22 #include "net/base/cookie_monster.h" |
24 #include "net/base/net_module.h" | 23 #include "net/base/net_module.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 FilePath script_path = cache_path; | 317 FilePath script_path = cache_path; |
319 // Create the cache directory in case it doesn't exist. | 318 // Create the cache directory in case it doesn't exist. |
320 file_util::CreateDirectory(cache_path); | 319 file_util::CreateDirectory(cache_path); |
321 script_path = script_path.AppendASCII("script.log"); | 320 script_path = script_path.AppendASCII("script.log"); |
322 if (record_mode) | 321 if (record_mode) |
323 base::EventRecorder::current()->StartRecording(script_path); | 322 base::EventRecorder::current()->StartRecording(script_path); |
324 if (playback_mode) | 323 if (playback_mode) |
325 base::EventRecorder::current()->StartPlayback(script_path); | 324 base::EventRecorder::current()->StartPlayback(script_path); |
326 } | 325 } |
327 | 326 |
328 if (parsed_command_line.HasSwitch(test_shell::kDebugMemoryInUse)) { | |
329 base::MemoryDebug::SetMemoryInUseEnabled(true); | |
330 // Dump all in use memory at startup | |
331 base::MemoryDebug::DumpAllMemoryInUse(); | |
332 } | |
333 | |
334 webkit_glue::SetJavaScriptFlags(TestShell::GetJSFlagsForLoad(0)); | 327 webkit_glue::SetJavaScriptFlags(TestShell::GetJSFlagsForLoad(0)); |
335 MessageLoop::current()->Run(); | 328 MessageLoop::current()->Run(); |
336 | 329 |
337 if (record_mode) | 330 if (record_mode) |
338 base::EventRecorder::current()->StopRecording(); | 331 base::EventRecorder::current()->StopRecording(); |
339 if (playback_mode) | 332 if (playback_mode) |
340 base::EventRecorder::current()->StopPlayback(); | 333 base::EventRecorder::current()->StopPlayback(); |
341 } | 334 } |
342 | 335 |
343 TestShell::ShutdownTestShell(); | 336 TestShell::ShutdownTestShell(); |
344 TestShell::CleanupLogging(); | 337 TestShell::CleanupLogging(); |
345 | 338 |
346 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 339 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
347 base::StatsTable::set_current(NULL); | 340 base::StatsTable::set_current(NULL); |
348 delete table; | 341 delete table; |
349 RemoveSharedMemoryFile(stats_filename); | 342 RemoveSharedMemoryFile(stats_filename); |
350 | 343 |
351 return 0; | 344 return 0; |
352 } | 345 } |
OLD | NEW |